• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A library that provides the sticky-index and fast-scroller capabilities to your Android App

sticky-index & fast-scroller

Provides sticky-index and fast-scroller UI components

Showcase

How to use

  1. Import the dependencies
repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    compile 'com.github.edsilfer:sticky-index:1.3.0'
}

  1. Add the component to your XML layout, right after the RecyclerView:
<br.com.stickyindex.view.StickyIndex
    android:id="@+id/stickyIndex"
    android:layout_width="80dp"
    android:layout_height="wrap_content"
    android:textSize="20sp"
    android:textStyle="bold"
    app:rowHeight="64dp"
    app:stickyWidth="60dp" />

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

 <br.com.stickyindex.view.FastScroller
    android:id="@+id/fastScroller"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_alignParentEnd="true"
    android:layout_marginBottom="10dp"
    android:layout_marginTop="10dp" />

PS: FastScroller is optional

  1. Customize sitcky-index: You can customizing the stick-index with the following arguments:
  • xml android:textSize: changes the index list text size;
  • xml android:textStyle: changes the index list text style;
  • xml android:textColor: changes the index list test color;
  • xml app:rowHeight: changes the index list row height;
  • xml app:stickyWidth: changes the LinearLayout width that wrappers the text - which, by its turn, it is centralized inside it. Use this atribute to control the distance of the index list from the corner of its parent.

The last attribute xml android:rowHeight is mandatory. sticky-index consists of a RecyclerView which must match the reference one (in terms of ScrollListener and rowHeight). Having different rowHeights WILL lead to layout failures.

  1. initialize it in the container main class. The dataSet (a char array that will contain the indexes) must have the same size as the main list, with each row corresponding to the element that it will be associated). Finally, set the reference RecyclerView that will control the scroll movement:
    // Acquire component's reference
    StickyIndex stickyIndex = findViewById<StickyIndex>(R.id.stickyIndex);
    FastScroller fastScroller = findViewById<FastScroller>(R.id.fastScroller);
    // Binds the RecyclerViews to synchronize the scroll event between the them
    stickyIndex.bindRecyclerView(recyclerView);
    fastScroller.bindRecyclerView(recyclerView);
    // Adds the sticky index content to the stickyIndex. This must be called whenever the content changes
    stickyIndex.refresh(convertToIndexList(contacts))

License

Copyright 2018 Edgar da Silva Fernandes

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

emoji-keyboard

A library that provides an emoji-keyboard implementation for Android applications
Kotlin
154
star
2

custom-searchable

This repository contains a library that aims to provide a custom searchable interface for android applications.
Java
47
star
3

android-user-onboarding

Provides an easy to set User OnBoarding based on Google's design
Kotlin
23
star
4

proof-of-concepts

Contains a set of PoCs in order to evaluate different technologies and strategies
Kotlin
21
star
5

marvel-characters

This App consumes MARVEL public API in order to present its chatacters information through a clean and beautfull user interface
Java
8
star
6

android-search-interface

Provides a search interface that allows the user to select results, decreasing the amount of code necessary for this common feature to any android application
Kotlin
8
star
7

android-chip-interface

Provides an easy to set interface to add Android Chips on your App
Kotlin
7
star
8

moviedb

Showcase Android Application built using Kotlin and Anko that displays the basic concepts of the technology by consuming The Movie DB Web API
Kotlin
5
star
9

star-wars-wiki

A sample application that consumes a web API and demonstrate the use of several mobile programming good practices
Kotlin
4
star
10

rxjs-hello-world

HTML
3
star
11

algorithms

Algorithm study resources such as: sorting, searching and data structures - in order to stay sharp on what really matters
Java
2
star
12

circular-picker

Kotlin
2
star
13

android-tools

Provides a set of scripts and small tools to help throughout the development of Android Applications
CSS
1
star