diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-08-24 17:48:00 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-08-24 17:48:00 -0700 |
commit | 6d30b8cfda0c8d848d20abc6cd9805ed763836ef (patch) | |
tree | f3f2dd1b7881f51cdb0d4598c097e8e138bc9eeb /app/src/main/java/github/daneren2005/dsub/view | |
parent | c6d2629702b220e0ce9c19e41793dad84edcbb76 (diff) | |
download | dsub-6d30b8cfda0c8d848d20abc6cd9805ed763836ef.tar.gz dsub-6d30b8cfda0c8d848d20abc6cd9805ed763836ef.tar.bz2 dsub-6d30b8cfda0c8d848d20abc6cd9805ed763836ef.zip |
Add fast scrolling with no bubble to NowPlayingFragment
Diffstat (limited to 'app/src/main/java/github/daneren2005/dsub/view')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/view/FastScroller.java | 20 |
1 files changed, 15 insertions, 5 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 1cc11c08..fdf2b815 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java +++ b/app/src/main/java/github/daneren2005/dsub/view/FastScroller.java @@ -45,6 +45,7 @@ public class FastScroller extends LinearLayout { private RecyclerView recyclerView; private final ScrollListener scrollListener = new ScrollListener(); private int height; + private boolean visibleBubble = true; private ObjectAnimator currentAnimator = null; @@ -90,8 +91,13 @@ public class FastScroller extends LinearLayout { return false; if(currentAnimator != null) currentAnimator.cancel(); - if(bubble.getVisibility() == INVISIBLE) - showBubble(); + if(bubble.getVisibility() == INVISIBLE) { + if(visibleBubble) { + showBubble(); + } + } else if(!visibleBubble) { + hideBubble(); + } handle.setSelected(true); case MotionEvent.ACTION_MOVE: final float y = event.getY(); @@ -139,9 +145,14 @@ public class FastScroller extends LinearLayout { try { String bubbleText = ((BubbleTextGetter) recyclerView.getAdapter()).getTextToShowInBubble(targetPos); - bubble.setText(bubbleText); + if(bubbleText == null) { + visibleBubble = false; + bubble.setVisibility(View.INVISIBLE); + } else { + bubble.setText(bubbleText); + visibleBubble = true; + } } catch(Exception e) { - Log.e(TAG, "Item count: " + itemCount); Log.e(TAG, "Error getting text for bubble", e); } } @@ -160,7 +171,6 @@ public class FastScroller extends LinearLayout { } private void showBubble() { - AnimatorSet animatorSet = new AnimatorSet(); bubble.setVisibility(VISIBLE); if(currentAnimator != null) currentAnimator.cancel(); |