Restart activities on layout change rather than kill them
This commit is contained in:
parent
cd847f4a93
commit
aaec10014a
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
package org.kreed.vanilla;
|
package org.kreed.vanilla;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -74,6 +75,11 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
private boolean mSeekBarTracking;
|
private boolean mSeekBarTracking;
|
||||||
private boolean mPaused;
|
private boolean mPaused;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current display mode, which determines layout and cover render style.
|
||||||
|
*/
|
||||||
|
private int mDisplayMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached StringBuilder for formatting track position.
|
* Cached StringBuilder for formatting track position.
|
||||||
*/
|
*/
|
||||||
@ -87,6 +93,7 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
SharedPreferences settings = PlaybackService.getSettings(this);
|
SharedPreferences settings = PlaybackService.getSettings(this);
|
||||||
int displayMode = Integer.parseInt(settings.getString("display_mode", "0"));
|
int displayMode = Integer.parseInt(settings.getString("display_mode", "0"));
|
||||||
boolean hiddenControls = settings.getBoolean("hidden_controls", false);
|
boolean hiddenControls = settings.getBoolean("hidden_controls", false);
|
||||||
|
mDisplayMode = displayMode;
|
||||||
|
|
||||||
int layout = R.layout.full_playback;
|
int layout = R.layout.full_playback;
|
||||||
int coverStyle;
|
int coverStyle;
|
||||||
@ -144,6 +151,18 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
setDuration(0);
|
setDuration(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart()
|
||||||
|
{
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
SharedPreferences settings = PlaybackService.getSettings(this);
|
||||||
|
if (mDisplayMode != Integer.parseInt(settings.getString("display_mode", "0"))) {
|
||||||
|
finish();
|
||||||
|
startActivity(new Intent(this, FullPlaybackActivity.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
|
@ -178,6 +178,10 @@ public class LibraryActivity extends PlaybackActivity implements AdapterView.OnI
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
SharedPreferences settings = PlaybackService.getSettings(this);
|
SharedPreferences settings = PlaybackService.getSettings(this);
|
||||||
|
if (settings.getBoolean("controls_in_selector", false) != (mControls != null)) {
|
||||||
|
finish();
|
||||||
|
startActivity(new Intent(this, LibraryActivity.class));
|
||||||
|
}
|
||||||
mDefaultAction = Integer.parseInt(settings.getString("default_action_int", "0"));
|
mDefaultAction = Integer.parseInt(settings.getString("default_action_int", "0"));
|
||||||
mLastActedId = -2;
|
mLastActedId = -2;
|
||||||
updateHeaders();
|
updateHeaders();
|
||||||
|
@ -393,18 +393,6 @@ public final class PlaybackService extends Service implements Handler.Callback,
|
|||||||
userActionTriggered();
|
userActionTriggered();
|
||||||
} else if ("disable_cover_art".equals(key)) {
|
} else if ("disable_cover_art".equals(key)) {
|
||||||
Song.mDisableCoverArt = settings.getBoolean("disable_cover_art", false);
|
Song.mDisableCoverArt = settings.getBoolean("disable_cover_art", false);
|
||||||
} else if ("display_mode".equals(key)) {
|
|
||||||
ArrayList<PlaybackActivity> activities = sActivities;
|
|
||||||
for (PlaybackActivity activity : activities) {
|
|
||||||
if (activity instanceof FullPlaybackActivity)
|
|
||||||
activity.finish();
|
|
||||||
}
|
|
||||||
} else if ("controls_in_selector".equals(key)) {
|
|
||||||
ArrayList<PlaybackActivity> activities = sActivities;
|
|
||||||
for (PlaybackActivity activity : activities) {
|
|
||||||
if (activity instanceof LibraryActivity)
|
|
||||||
activity.finish();
|
|
||||||
}
|
|
||||||
} else if ("notification_inverted_color".equals(key)) {
|
} else if ("notification_inverted_color".equals(key)) {
|
||||||
updateNotification();
|
updateNotification();
|
||||||
} else if ("headset_only".equals(key)) {
|
} else if ("headset_only".equals(key)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user