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:
Tobias Groza 2020-05-09 10:43:15 +02:00 committed by GitHub
commit b3eadb557b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -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");