save current fragment before starting a different activity
This commit is contained in:
parent
f8266d0181
commit
358ad6484a
|
@ -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));
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
setTheme(UserPreferences.getNoTitleTheme());
|
||||
}
|
||||
|
||||
private void saveCurrentFragment() {
|
||||
protected void saveCurrentFragment() {
|
||||
if(pager == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue