Clean up code

Follow Checkstyle

Move to PlayerGestureListener from VideoPlayerImpl

Update app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java

Co-authored-by: wb9688 <46277131+wb9688@users.noreply.github.com>
This commit is contained in:
AioiLight 2020-04-05 00:47:45 +09:00 committed by wb9688
parent 562754c0b9
commit 0abd2bcba6
1 changed files with 20 additions and 22 deletions

View File

@ -1125,24 +1125,6 @@ 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
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -1263,10 +1245,10 @@ public final class MainVideoPlayer extends AppCompatActivity
return false; return false;
} }
final boolean isTouchingStatusBar = initialEvent.getY() < playerImpl.getStatusBarHeight(); final boolean isTouchingStatusBar = initialEvent.getY() < getStatusBarHeight();
final boolean isTouchingNavigationBar = initialEvent.getY() > playerImpl.getRootView().getHeight() - playerImpl.getNavigationBarHeight(); final boolean isTouchingNavigationBar = initialEvent.getY()
if (isTouchingStatusBar || isTouchingNavigationBar) > playerImpl.getRootView().getHeight() - getNavigationBarHeight();
{ if (isTouchingStatusBar || isTouchingNavigationBar) {
return false; return false;
} }
@ -1358,6 +1340,22 @@ public final class MainVideoPlayer extends AppCompatActivity
return true; 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() { private void onScrollEnd() {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "onScrollEnd() called"); Log.d(TAG, "onScrollEnd() called");