From 33ad1a91f0c125bb999642167a931f9a05b3384b Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 14 May 2021 21:44:59 +0200 Subject: Remove unneccessary method call chaining --- .../antennapod/activity/VideoplayerActivity.java | 60 ++++++---------------- 1 file changed, 17 insertions(+), 43 deletions(-) (limited to 'app/src/main/java/de') diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index dc4345c21..4572cf1c4 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -230,12 +230,12 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. @Override public void onBufferStart() { - VideoplayerActivity.this.onBufferStart(); + progressIndicator.setVisibility(View.VISIBLE); } @Override public void onBufferEnd() { - VideoplayerActivity.this.onBufferEnd(); + progressIndicator.setVisibility(View.INVISIBLE); } @Override @@ -247,7 +247,11 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. @Override public void handleError(int code) { - VideoplayerActivity.this.handleError(code); + final AlertDialog.Builder errorDialog = new AlertDialog.Builder(VideoplayerActivity.this); + errorDialog.setTitle(R.string.error_label); + errorDialog.setMessage(MediaPlayerError.getErrorString(VideoplayerActivity.this, code)); + errorDialog.setNeutralButton(android.R.string.ok, (dialog, which) -> finish()); + errorDialog.show(); } @Override @@ -272,7 +276,11 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. @Override public void onAwaitingVideoSurface() { - VideoplayerActivity.this.onAwaitingVideoSurface(); + setupVideoAspectRatio(); + if (videoSurfaceCreated && controller != null) { + Log.d(TAG, "Videosurface already created, setting videosurface now"); + controller.setVideoSurface(videoview.getHolder()); + } } @Override @@ -282,8 +290,11 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. @Override protected void setScreenOn(boolean enable) { - super.setScreenOn(enable); - VideoplayerActivity.this.setScreenOn(enable); + if (enable) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } else { + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } } }; } @@ -408,14 +419,6 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. videoview.setAvailableSize(videoframe.getWidth(), videoframe.getHeight())); } - protected void onAwaitingVideoSurface() { - setupVideoAspectRatio(); - if (videoSurfaceCreated && controller != null) { - Log.d(TAG, "Videosurface already created, setting videosurface now"); - controller.setVideoSurface(videoview.getHolder()); - } - } - private final View.OnTouchListener onVideoviewTouched = (v, event) -> { if (event.getAction() == MotionEvent.ACTION_DOWN) { if (PictureInPictureUtil.isInPictureInPictureMode(this)) { @@ -544,19 +547,6 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. setupVideoControlsToggler(); } - private void handleError(int errorCode) { - final AlertDialog.Builder errorDialog = new AlertDialog.Builder(this); - errorDialog.setTitle(R.string.error_label); - errorDialog.setMessage(MediaPlayerError.getErrorString(this, errorCode)); - errorDialog.setNeutralButton("OK", - (dialog, which) -> { - dialog.dismiss(); - finish(); - } - ); - errorDialog.create().show(); - } - private final SurfaceHolder.Callback surfaceHolderCallback = new SurfaceHolder.Callback() { @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, @@ -602,14 +592,6 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. } } - protected void onBufferStart() { - progressIndicator.setVisibility(View.VISIBLE); - } - - protected void onBufferEnd() { - progressIndicator.setVisibility(View.INVISIBLE); - } - @SuppressLint("NewApi") private void showVideoControls() { videoOverlay.setVisibility(View.VISIBLE); @@ -644,14 +626,6 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. hideVideoControls(true); } - private void setScreenOn(boolean enable) { - if (enable) { - getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - } else { - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - } - } - @Subscribe(threadMode = ThreadMode.MAIN) public void onEventMainThread(PlaybackPositionEvent event) { onPositionObserverUpdate(); -- cgit v1.2.3