Merge pull request #3337 from AioiLight/blocking-gesture-when-touch-from-navbar
Block the gesture when touch it from NavigationBar or StatusBar.
This commit is contained in:
commit
b3eadb557b
1 changed files with 23 additions and 0 deletions
|
@ -1325,6 +1325,13 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||
return false;
|
||||
}
|
||||
|
||||
final boolean isTouchingStatusBar = initialEvent.getY() < getStatusBarHeight();
|
||||
final boolean isTouchingNavigationBar = initialEvent.getY()
|
||||
> playerImpl.getRootView().getHeight() - getNavigationBarHeight();
|
||||
if (isTouchingStatusBar || isTouchingNavigationBar) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (DEBUG) {
|
||||
// Log.d(TAG, "MainVideoPlayer.onScroll = " +
|
||||
// "e1.getRaw = [" + initialEvent.getRawX() + ", "
|
||||
|
@ -1413,6 +1420,22 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private void onScrollEnd() {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onScrollEnd() called");
|
||||
|
|
Loading…
Reference in a new issue