Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions lib/java/com/google/android/material/slider/BaseSlider.java
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,9 @@ protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
for (TooltipDrawable label : labels) {
contentViewOverlay.remove(label);
}
thisAndAncestorsVisible = false;
} else {
thisAndAncestorsVisible = true;
}
}

Expand Down Expand Up @@ -2714,19 +2717,7 @@ private void updateLabels() {
private boolean isSliderVisibleOnScreen() {
final Rect contentViewBounds = new Rect();
ViewUtils.getContentView(this).getHitRect(contentViewBounds);
return getLocalVisibleRect(contentViewBounds) && isThisAndAncestorsVisible();
}

private boolean isThisAndAncestorsVisible() {
// onVisibilityAggregated is only available on N+ devices, so on pre-N devices we check if this
// view and its ancestors are visible each time, in case one of the visibilities has changed.
return (VERSION.SDK_INT >= VERSION_CODES.N) ? thisAndAncestorsVisible : isShown();
}

@Override
public void onVisibilityAggregated(boolean isVisible) {
super.onVisibilityAggregated(isVisible);
this.thisAndAncestorsVisible = isVisible;
return getLocalVisibleRect(contentViewBounds) && thisAndAncestorsVisible;
}

private void ensureLabelsRemoved() {
Expand Down