summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-02-21 21:57:47 +0100
committerByteHamster <info@bytehamster.com>2022-02-21 22:49:57 +0100
commit372db47f47d595deaffe0fd86b5f9dd1629f23b8 (patch)
tree47d51692345401f3e7e9ebc388572a02999cee7f /app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java
parent371faf7dfb55d7b233523184dc69e88789ecdc5b (diff)
downloadAntennaPod-372db47f47d595deaffe0fd86b5f9dd1629f23b8.zip
Make it easier to play only audio, not video
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java18
1 files changed, 8 insertions, 10 deletions
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 4ff2a5775..954a6c2f6 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java
@@ -91,6 +91,7 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
private PlaybackController controller;
private boolean showTimeLeft = false;
private boolean isFavorite = false;
+ private boolean switchToAudioOnly = false;
private Disposable disposable;
private float prog;
@@ -119,6 +120,7 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
protected void onResume() {
super.onResume();
StorageUtils.checkStorageAvailability(this);
+ switchToAudioOnly = false;
if (PlaybackService.isCasting()) {
Intent intent = PlaybackService.getPlayerActivityIntent(this);
if (!intent.getComponent().getClassName().equals(VideoplayerActivity.class.getName())) {
@@ -149,8 +151,7 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
@Override
public void onUserLeaveHint() {
- if (!PictureInPictureUtil.isInPictureInPictureMode(this) && UserPreferences.getVideoBackgroundBehavior()
- == UserPreferences.VideoBackgroundBehavior.PICTURE_IN_PICTURE) {
+ if (!PictureInPictureUtil.isInPictureInPictureMode(this)) {
compatEnterPictureInPicture();
}
}
@@ -480,9 +481,7 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "Videosurface was destroyed");
videoSurfaceCreated = false;
- if (controller != null && !destroyingDueToReload
- && UserPreferences.getVideoBackgroundBehavior()
- != UserPreferences.VideoBackgroundBehavior.CONTINUE_PLAYING) {
+ if (controller != null && !destroyingDueToReload && !switchToAudioOnly) {
controller.notifyVideoSurfaceAbandoned();
}
}
@@ -590,17 +589,16 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
menu.findItem(R.id.set_sleeptimer_item).setVisible(!controller.sleepTimerActive());
menu.findItem(R.id.disable_sleeptimer_item).setVisible(controller.sleepTimerActive());
- if (PictureInPictureUtil.supportsPictureInPicture(this)) {
- menu.findItem(R.id.player_go_to_picture_in_picture).setVisible(true);
- }
+ menu.findItem(R.id.player_switch_to_audio_only).setVisible(true);
menu.findItem(R.id.audio_controls).setIcon(R.drawable.ic_sliders);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- if (item.getItemId() == R.id.player_go_to_picture_in_picture) {
- compatEnterPictureInPicture();
+ if (item.getItemId() == R.id.player_switch_to_audio_only) {
+ switchToAudioOnly = true;
+ finish();
return true;
}
if (item.getItemId() == android.R.id.home) {