diff options
author | Domingos Lopes <domingos86lopes+github@gmail.com> | 2016-04-28 11:09:34 -0400 |
---|---|---|
committer | Domingos Lopes <domingos86lopes+github@gmail.com> | 2016-04-28 11:09:34 -0400 |
commit | 358ad6484ab4b7977c40d9dca4e8ac63ceebe6e1 (patch) | |
tree | 9b0212f6b979f851ebeeecb95065a24c6464cc6e /app/src/main/java/de/danoeh/antennapod/activity | |
parent | f8266d0181f09a21649e9636453d62fd3002860e (diff) | |
download | AntennaPod-358ad6484ab4b7977c40d9dca4e8ac63ceebe6e1.zip |
save current fragment before starting a different activity
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/activity')
4 files changed, 9 insertions, 1 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java index 443ce99f6..ca214de9e 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/AudioplayerActivity.java @@ -41,6 +41,8 @@ public class AudioplayerActivity extends MediaplayerInfoActivity { } else if (PlaybackService.isCasting()) { Intent intent = PlaybackService.getPlayerActivityIntent(this); if (!intent.getComponent().getClassName().equals(AudioplayerActivity.class.getName())) { + saveCurrentFragment(); + finish(); startActivity(intent); } } @@ -50,6 +52,7 @@ public class AudioplayerActivity extends MediaplayerInfoActivity { protected void onReloadNotification(int notificationCode) { if (notificationCode == PlaybackService.EXTRA_CODE_CAST) { Log.d(TAG, "ReloadNotification received, switching to Castplayer now"); + saveCurrentFragment(); finish(); startActivity(new Intent(this, CastplayerActivity.class)); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/CastplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/CastplayerActivity.java index 69fe824da..1ca4d095f 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/CastplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/CastplayerActivity.java @@ -23,6 +23,7 @@ public class CastplayerActivity extends MediaplayerInfoActivity { if (!PlaybackService.isCasting()) { Intent intent = PlaybackService.getPlayerActivityIntent(this); if (!intent.getComponent().getClassName().equals(CastplayerActivity.class.getName())) { + finish(); startActivity(intent); } } @@ -32,6 +33,7 @@ public class CastplayerActivity extends MediaplayerInfoActivity { protected void onReloadNotification(int notificationCode) { if (notificationCode == PlaybackService.EXTRA_CODE_AUDIO) { Log.d(TAG, "ReloadNotification received, switching to Audioplayer now"); + saveCurrentFragment(); finish(); startActivity(new Intent(this, AudioplayerActivity.class)); } else { @@ -59,6 +61,8 @@ public class CastplayerActivity extends MediaplayerInfoActivity { if (!PlaybackService.isCasting()) { Intent intent = PlaybackService.getPlayerActivityIntent(this); if (!intent.getComponent().getClassName().equals(CastplayerActivity.class.getName())) { + saveCurrentFragment(); + finish(); startActivity(intent); } } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java index 0e39aa5c3..e966b8cce 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java @@ -134,7 +134,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem setTheme(UserPreferences.getNoTitleTheme()); } - private void saveCurrentFragment() { + protected void saveCurrentFragment() { if(pager == null) { return; } 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 fa3d8e68d..a52382dea 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -86,6 +86,7 @@ public class VideoplayerActivity extends MediaplayerActivity { } else if (PlaybackService.isCasting()) { Intent intent = PlaybackService.getPlayerActivityIntent(this); if (!intent.getComponent().getClassName().equals(VideoplayerActivity.class.getName())) { + finish(); startActivity(intent); } } |