Merge pull request #4476 from vkay94/two-finger-to-close-player

Two finger to close player gesture
This commit is contained in:
Stypox 2020-10-11 14:51:45 +02:00 committed by GitHub
commit ae33c6cf18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -42,6 +42,14 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior<FrameLayout>
return false; return false;
} }
// The interception listens for the child view with the id "fragment_player_holder",
// so the following two-finger gesture will be triggered only for the player view on
// portrait and for the top controls (visible) on landscape.
setSkipCollapsed(event.getPointerCount() == 2);
if (event.getPointerCount() == 2) {
return super.onInterceptTouchEvent(parent, child, event);
}
// Don't need to do anything if bottomSheet isn't expanded // Don't need to do anything if bottomSheet isn't expanded
if (getState() == BottomSheetBehavior.STATE_EXPANDED if (getState() == BottomSheetBehavior.STATE_EXPANDED
&& event.getAction() == MotionEvent.ACTION_DOWN) { && event.getAction() == MotionEvent.ACTION_DOWN) {