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
|
// Getters
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1171,6 +1189,13 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||||
", e2.getRaw = [" + movingEvent.getRawX() + ", " + movingEvent.getRawY() + "]" +
|
", e2.getRaw = [" + movingEvent.getRawX() + ", " + movingEvent.getRawY() + "]" +
|
||||||
", distanceXy = [" + distanceX + ", " + distanceY + "]");
|
", 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;
|
final boolean insideThreshold = Math.abs(movingEvent.getY() - initialEvent.getY()) <= MOVEMENT_THRESHOLD;
|
||||||
if (!isMoving && (insideThreshold || Math.abs(distanceX) > Math.abs(distanceY))
|
if (!isMoving && (insideThreshold || Math.abs(distanceX) > Math.abs(distanceY))
|
||||||
|| playerImpl.getCurrentState() == BasePlayer.STATE_COMPLETED) {
|
|| playerImpl.getCurrentState() == BasePlayer.STATE_COMPLETED) {
|
||||||
|
|
Loading…
Reference in New Issue