l4digital / fastscroll Goto Github PK
View Code? Open in Web Editor NEWA ListView-like FastScroller for Android’s RecyclerView.
License: Apache License 2.0
A ListView-like FastScroller for Android’s RecyclerView.
License: Apache License 2.0
first of all thanks for this amazing library it's working great but in one of my screens when recycler view is scrolled using fastscroll the CollapsingToolbarLayout is not collapsing and i can not scroll till end using thumb in this case
It seems that while the bubble is visible the whole vertical area (pink rectangle on screenshot) is tappable and when tapping in that area (pink circle on the screenshot) the bubble jumps to that position and with that scrolls far away from the current position.
The wider the bubble is the wider is that tappable area and accidental jumps happen easy. Would it be possible to only allow dragging the bubble (green rectangle area on screenshot) instead of making the whole vertical area tappable?
This objective-c library is closest I've come across for ios
https://github.com/kentnguyen/KNPathTableViewController
I'm using a FastScrollRecyclerView inside a DialogFragment and whenever I manually scroll down, the thumb goes down to the bottom and sticks to the bottom. I have discovered that the problem comes from the FastScroller#getScrollProportion
. Let me explain why:
final int verticalScrollOffset = recyclerView.computeVerticalScrollOffset(); // verticalScrollOffset == 120
final int verticalScrollRange = recyclerView.computeVerticalScrollRange(); // verticalScrollRange == 400
float proportion = (float) verticalScrollOffset / ((float) verticalScrollRange - mHeight); // mHeight == 400, proportion = 120 / 0 = Infinity
return mHeight * proportion; // returns Infinity
I will try to create a PR whenever I have some free time ;)
Is there any support in auto-hide scroll bar?
I mean, if user touch the scrollbar area show it otherwise hide it with animation (what happens in native dialer app)?
I'm using your library and it's working really nice however I have issue showing the bar when user scroll the recyclerview
I want the bubble to appear when the user start scrolling, is it possible ?
I've implemented it that way:
<com.l4digital.fastscroll.FastScrollRecyclerView
android:id="@+id/rv_country"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:hideScrollbar="false"
app:bubbleColor="@color/primaryLightColor"
app:bubbleTextColor="@color/primaryTextColor"
app:handleColor="@color/primaryDarkColor"
tools:listitem="@layout/item_country" />
Activity:
findViewById<FastScrollRecyclerView>(R.id.recycler_view)?.apply {
layoutManager = LinearLayoutManager(this@ExampleActivity)
adapter = CountryAdapter()
setBubbleVisible(true)
}
Adapter:
override fun getSectionText(position: Int): CharSequence = getItem(position).countryStripAccents[0].toString()
Can we use a custom drawable for the bubble ?
it would be great to increase or decrease the thickness of the thumb and also a custom drawable .
Is it possible or can you make it. I am not using the bubble feature so i want to customize the thumb size
In my app I only want fast scroll but a bubble should not appear. Is it possible to hide it? How?
Hey,
great library so far, way better than most that I used before!
But i got a problem with the UI-Handle. Sometimes it snaps back to the top. It seems the problem occurs when I release while dragging or some kind of swipe motion in generel. The handle snaps back to top then, the position inside the recyclerview is correct though.
Also, when I scroll my recyclerview, the handle snaps back to the top.
I use a custom layout manager which is not a derivation of LinearLayoutManager.
Have a look here: https://github.com/turing-tech/MaterialScrollBar
App is crashing when i am trying the with android.support.v4.widget.SwipeRefreshLayout as a Parent ViewGroup.
Just started using this in my application and it took me a while to find how to set a listener for scrolling by #12. So, it would be great if it is mentioned in the README as well.
I use android studio to import the project, but I got a error :
Could not get unknown property 'bintray_user' for object of type com.jfrog.bintray.gradle.BintrayExt
what went wrong?
Behavior similar to #5, the handle is shown when the adapter implements Filterable and the search filter returns an empty dataset.
As a bonus, this caused my app to crash when touching the handle in that situation, because my implementation of the getSectionText() method, calling .get() on an empty list, threw an ArrayIndexOutOfBoundsException.
I fixed implementing the following code in my class, but in my opinion this should be managed by the Fastscroller itself:
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
MyClassBinding binding = MyClassBinding.inflate(getLayoutInflater());
FastScrollRecyclerView recyclerView = binding.recyclerView;
[... myAdapter initialization ...]
myAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override public void onChanged() {
super.onChanged();
recyclerView.setFastScrollEnabled(myAdapter.getItemCount() != 0);
}
});
[...]
return binding.getRoot();
}
Could you add setSectionIndexer to FastScrollRecyclerView?
I use common adapter for all screens and because of this limitation I have to extend the adapter for all screens I have to use the library:
public void setSectionIndexer(FastScroller.SectionIndexer sectionIndexer) {
mFastScroller.setSectionIndexer(sectionIndexer);
}
https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
AFAIK, currently library is available only on JCenter.
Hello! Thank you for the lovely library.
It seems like with the new 3.0.0-beta
updates setSectionIndexer
method is no longer exposed for FastScrollRecyclerView
?
That would be nice to have one!
Hi! Thank you for such a great library! It works great but I'm facing a problem when using it in a activity which has a drawer layout with a navigation view which opens from the right.
When I try to scroll using the handle, most of the time, the scroll stops suddenly while my finger still is touching the screen and the right navigation view starts to open.
Also, when I have the showtrack property set to true, start a scroll and try to touch the track, it also doesn't work well.
While writing this report, I decided to use the padding support you added based on #15 and it seemed to make the behaviour much better as it doesn't compete with the right navigation view.
I decided to open this issue anyway because it would be very good if you could check this out. Maybe disable the touch processing of the parent view when handling track and handle touch.
Thanks for any advice.
Problem
For the same RecyclerView I use FastScroll and sticky headers library by @bgogetap, which also uses parent layout to draw views. Because of this sticky header overlaps fast scroll bubble and scrollbar.
Proposed solution
Add fast scroll views as a params to the listener methods, so we can call .bringToFront()
on them.
Now that Kotlin is widely accepted as the standard language for Android development, we should improve FastScroll's Kotlin support by converting the library language to Kotlin.
I have the following layout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeLayout"
android:layout_height="match_parent"
android:layout_width="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_height="match_parent"
android:layout_width="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
<com.l4digital.fastscroll.FastScroller
app:bubbleColor="?colorAccent"
app:handleColor="?colorAccent"
android:id="@+id/fastScroller"
android:layout_gravity="end"
android:layout_height="match_parent"
android:layout_width="wrap_content"
app:showTrack="false" />
</FrameLayout>
which worked fine in 1.0.4. However, after upgrading to 1.1.0 the index bubble now runs off the bottom of the screen. The track and handle also run off the bottom. In addition, the bubble is offset from the handle; it's about 50% lower. The issue is also present in 1.1.1.
I need of distinguishing between padding left and other paddings of fastscroll.
Now all paddings have the same value : fastscroll_scrollbar_padding.
Can you separate them with for example
fastscroll_scrollbar_padding_left
fastscroll_scrollbar_padding_top
ecc...?
Thanks
I still can't import FastScrollRecyclerView yet i have already add 'implementation "io.github.l4digital:fastscroll:2.0.1"
cannot find symbol
private FastScrollRecyclerView recyclerView;
On my phone, using the scrollbar is difficult because of how tiny it is. I really have to touch the edges of my phone in order to scroll properly. Is there any way to make to holdable scrollbar area bigger? I'd like to adjust the width and I can't find any documentation on doing so.
Hi.
We use fast scroller on a recycler view but some of user's session (We use Fabric) show this error:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.support.v7.widget.RecyclerView.computeVerticalScrollOffset()' on a null object reference
at com.l4digital.fastscroll.FastScroller.getScrollProportion(FastScroller.java:443)
at com.l4digital.fastscroll.FastScroller.access$000(FastScroller.java:51)
at com.l4digital.fastscroll.FastScroller$3.run(FastScroller.java:221)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:251)
at android.app.ActivityThread.main(ActivityThread.java:6589)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Library Version:
api 'com.l4digital.fastscroll:fastscroll:1.1.1'
Hi,
I am implementing the FastScroll for a directory/contacts style app, however, I have a custom action bar/toolbar and I can't seem to get the bubble for "a" and "b" displaying as it underneath the action bar, however, the handle stops at the bottom of the action bar. Is there a style I can override that will allow the bubble to lay on top of the handle (not have a large space between the bubble and top of the scroll handle) so it isn't hidden by the action bar?
Thanks for your help :)
Can you provide option so with that i can set handle by default position with distance of toolbar. Please once see in WhatsApp. There are almost 10 - 15 dp space between toolbar and scroll handle by default. If possible then please provide something like this option.
Your library is phenomenal! On the Google Contacts app, their handle for FastScroll is much bigger than the one in your library. Can you add an XML attribute to adjust the size? By the way, I thought you might appreciate the comment from this SO user who said: "We're working with this library in production with a large user base app w/o any problem."
I can't use inside SwipdeRefreshLayout, because cant drag FastScroll.
When I do action drag FastScrollbar, refresh action begin.
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_below="@+id/fragCardlist_divider"
android:id="@+id/fragCardlist_swipe"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.l4digital.fastscroll.FastScrollRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:bubbleColor="@color/viewpager_underline"
app:bubbleTextColor="@color/white"
app:handleColor="@color/viewpager_underline"
app:hideScrollbar="false"
app:showTrack="false"
/>
</FrameLayout>
</android.support.v4.widget.SwipeRefreshLayout>
Bubble appear on top of Collapsing toolbar when toolbar is in expanded mode.
Hi
Pls add size bubble setting.
Ty!
Hi! Library is cool and smooth to use. Like it.
I'm interesting. Is this possible to make it working inside ScrollView/NestedSV? I tried. but it doesn't work. The XML
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.l4digital.fastscroll.FastScrollRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:bubbleColor="@color/blue_main"
app:bubbleTextColor="#ffffff"
app:handleColor="#999999"
app:hideScrollbar="false"
app:showTrack="true"
app:trackColor="@color/blue_light" />
</ScrollView>
In code
binding.recyclerView.setAdapter(adapter);
binding.recyclerView.setNestedScrollingEnabled(true); // with false the same result
binding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
Thanks!
Scroll view works well as name said fast scroller, but bubble view is not showing at all on scroll!
@Override
public String getSectionText(int position) {
return "some text";
}
When I try to normally scroll the list the thumb of the fast scroller doesn't touch end of the list, but it touched when I use thumb to scroll.
To fix crash you need to make following changes:
class FastScrollRecyclerView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FastScrollRecyclerView(context, attrs, defStyleAttr) {
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
adapter = null
}
}
When recycleView does not have enough items to scroll, FastScroller should hide handle.
i use: linearLayoutManager.setStackFromEnd(true)
and also always scroll to bottom, when first showing the view (containing messages).
at first start the scrollbar shows at top position, which is wrong in this case (because view is scrolled all the way down).
when i scroll a little, it fixes itself and show correctly at bottom position.
can you fix it?
Sometimes I am scrolling and I by accident touch the handle track much farther down than I am currently viewing, and it skips very far down and I lose my place. Is there a way/is it possible that you can add a way to disable navigation any other way than by dragging the handle itself? If you tell me what needs to be done and where the relevant code is, I can try and make a PR, but I am very busy, so no guarantee.
In FastScroller.java
, where it's checking the parent layout, SwipeRefreshLayout
ought to be allowed so we can do pull to refresh.
Great library! Thanks for early migration to AndroidX.
In this layout I'm working on, my scrollbar is half-hidden when bottom padding is set to the recycler view. Changing clipToPadding
value seem to have no effect, while removing bottom padding resolve the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.