diff --git a/app/src/main/java/com/google/android/material/appbar/FlingBehavior.java b/app/src/main/java/com/google/android/material/appbar/FlingBehavior.java index 174631fde..b5c7fc564 100644 --- a/app/src/main/java/com/google/android/material/appbar/FlingBehavior.java +++ b/app/src/main/java/com/google/android/material/appbar/FlingBehavior.java @@ -68,6 +68,14 @@ public final class FlingBehavior extends AppBarLayout.Behavior { return false; } } + final View seekBar = child.findViewById(R.id.playbackSeekBar); + if (seekBar != null) { + final boolean visible = seekBar.getGlobalVisibleRect(globalRect); + if (visible && globalRect.contains((int) ev.getRawX(), (int) ev.getRawY())) { + allowScroll = false; + return false; + } + } allowScroll = true; switch (ev.getActionMasked()) { case MotionEvent.ACTION_DOWN: 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 1d0b3ae26..19c621221 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 @@ -4,6 +4,7 @@ import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.MotionEvent; +import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import androidx.annotation.NonNull; @@ -25,7 +26,7 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior private boolean skippingInterception = false; private final List skipInterceptionOfElements = Arrays.asList( R.id.detail_content_root_layout, R.id.relatedStreamsLayout, - R.id.playQueuePanel, R.id.viewpager); + R.id.playQueuePanel, R.id.viewpager, R.id.bottomControls); @Override public boolean onInterceptTouchEvent(@NonNull final CoordinatorLayout parent, @@ -51,6 +52,13 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior visible = viewGroup.getGlobalVisibleRect(globalRect); if (visible && globalRect.contains((int) event.getRawX(), (int) event.getRawY())) { + // Makes bottom part of the player draggable in portrait when + // playbackControlRoot is hidden + if (element == R.id.bottomControls + && child.findViewById(R.id.playbackControlRoot) + .getVisibility() != View.VISIBLE) { + return super.onInterceptTouchEvent(parent, child, event); + } skippingInterception = true; return false; }