mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Skipping interception of some gestures
This commit is contained in:
		| @@ -68,6 +68,14 @@ public final class FlingBehavior extends AppBarLayout.Behavior { | |||||||
|                 return false; |                 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; |         allowScroll = true; | ||||||
|         switch (ev.getActionMasked()) { |         switch (ev.getActionMasked()) { | ||||||
|             case MotionEvent.ACTION_DOWN: |             case MotionEvent.ACTION_DOWN: | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import android.content.Context; | |||||||
| import android.graphics.Rect; | import android.graphics.Rect; | ||||||
| import android.util.AttributeSet; | import android.util.AttributeSet; | ||||||
| import android.view.MotionEvent; | import android.view.MotionEvent; | ||||||
|  | import android.view.View; | ||||||
| import android.view.ViewGroup; | import android.view.ViewGroup; | ||||||
| import android.widget.FrameLayout; | import android.widget.FrameLayout; | ||||||
| import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||||
| @@ -25,7 +26,7 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior<FrameLayout> | |||||||
|     private boolean skippingInterception = false; |     private boolean skippingInterception = false; | ||||||
|     private final List<Integer> skipInterceptionOfElements = Arrays.asList( |     private final List<Integer> skipInterceptionOfElements = Arrays.asList( | ||||||
|             R.id.detail_content_root_layout, R.id.relatedStreamsLayout, |             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 |     @Override | ||||||
|     public boolean onInterceptTouchEvent(@NonNull final CoordinatorLayout parent, |     public boolean onInterceptTouchEvent(@NonNull final CoordinatorLayout parent, | ||||||
| @@ -51,6 +52,13 @@ public class CustomBottomSheetBehavior extends BottomSheetBehavior<FrameLayout> | |||||||
|                     visible = viewGroup.getGlobalVisibleRect(globalRect); |                     visible = viewGroup.getGlobalVisibleRect(globalRect); | ||||||
|                     if (visible |                     if (visible | ||||||
|                             && globalRect.contains((int) event.getRawX(), (int) event.getRawY())) { |                             && 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; |                         skippingInterception = true; | ||||||
|                         return false; |                         return false; | ||||||
|                     } |                     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Avently
					Avently