Giter Site home page Giter Site logo

myinnos / alphabetindex-fast-scroll-recyclerview Goto Github PK

View Code? Open in Web Editor NEW
600.0 10.0 115.0 1.97 MB

A Powerful AlphabetIndex FastScroller Library for Android's RecyclerView!

Home Page: https://myinnos.github.io/AlphabetIndex-Fast-Scroll-RecyclerView/

License: Apache License 2.0

Java 1.38% Kotlin 98.62%
android recyclerview indexing android-recyclerview alphabetindex-fastscroller kotlin

alphabetindex-fast-scroll-recyclerview's Introduction

Hello World 👋

I am Prabhakar Thota, Mobile Engineer, UI/UX with more than six years of experience in a broad range of industries. I believe in the quote, "Creativity is thinking up new things. Innovation is doing new things". The quote inspires me to be always creative, innovative and a learner. Also, I have built multiple android apps on my own, one of which has over 4.5 million downloads.

GIF

I am also an open-source enthusiast and maintainer. i learned a lot from the open-source community and i love how collaboration and knowledge sharing happened through open-source.

Certified for Play Store Listing by Google Play Academy #56586068

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

LinkedIn Twitter instagram youtube
Hashnode medium dev.to clubhouse producthunt

Reddit User Karma

alphabetindex-fast-scroll-recyclerview's People

Contributors

abandonedcart avatar appspell avatar benniebotha avatar hamza417 avatar imgbotapp avatar ivanabakumov avatar libernys avatar mflisar avatar myinnos avatar raphaelmarion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alphabetindex-fast-scroll-recyclerview's Issues

Showing or Hiding the fast scroll

Hi, I want to hide the Fast scroll when user filtering the recycle view and I want to make the Fast scroll visible if the search edit text length is zero. Help me on showing and hiding the Fast scroll.

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[])
}
}

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.

Suggestion: enable setting the indexBarText to be centered horizontally

I love this library, it saves my day, especially your callback allows me to handle position pinning by myself, so that I can list out all alphabets can calculate positions correspondingly even there are no such alphabet.

I found that the text in the text bar now aligns to the right; but I think it would be better for us to control this, like if we can center it horizontally in its parent.

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

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?

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)

How to scroll at specific section

I want to scroll it to "F" section when it opens, Is it possible?
have tried with
mAdapter?.let { it.getPositionForSection(6) it.notifyDataSetChanged() }

mAdapter?.let { it.getSectionForPosition(6) it.notifyDataSetChanged() }

setIndexbarMargin doesn't work

Hi,

I am with AlphabetIndex-Fast-Scroll-RecyclerView:1.0.8 and I have a problem when I try to remove the margin of the IndexBar. I have tried to set the parameter in the layout and the class but neither work.

This is how I put in the layout:
Sometimes I could see how the parameter is apply but when I exit and open the layout again, the IndexBar has margin again.

<in.myinnos.alphabetsindexfastscrollrecycler.IndexFastScrollRecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:setIndexbarMargin="0"
app:setIndexbarWidth="0"
/>

This is how I put in the class:

//Setup recyclerViewFastScroll
mBinding.incRecyclerView.recyclerView.setIndexBarTransparentValue((float) 1.0);
mBinding.incRecyclerView.recyclerView.setIndexBarCornerRadius(0);
mBinding.incRecyclerView.recyclerView.setIndexbarMargin(0);
mBinding.incRecyclerView.recyclerView.setPreviewPadding(0);
mBinding.incRecyclerView.recyclerView.setIndexBarColor("#"+Integer.toHexString(ContextCompat.getColor(mActivity, R.color.color_primary_dark)));
mBinding.incRecyclerView.recyclerView.setIndexbarHighLateTextColor("#"+Integer.toHexString(ContextCompat.getColor(mActivity, R.color.color_eab817)));
mBinding.incRecyclerView.recyclerView.setIndexBarHighLateTextVisibility(true);
mBinding.incRecyclerView.recyclerView.setIndexBarVisibility(true);

I execute in Android 4.4.2 and Android 6.0.1.

What's the problem?

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

getSections() should be called if adapter calls notifyDataSetChanged()

Normally we set adapter in recyclerview first before we downloaded all items from internet, and set the list later on which at the same time calls notifyDataSetChanged().

But I found that the indexBar doesn't update accordingly. In fact since this is the case, the "sectionPositions" arraylist always remains empty.

not working in appCompect

    mRecyclerView.setPreviewColor("#00FF00");
    mRecyclerView.setPreviewTextColor("#FFFFFF");
    mRecyclerView.setPreviewTransparentValue(0.6f);

@Not working in appCompect

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

Using cursor instead of Arraylist scroller shows but does nothing when clicked

What method or component handles the responsibility of the onclick for the alphabet scroller. I have the scroller with all the alphatbets due to successful implementation of the getSections method however I am not sure where the onclick of the scroller functionality is designated. Thanks for your assistance.

吸顶

看着文章过来的建议加入吸顶效果

Downloading

When I was putting the line
compile 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0'
into the gradle, Android Studio was yelling at me
Error:(44, 13) Failed to resolve: com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0

onBindViewHolder position value not correctly assigning values

I have a function that looks something like the one below

@OverRide
public void onBindViewHolder(@nonnull ProcedureViewHolder holder, int position) {
if(position % 17 == 0){
holder.procedureName.setTextColor(context.getResources().getColor(R.color.com_facebook_blue));
}
}

and when I run it, the rows that change text color are seemingly random. There are several places where 2 or 3 rows in a row have blue text. For sure there are more than every 17th items whos text is blue

Issues: Index Bar overlapping content || Index Bar Height Matches view Parent

  1. The Index Bar overlaps content. If your ViewHolder layout doesn't have a margin, the Index Bar gets in the way of the content. Its even worse if you give the Index Bar a margin. This is true both for Vertical Views and Grid Views. Could you possibly add and attribute like app:indexBarContentMargin so that the users can set the Index Bar margin from viewHolder content.

  2. When you have few items in your RecyclerView, there are of course less sections for the Index Bar to display. Could you add an option/attribute like app:wrapIndexBarSectionText so that the Index Bar can wrap it's height to the amount of section content in it. Possibly even adding the option setIndexBarGravity="TOP", setIndexBarGravity="Center" and setIndexBarGravity="Bottom".
    Currently the Index Bar spans the full height of the view regardless of how many sections there are to show in it. It looks quite bad when you have few items in your RecyclerView.

Thank you.

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..

setIndexbarWidth() is not using a correct density

According to README and the code inside, I think setIndexbarWidth takes dp as input instead of pixel, since I saw you multiplied this input by mDensity.

However, I tested on 2 devices with different density, it is very clear that the index bar has very different size. The size on a higher density device is much smaller.

I therefore think the conversion from dp to pixel is incorrect.

I usually use the below code to convert from dp to pixel:
public static int pixelFromDp (Resources r, int dp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics()); }

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:

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”

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.