summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorH. Lehmann <ByteHamster@users.noreply.github.com>2019-05-17 15:23:41 +0200
committerGitHub <noreply@github.com>2019-05-17 15:23:41 +0200
commit1a327a2aaea8534c6a9afcfc476965867e8e9b08 (patch)
tree19228d99dae0050e1b63d3ec6baf5ba66244a4e4 /app
parentb28134e3973519468c3dd46575706c770c08cf15 (diff)
parentb47f6e8f3c67adceeefd25ae8eef68367415c155 (diff)
downloadAntennaPod-1a327a2aaea8534c6a9afcfc476965867e8e9b08.zip
Merge pull request #3188 from ByteHamster/revert-playbackservice-changes
Revert playbackservice changes
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java33
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java10
2 files changed, 14 insertions, 29 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 fa5012b74..78cc15b2c 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java
@@ -47,7 +47,6 @@ public class VideoplayerActivity extends MediaplayerActivity {
*/
private boolean videoControlsShowing = true;
private boolean videoSurfaceCreated = false;
- private boolean playbackStoppedUponExitVideo = false;
private boolean destroyingDueToReload = false;
private VideoControlsHider videoControlsHider = new VideoControlsHider(this);
@@ -78,7 +77,6 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
protected void onResume() {
super.onResume();
- playbackStoppedUponExitVideo = false;
if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) {
playExternalMedia(getIntent(), MediaType.VIDEO);
} else if (PlaybackService.isCasting()) {
@@ -93,32 +91,12 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
protected void onStop() {
- stopPlaybackIfUserPreferencesSpecified(); // MUST be called before super.onStop(), while it still has member variable controller
super.onStop();
if (!PictureInPictureUtil.isInPictureInPictureMode(this)) {
videoControlsHider.stop();
}
}
- void stopPlaybackIfUserPreferencesSpecified() {
- // to avoid the method being called twice during leaving Videoplayer
- // , which will double-pause the media
- // (it is usually first called by surfaceHolderCallback.surfaceDestroyed(),
- // then VideoplayerActivity.onStop() , but sometimes VideoplayerActivity.onStop()
- // will first be invoked.)
- if (playbackStoppedUponExitVideo) {
- return;
- }
- playbackStoppedUponExitVideo = true;
-
- if (controller != null && !destroyingDueToReload
- && UserPreferences.getVideoBackgroundBehavior()
- != UserPreferences.VideoBackgroundBehavior.CONTINUE_PLAYING) {
- Log.v(TAG, "stop video playback per UserPreference");
- controller.notifyVideoSurfaceAbandoned();
- }
- }
-
@Override
public void onUserLeaveHint () {
if (!PictureInPictureUtil.isInPictureInPictureMode(this) && UserPreferences.getVideoBackgroundBehavior()
@@ -297,12 +275,13 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
- Log.d(TAG, "Videosurface was destroyed." );
- Log.v(TAG, " hasController=" + (controller != null)
- + " , destroyingDueToReload=" + destroyingDueToReload
- + " , videoBackgroundBehavior=" + UserPreferences.getVideoBackgroundBehavior());
+ Log.d(TAG, "Videosurface was destroyed");
videoSurfaceCreated = false;
- stopPlaybackIfUserPreferencesSpecified();
+ if (controller != null && !destroyingDueToReload
+ && UserPreferences.getVideoBackgroundBehavior()
+ != UserPreferences.VideoBackgroundBehavior.CONTINUE_PLAYING) {
+ controller.notifyVideoSurfaceAbandoned();
+ }
}
};
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java
index f54b9266e..1286d9dc7 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java
@@ -1,6 +1,8 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
+import android.support.annotation.NonNull;
+import android.content.Intent;
import android.widget.Toast;
import com.afollestad.materialdialogs.MaterialDialog;
@@ -28,7 +30,7 @@ import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
*/
public class DefaultActionButtonCallback implements ActionButtonCallback {
- private static final String TAG = "DefaultActionBtnCb";
+ private static final String TAG = "DefaultActionButtonCallback";
private final Context context;
@@ -82,9 +84,13 @@ public class DefaultActionButtonCallback implements ActionButtonCallback {
}
} else { // media is downloaded
if (media.isCurrentlyPlaying()) {
+ new PlaybackServiceStarter(context, media)
+ .startWhenPrepared(true)
+ .shouldStream(false)
+ .start();
IntentUtils.sendLocalBroadcast(context, PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE);
} else if (media.isCurrentlyPaused()) {
- new PlaybackServiceStarter(context, media) // need to start the service in case it's been stopped by system.
+ new PlaybackServiceStarter(context, media)
.startWhenPrepared(true)
.shouldStream(false)
.start();