mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-25 01:20:34 +00:00
Block the gesture when touch it from NavigationBar or StatusBar.
This commit is contained in:
parent
da2b059802
commit
d9c6f7acb6
@ -1061,6 +1061,24 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||
};
|
||||
}
|
||||
|
||||
private int getNavigationBarHeight()
|
||||
{
|
||||
int resId = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (resId > 0) {
|
||||
return getResources().getDimensionPixelSize(resId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int getStatusBarHeight()
|
||||
{
|
||||
int resId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resId > 0) {
|
||||
return getResources().getDimensionPixelSize(resId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -1171,6 +1189,13 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||
", e2.getRaw = [" + movingEvent.getRawX() + ", " + movingEvent.getRawY() + "]" +
|
||||
", distanceXy = [" + distanceX + ", " + distanceY + "]");
|
||||
|
||||
final boolean isTouchingStatusBar = initialEvent.getY() < playerImpl.getStatusBarHeight();
|
||||
final boolean isTouchingNavigationBar = initialEvent.getY() > playerImpl.getRootView().getHeight() - playerImpl.getNavigationBarHeight();
|
||||
if (isTouchingStatusBar || isTouchingNavigationBar)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean insideThreshold = Math.abs(movingEvent.getY() - initialEvent.getY()) <= MOVEMENT_THRESHOLD;
|
||||
if (!isMoving && (insideThreshold || Math.abs(distanceX) > Math.abs(distanceY))
|
||||
|| playerImpl.getCurrentState() == BasePlayer.STATE_COMPLETED) {
|
||||
|
Loading…
Reference in New Issue
Block a user