A Powerful AlphabetIndex FastScroller Library for Android's RecyclerView!

Overview

AlphabetIndex Fast Scroll RecyclerView

A Powerful AlphabetIndex FastScroller for Android's RecyclerView!

AlphabetIndex-Fast-Scroll-RecyclerView - Example1 AlphabetIndex-Fast-Scroll-RecyclerView - Example2 AlphabetIndex-Fast-Scroll-RecyclerView - Example3

Kindly use the following links to use this library:

In build.gradle (Project)

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

And then in the other gradle file(may be your app gradle or your own module library gradle, but never add in both of them to avoid conflict.)

dependencies {
    // AppCompat version
       implementation 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92'
	or
    // AndroidX version
       implementation 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.95'
}

How to use

Step 1: add this to your xml:

<in.myinnos.alphabetsindexfastscrollrecycler.IndexFastScrollRecyclerView
    android:id="@+id/fast_scroller_recycler"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

Step 2: implement SectionIndexer to RecyclerViewAdapter.

public class RecyclerViewAdapter extends RecyclerView.Adapter<ViewHolder> implements SectionIndexer {

private List<String> mDataArray;
private ArrayList<Integer> mSectionPositions;
    
.....
    
@Override
public int getSectionForPosition(int position) {
    return 0;
}
 
@Override
public Object[] getSections() {
    List<String> sections = new ArrayList<>(26);
    mSectionPositions = new ArrayList<>(26);
    for (int i = 0, size = mDataArray.size(); i < size; i++) {
        String section = String.valueOf(mDataArray.get(i).charAt(0)).toUpperCase();
        if (!sections.contains(section)) {
            sections.add(section);
            mSectionPositions.add(i);
        }
    }
    return sections.toArray(new String[0]);
}
 
@Override
public int getPositionForSection(int sectionIndex) {
    return mSectionPositions.get(sectionIndex);
}
    
}

Note: mDataArray: this is your recycler data array model.

Features

  • Change IndexTextSize:
 mRecyclerView.setIndexTextSize(12);
  • Change IndexBarTextColor:
 mRecyclerView.setIndexBarTextColor("#FFFFFF");

 mRecyclerView.setIndexBarTextColor(R.color.index_bar_text_color);
  • Change IndexBarColor:
 mRecyclerView.setIndexBarColor("#33334c");

 mRecyclerView.setIndexBarColor(R.color.index_bar_color);
  • Change IndexBarCornerRadius:
 mRecyclerView.setIndexBarCornerRadius(3);
  • Change IndexBarTransparentValue:
mRecyclerView.setIndexBarTransparentValue((float) 0.4);
  • Change IndexbarMargin:
 mRecyclerView.setIndexbarMargin(4);
  • Change IndexbarWidth:
 mRecyclerView.setIndexbarWidth(40);
  • Change PreviewPadding:
 mRecyclerView.setPreviewPadding(2);
  • Change PreviewVisibility:
 mRecyclerView.setPreviewVisibility(false);
  • Change Typeface:
 Typeface typeface = Typeface.createFromAsset(context.getAssets(), "Custom-Font.ttf");
 mRecyclerView.setTypeface(typeface);
  • To hide/show Fast Scroll IndexBar:
mRecyclerView.setIndexBarVisibility(true);
  • Change IndexBarHighLateTextColor:
mRecyclerView.setIndexbarHighLightTextColor("#33334c);

mRecyclerView.setIndexbarHighLightTextColor(R.color.index_bar_highlight_text_color);
  • To hide/show IndexBarHighLightText:
mRecyclerView.setIndexBarHighLightTextVisibility(true);
  • To hide/show IndexBarStroke:
mRecyclerView.setIndexBarStrokeVisibility(true);
  • Change IndexBarStrokeWidth:
mRecyclerView.setIndexBarStrokeWidth(1);
  • Change IndexBarStrokeColor:
mRecyclerView.setIndexBarStrokeColor("#000000");

Compatibility

This library works with any layout manager but is optimized for the use with a LinearLayoutManager.

Any Queries? or Feedback, please let me know by opening a new issue!

Contact

Prabhakar Thota

If you appreciate my work, consider buying me a cup of to keep me recharged 🤘 by PayPal

Special Contributors

@jonas-arkulpa
@MFlisar
@RaphaelMarion
@appspell
@Libernys
@IvanAbacumov

License

Copyright 2017 - 2019 MyInnos

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.
Comments
  • Can not set index bar fully transparent

    Can not set index bar fully transparent

    Hello,

    I've tried many ways but can not set background of index bar transparent. I've used: recyclerView.setIndexBarTransparentValue((float) 0); recyclerView.setIndexBarColor("#00FFFFFF"); and tried to set it using xml too, but no luck.

    Can you help me? Thanks.

    bug help wanted 
    opened by xuanthupro 11
  • Implementing the library

    Implementing the library

    The following error occurs when trying to implement: Could not find com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.94. Searched in the following locations:

    • file:/C:/sdk/extras/m2repository/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.pom
    • file:/C:/sdk/extras/m2repository/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.jar
    • file:/C:/sdk/extras/google/m2repository/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.pom
    • file:/C:/sdk/extras/google/m2repository/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.jar
    • file:/C:/sdk/extras/android/m2repository/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.pom
    • file:/C:/sdk/extras/android/m2repository/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.jar
    • https://dl.google.com/dl/android/maven2/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.pom
    • https://dl.google.com/dl/android/maven2/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.jar
    • https://jcenter.bintray.com/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.pom
    • https://jcenter.bintray.com/com/github/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/1.0.94/AlphabetIndex-Fast-Scroll-RecyclerView-1.0.94.jar
    opened by theoklink 6
  • Sometimes the bar is empty

    Sometimes the bar is empty

    I have an app that is constantly running and showing/hiding it's view on demand (a sidebar like app).

    What I see is that rarely the fast scroller shows up empty after some time (after many days, hardly reproduceable).

    Any ideas what could cause this? I have no idea yet, did check the fast scrollers code but did not find anything that could cause this..

    opened by MFlisar 6
  • implement scroll to fallback for non linear layout managers

    implement scroll to fallback for non linear layout managers

    Hey @myinnos, I implemented a fallback if a non linear layout manager is used. If this happened before the app crashed because the layout manager could not be cast to a linear one. I understand that only the linear layout manager has the method scrollToPositionWithOffset, to position the first view at top. But with the fallback the minimal functionality is working on any adapter and works the same as before for linear ones. With the fallback your lib works perfect with https://github.com/ShamylZakariya/StickyHeaders. This lib has a non linear adapter but scrollToPosition displays the selected position at the top by default.

    opened by jonas-app 6
  • java.lang.Object[] cannot be cast to java.lang.String[]

    java.lang.Object[] cannot be cast to java.lang.String[]

    java.lang.Object[] cannot be cast to java.lang.String[]

    public void setAdapter(RecyclerView.Adapter adapter) { if (adapter instanceof SectionIndexer) { adapter.registerAdapterDataObserver(this); mIndexer = (SectionIndexer) adapter; mSections = (String[]) mIndexer.getSections(); <--- erro line(ava.lang.Object[] cannot be cast to java.lang.String[]) } }

    opened by DeepanJN 4
  • Quick question about color change

    Quick question about color change

    So currently I'm working on getting themes to change. Wanna throw something out the window.

    Is there anyway to change the color of the text on the scroller? Is there also a way to call from colors.xml to change the color?

    enhancement 
    opened by jakepurple13 4
  • Suggestions

    Suggestions

    I would have following suggestions:

    • change your color attributes to be integers instead of strings
    • remove the transparency parameter => just extract the transparency from the color itself

    This breaks your current API though but would fit to the way nearly every android library works. I would add this to my pull request if that's ok for you

    enhancement 
    opened by MFlisar 3
  • Added ability to hide the preview box

    Added ability to hide the preview box

    I am using this to make an index bar that has an index from 1 to 150. I only show multiples of 10 on the bar, so it was displaying a blank preview box most of the time. I thought about just not displaying it when the index was "" (which is included in this code), but then I decided to just remove the preview altogether, and run with that, at least for now.

    It also might be nice if the preview displayed a number even when the index bar had a blank string for that item, but that would require two strings per section (one for the index bar, and a different one for the preview), and I thought that might be too big a change.

    opened by bshafer 3
  • Listen for adapter data changes

    Listen for adapter data changes

    Dear @myinnos, thanks for your work. This lib fits almost all my needs. My only additional requirement is to update the sections if the data changes. With my first Commit (https://github.com/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/commit/1ad4558ac0231813373f7d8b9cb0eb68291ebc2a) I add this functionality. The second Commit (https://github.com/myinnos/AlphabetIndex-Fast-Scroll-RecyclerView/commit/7a7db2e1b6c0cbef0808159f0989430da196c2d3) modifies the example to show the new feature. If you remove all 'A'-items (by clicking them) the sections get updated (section 'A' gets removed).

    opened by jonas-app 3
  • Failed to resolve library

    Failed to resolve library

    As per your description, I am integrating this library but I got following error.

    This is my build.gradle(project) file: allprojects { repositories { ... maven { url "https://jitpack.io" } } }

    build.gradel(app) file

    implementation 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.94'

    ERROR: Failed to resolve: com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.94

    opened by abhishekinexture 2
  • Conflict with allowBackup and supportsRTL in manifest file.

    Conflict with allowBackup and supportsRTL in manifest file.

    For some applications that have allowBackup and/or supportsRtl set to false we receive the following error when trying to use your library:

     Manifest merger failed : Attribute application@allowBackup value=(false) from [:corevero] AndroidManifest.xml:12:9-36
      	is also present at [com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.8] AndroidManifest.xml:12:9-35 value=(true).
      	Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at manifestMerger3423917709392243790.xml:7:5-9:19 to override.
    

    Would it be possible to have those two lines* removed from the manifest of the library? This should resolve the issue for those with different settings without causing any new issues afaik.

    Thanks

    *android:allowBackup=“true” android:supportsRtl=“true”

    opened by maolmhuire 2
  • Index Bar Height

    Index Bar Height

    Hi, Is there any way to set specific Height to index Bar? For now, It is taking the height of recycler. I want to set a specific height to index bar. Can you provide the way? thanks

    opened by saadkhalidkhan 1
  • stroller of alphabet got compressed

    stroller of alphabet got compressed

    hello, I am facing an issue while using this library that I am using edit text with this recyclerView so when I click on edit text and keyboard opens up the scroller of alphabets got compressed can you please guide me to fix it. -thanks for making this library as well

    opened by asadullah06 1
  • Crash while scrolling index & filter

    Crash while scrolling index & filter

    I found there is a crash while scrolling using the index letters(at the right side of the view) and filter. Please take a look when you get a chance. Added error log

    2019-10-31 12:58:49.414 12373-12373/? E/application: Fatal Exception occurred: length=2; index=24 2019-10-31 12:58:49.417 12373-12373/? E/application: Stack Trace: java.lang.ArrayIndexOutOfBoundsException: length=2; index=24 at in.myinnos.alphabetsindexfastscrollrecycler.IndexFastScrollRecyclerSection.draw(IndexFastScrollRecyclerSection.java:94) at in.myinnos.alphabetsindexfastscrollrecycler.IndexFastScrollRecyclerView.draw(IndexFastScrollRecyclerView.java:105) at android.view.View.updateDisplayListIfDirty(View.java:19315) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.draw(View.java:20373) at android.view.View.updateDisplayListIfDirty(View.java:19315) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.draw(View.java:20373) at android.view.View.updateDisplayListIfDirty(View.java:19315) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.updateDisplayListIfDirty(View.java:19306) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.updateDisplayListIfDirty(View.java:19306) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.updateDisplayListIfDirty(View.java:19306) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.updateDisplayListIfDirty(View.java:19306) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.updateDisplayListIfDirty(View.java:19306) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.updateDisplayListIfDirty(View.java:19306) at android.view.View.draw(View.java:20093) at android.view.ViewGroup.drawChild(ViewGroup.java:4421) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207) at android.view.View.draw(View.java:20373) at com.android.internal.policy.DecorView.draw(DecorView.java:980) at android.view.View.updateDisplayListIfDirty(View.java:19315) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:686) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:692) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:800) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3496) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3283) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2818) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1780) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7827) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

    opened by Xuemin91 1
Releases(1.0.99)
Owner
Prabhakar Thota
Mobile Engineer, UI/UX. I believe in the quote, "Creativity is thinking up new things. Innovation is doing new things." Happy Coding :)
Prabhakar Thota
ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features

ChipsLayoutManager This is ChipsLayoutManager - custom Recycler View's LayoutManager which moves item to the next line when no space left on the curre

Oleg Beloy 3.2k Dec 25, 2022
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

XRecyclerView a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need

XRecyclerView 5.3k Dec 26, 2022
Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.

Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.

Jack and phantom 504 Dec 25, 2022
RecyclerView : SleepQualityTracker with RecyclerView app

RecyclerView - SleepQualityTracker with RecyclerView app SleepQualityTracker with RecyclerView This app builds on the SleepQualityTracker developed pr

Kevin 2 May 14, 2022
TikTok-RecyclerView - This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoPlayer2.

TikTok-RecyclerView Demo About This is a demo app built using 'Koin' a new dependency injection framework for Android along with RecyclerView and ExoP

Baljeet Singh 19 Dec 28, 2022
Pagination-RecyclerView - Simple and easy way to Paginating a RecyclerView

Pagination-RecyclerView Simple and easy way to Paginating a RecyclerView Android

Rakshit Nawani 0 Jan 3, 2022
An Android Animation library which easily add itemanimator to RecyclerView items.

RecyclerView Animators RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations. Please feel

Daichi Furiya 11.2k Jan 8, 2023
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expa

Haruki Hasegawa 5.2k Dec 23, 2022
Android library providing simple way to control divider items (ItemDecoration) of RecyclerView

RecyclerView-FlexibleDivider Android library providing simple way to control divider items of RecyclerView Release Note [Release Note] (https://github

Yoshihito Ikeda 2.4k Dec 18, 2022
Android Library to provide swipe, click and other functionality to RecyclerView

RecyclerViewEnhanced Android Library to provide swipe, click and other functionality to RecyclerView Usage Add this to your build.gradle file dependen

Nikhil Panju 1k Dec 29, 2022
Android library defining adapter classes of RecyclerView to manage multiple view types

RecyclerView-MultipleViewTypeAdapter RecyclerView adapter classes for managing multiple view types Release Note [Release Note] (https://github.com/yqr

Yoshihito Ikeda 414 Nov 21, 2022
Android library for RecyclerView to manage order of items and multiple view types.

recyclerview-binder Android Library for RecyclerView to manage order of items and multiple view types. Features Insert any items to wherever you want

Satoru Fujiwara 185 Nov 15, 2022
An efficient TabLayout library implemented with RecyclerView.

RecyclerTabLayout An efficient TabLayout library implemented with RecyclerView. Features Efficient when having many tabs Easy setup with ViewPager (sa

Shinichi Nishimura 1.3k Dec 9, 2022
Android Library to provide swipe, click and other functionality to RecyclerView

RecyclerViewEnhanced Android Library to provide swipe, click and other functionality to RecyclerView Usage Add this to your build.gradle file dependen

Nikhil Panju 1k Dec 29, 2022
the library is a loop RecyclerView(expression), can show some effects when display

CircleRecyclerView the library is a loop RecyclerView, can show some effects when display screenshot CircularViewMode ScaleXViewMode & ScaleYViewMode

Matt Yao 704 Jan 5, 2023
Epoxy is an Android library for building complex screens in a RecyclerView

Epoxy Epoxy is an Android library for building complex screens in a RecyclerView. Models are automatically generated from custom views or databinding

Airbnb 8.1k Dec 29, 2022
Elegant design and convenient to use RecyclerView adapter library based on Kotlin DSL.

xAdapter: Kotlin DSL 风格的 Adapter 封装 1、简介 该项目是 KotlinDSL 风格的 Adapter 框架封装,用来简化 Adapter 调用,思想是采用工厂和构建者方式获取 Adapter 避免代码中定义大量的 Adapter 类。该项目在 BRVAH 的 Ada

ShouHeng 17 Oct 9, 2022
An android library for quick setup of RecyclerView

SmartRecyclerView for Android An android library to quickly setup RecyclerView(List) with SwipeRefreshLayout Support, written entirely in Kotlin. Supp

Kunal Pasricha 16 Oct 18, 2022
A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.

UltimateRecyclerView Master branch: Dev branch: Project website:https://github.com/cymcsg/UltimateRecyclerView Description UltimateRecyclerView is a R

MarshalChen 7.2k Jan 2, 2023