Created
June 9, 2020 12:13
-
-
Save franciscofranco/fe32f2d244005dae66c576e85b7903fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { | |
@Override | |
public void onStateChanged(@NonNull View bottomSheet, int newState) { | |
if (newState == BottomSheetBehavior.STATE_EXPANDED) { | |
// do stuff when the drawer is expanded | |
} | |
if (newState == BottomSheetBehavior.STATE_COLLAPSED) { | |
// do stuff when the drawer is collapsed | |
} | |
} | |
@Override | |
public void onSlide(@NonNull View bottomSheet, float slideOffset) { | |
// do stuff during the actual drag event for example | |
// animating a background color change based on the offset | |
// or for example hidding or showing a fab | |
if (slideOffset > 0.2) { | |
if (fab.isShown()) { | |
fab.hide(); | |
} | |
} else if (slideOffset < 0.15) { | |
if (!fab.isShown()) { | |
fab.show(); | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment