diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-02-22 19:54:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 19:54:05 +0100 |
commit | 2f3efa5d3383732b52a4d9bf78b1b7502573151f (patch) | |
tree | fc33b53adc1c7e228150680ddc132250a86a6b3b /app/src/main/java/de | |
parent | be9093911ff5aac392e483a61e5aaca38782d723 (diff) | |
parent | 372db47f47d595deaffe0fd86b5f9dd1629f23b8 (diff) | |
download | AntennaPod-2f3efa5d3383732b52a4d9bf78b1b7502573151f.zip |
Merge pull request #5740 from ByteHamster/upon-exiting-video
Make it easier to play only audio, not video
Diffstat (limited to 'app/src/main/java/de')
3 files changed, 8 insertions, 19 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) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java index 7fa2ed4d1..933a7d456 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackPreferencesFragment.java @@ -13,7 +13,6 @@ import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.event.UnreadItemsUpdateEvent; import de.danoeh.antennapod.core.preferences.UsageStatistics; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.util.gui.PictureInPictureUtil; import de.danoeh.antennapod.dialog.SkipPreferenceDialog; import de.danoeh.antennapod.dialog.VariableSpeedDialog; import java.util.Map; @@ -54,11 +53,6 @@ public class PlaybackPreferencesFragment extends PreferenceFragmentCompat { SkipPreferenceDialog.showSkipPreference(activity, SkipPreferenceDialog.SkipDirection.SKIP_FORWARD, null); return true; }); - if (!PictureInPictureUtil.supportsPictureInPicture(activity)) { - ListPreference behaviour = findPreference(UserPreferences.PREF_VIDEO_BEHAVIOR); - behaviour.setEntries(R.array.video_background_behavior_options_without_pip); - behaviour.setEntryValues(R.array.video_background_behavior_values_without_pip); - } findPreference(PREF_PLAYBACK_PREFER_STREAMING).setOnPreferenceChangeListener((preference, newValue) -> { // Update all visible lists to reflect new streaming action button EventBus.getDefault().post(new UnreadItemsUpdateEvent()); diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java index 3a0e4e91f..a2c5ca3ff 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java @@ -90,9 +90,6 @@ public class PreferenceUpgrader { UserPreferences.setEnqueueLocation(enqueueLocation); } } - if (oldVersion < 1080100) { - prefs.edit().putString(UserPreferences.PREF_VIDEO_BEHAVIOR, "pip").apply(); - } if (oldVersion < 2010300) { // Migrate hardware button preferences if (prefs.getBoolean("prefHardwareForwardButtonSkips", false)) { |