From f6925fc5b8bb4536d9d9a146dff1cb3efe828ae0 Mon Sep 17 00:00:00 2001 From: vkay94 Date: Sat, 10 Oct 2020 15:00:39 +0200 Subject: [PATCH 1/2] Added two finger to close player gesture --- .../player/event/CustomBottomSheetBehavior.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/player/event/CustomBottomSheetBehavior.java b/app/src/main/java/org/schabi/newpipe/player/event/CustomBottomSheetBehavior.java index 5405d01c1..4d110f9ba 100644 --- a/app/src/main/java/org/schabi/newpipe/player/event/CustomBottomSheetBehavior.java +++ b/app/src/main/java/org/schabi/newpipe/player/event/CustomBottomSheetBehavior.java @@ -42,6 +42,17 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior 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. + if (event.getPointerCount() == 2) { + // Skip the collapsed state during pulling + setSkipCollapsed(true); + return super.onInterceptTouchEvent(parent, child, event); + } else { + setSkipCollapsed(false); + } + // Don't need to do anything if bottomSheet isn't expanded if (getState() == BottomSheetBehavior.STATE_EXPANDED && event.getAction() == MotionEvent.ACTION_DOWN) { From f8cd6afbf8321ee8ef6248d35764c0fc8f78905f Mon Sep 17 00:00:00 2001 From: vkay94 Date: Sun, 11 Oct 2020 13:56:30 +0200 Subject: [PATCH 2/2] Two finger gesture: Less code lines --- .../newpipe/player/event/CustomBottomSheetBehavior.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/event/CustomBottomSheetBehavior.java b/app/src/main/java/org/schabi/newpipe/player/event/CustomBottomSheetBehavior.java index 4d110f9ba..26ecb1871 100644 --- a/app/src/main/java/org/schabi/newpipe/player/event/CustomBottomSheetBehavior.java +++ b/app/src/main/java/org/schabi/newpipe/player/event/CustomBottomSheetBehavior.java @@ -45,12 +45,9 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior // 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) { - // Skip the collapsed state during pulling - setSkipCollapsed(true); return super.onInterceptTouchEvent(parent, child, event); - } else { - setSkipCollapsed(false); } // Don't need to do anything if bottomSheet isn't expanded