Restore happens by itself upon app install
This commit is contained in:
parent
238cac9352
commit
eb756cc657
|
@ -117,27 +117,6 @@ public class MainActivity extends ActionBarActivity {
|
|||
StorageUtils.checkStorageAvailability(this);
|
||||
updateProgressBarVisibility();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
|
||||
// Possibly restore feed subscriptions from backup
|
||||
if (UserPreferences.isFreshInstall()) {
|
||||
new BackupManager(this).requestRestore(new BackupRestoreObserver(this));
|
||||
UserPreferences.setIsFreshInstall(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static class BackupRestoreObserver extends RestoreObserver {
|
||||
private final Context mContext;
|
||||
|
||||
public BackupRestoreObserver(final Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFinished(int error) {
|
||||
if (error == 0) {
|
||||
Toast.makeText(mContext, R.string.backup_restored, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
|
||||
|
|
|
@ -50,7 +50,6 @@ public class UserPreferences implements
|
|||
private static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed";
|
||||
private static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray";
|
||||
public static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss";
|
||||
private static final String PREF_IS_FRESH_INSTALL = "prefIsFreshInstall";
|
||||
|
||||
// TODO: Make this value configurable
|
||||
private static final double PLAYED_DURATION_AUTOFLATTR_THRESHOLD = 0.8;
|
||||
|
@ -132,7 +131,6 @@ public class UserPreferences implements
|
|||
playbackSpeedArray = readPlaybackSpeedArray(sp.getString(
|
||||
PREF_PLAYBACK_SPEED_ARRAY, null));
|
||||
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
|
||||
isFreshInstall = sp.getBoolean(PREF_IS_FRESH_INSTALL, true);
|
||||
}
|
||||
|
||||
private int readThemeValue(String valueFromPrefs) {
|
||||
|
@ -342,8 +340,6 @@ public class UserPreferences implements
|
|||
pauseForFocusLoss = sp.getBoolean(PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS, false);
|
||||
} else if (key.equals(PREF_PAUSE_ON_HEADSET_DISCONNECT)) {
|
||||
pauseOnHeadsetDisconnect = sp.getBoolean(PREF_PAUSE_ON_HEADSET_DISCONNECT, true);
|
||||
} else if (key.equals(PREF_IS_FRESH_INSTALL)) {
|
||||
isFreshInstall = sp.getBoolean(PREF_IS_FRESH_INSTALL, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,11 +532,4 @@ public class UserPreferences implements
|
|||
instanceAvailable();
|
||||
return PLAYED_DURATION_AUTOFLATTR_THRESHOLD;
|
||||
}
|
||||
|
||||
public static void setIsFreshInstall(boolean isFreshInstall) {
|
||||
instanceAvailable();
|
||||
PreferenceManager.getDefaultSharedPreferences(instance.context).edit()
|
||||
.putBoolean(PREF_IS_FRESH_INSTALL, isFreshInstall)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue