Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
  2. @Override
  3. public void onStateChanged(@NonNull View bottomSheet, int newState) {
  4. if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
  5. if (negativeClosing) {
  6. negativeClosing = false;
  7. negativeClose();
  8. } else if (bottomSheetBehavior.getState() == STATE_EXPANDED) {
  9. if (!isReadyToClose && activity != null) {
  10. activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
  11. isReadyToClose = true;
  12. }
  13. }
  14. }
  15. }
  16.  
  17. @Override
  18. public void onSlide(@NonNull View bottomSheet, float slideOffset) {
  19. if (slideOffset == 0.0f) {
  20. negativeClose();
  21. }
  22. if (!isReadyToClose && activity != null) {
  23. activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
  24. isReadyToClose = true;
  25. }
  26. }
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement