@@ -76,10 +76,11 @@ public abstract class MaterialScrollBar<T> extends RelativeLayout {
76
76
int handleOffColor = Color .parseColor ("#9c9c9c" );
77
77
protected boolean hidden = true ;
78
78
private int textColor = ContextCompat .getColor (getContext (), android .R .color .white );
79
- boolean lightOnTouch ;
79
+ private boolean lightOnTouch ;
80
80
private TypedArray a ; //XML attributes
81
81
private Boolean rtl = false ;
82
82
boolean hiddenByUser = false ;
83
+ private boolean hiddenByNotEnoughElements = false ;
83
84
private float fastScrollSnapPercent = 0 ;
84
85
85
86
//Associated Objects
@@ -294,14 +295,12 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
294
295
295
296
if (!isInEditMode ()) {
296
297
scrollUtils .scrollHandleAndIndicator ();
297
- if (scrollUtils .getAvailableScrollHeight () <= 0 ) {
298
+ if (hiddenByNotEnoughElements = ( scrollUtils .getAvailableScrollHeight () <= 0 ) ) {
298
299
handleTrack .setVisibility (GONE );
299
300
handleThumb .setVisibility (GONE );
300
- if (indicator != null ) indicator .setVisibility (GONE );
301
301
} else {
302
302
handleTrack .setVisibility (VISIBLE );
303
303
handleThumb .setVisibility (VISIBLE );
304
- if (indicator != null ) indicator .setVisibility (VISIBLE );
305
304
}
306
305
}
307
306
}
@@ -718,7 +717,7 @@ void fadeIn() {
718
717
}
719
718
720
719
protected void onDown (MotionEvent event ) {
721
- if (indicator != null && indicator .getVisibility () == INVISIBLE && recyclerView .getAdapter () != null ) {
720
+ if (indicator != null && indicator .getVisibility () == INVISIBLE && recyclerView .getAdapter () != null && ! hiddenByNotEnoughElements ) {
722
721
indicator .setVisibility (VISIBLE );
723
722
indicator .setAlpha (0F );
724
723
indicator .animate ().alpha (1F ).setDuration (150 ).setListener (new AnimatorListenerAdapter () {
0 commit comments