Bottom Sheet Behavior callback when collapsed for more than half of the height and when expanded more than half of the height

I have a bottom sheet behavior and an bottom navigation view whose visibility has to be set View.Visible when the bottom sheet is getting expanded more than half and change the visibility to View.Gone when bottom sheet is getting collapsed more than half. Right now I have the state of completely expanded and completely collapsed.

The sheet behavior is like this –

private BottomSheetBehavior.BottomSheetCallback bottomSheetBehavior = new BottomSheetBehavior.BottomSheetCallback() {         @Override         public void onStateChanged(@NonNull View bottomSheet, int newState) {             switch (newState) {                 case BottomSheetBehavior.STATE_COLLAPSED:                     if (getBaseActivity() instanceof HomeActivity) {                         ((HomeActivity) getBaseActivity()).turnOffBottomNavigation(false);                     }                     break;                  case BottomSheetBehavior.STATE_EXPANDED:                     if (getBaseActivity() instanceof HomeActivity) {                         ((HomeActivity) getBaseActivity()).turnOffBottomNavigation(true);                     }                     break;             }         }          @Override         public void onSlide(@NonNull View bottomSheet, float slideOffset) {         }     }; 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.