diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/view/FastScroller.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java b/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java index c698e37b..07f899ed 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java +++ b/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java @@ -117,7 +117,6 @@ public class FastScroller extends LinearLayout { public void attachRecyclerView(RecyclerView recyclerView) { this.recyclerView = recyclerView; recyclerView.addOnScrollListener(scrollListener); - recyclerView.setVerticalScrollBarEnabled(false); } public void detachRecyclerView() { recyclerView.removeOnScrollListener(scrollListener); @@ -218,9 +217,16 @@ public class FastScroller extends LinearLayout { float proportion = (float)position/(float)itemCount; setBubbleAndHandlePosition(height*proportion); - if(!hasScrolled && (dx > 0 || dy > 0)) { - setVisibility(View.VISIBLE); - hasScrolled = true; + if((visibleRange * 2) < itemCount) { + if (!hasScrolled && (dx > 0 || dy > 0)) { + setVisibility(View.VISIBLE); + hasScrolled = true; + recyclerView.setVerticalScrollBarEnabled(false); + } + } else if(hasScrolled) { + setVisibility(View.GONE); + hasScrolled = false; + recyclerView.setVerticalScrollBarEnabled(true); } } } |