Merge pull request #3424 from ByteHamster/preferences-apply
Calling apply() on preferences edit
This commit is contained in:
commit
ee02dc40fc
|
@ -240,7 +240,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
||||||
|
|
||||||
SharedPreferences.Editor edit = prefs.edit();
|
SharedPreferences.Editor edit = prefs.edit();
|
||||||
edit.putBoolean(PREF_IS_FIRST_LAUNCH, false);
|
edit.putBoolean(PREF_IS_FIRST_LAUNCH, false);
|
||||||
edit.commit();
|
edit.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ public abstract class EpisodesListFragment extends Fragment {
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
editor.putInt(PREF_SCROLL_POSITION, firstItem);
|
editor.putInt(PREF_SCROLL_POSITION, firstItem);
|
||||||
editor.putFloat(PREF_SCROLL_OFFSET, topOffset);
|
editor.putFloat(PREF_SCROLL_OFFSET, topOffset);
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreScrollPosition() {
|
private void restoreScrollPosition() {
|
||||||
|
@ -162,7 +162,7 @@ public abstract class EpisodesListFragment extends Fragment {
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
editor.putInt(PREF_SCROLL_POSITION, 0);
|
editor.putInt(PREF_SCROLL_POSITION, 0);
|
||||||
editor.putFloat(PREF_SCROLL_OFFSET, 0.0f);
|
editor.putFloat(PREF_SCROLL_OFFSET, 0.0f);
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ public class QueueFragment extends Fragment {
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
editor.putInt(PREF_SCROLL_POSITION, firstItem);
|
editor.putInt(PREF_SCROLL_POSITION, firstItem);
|
||||||
editor.putFloat(PREF_SCROLL_OFFSET, topOffset);
|
editor.putFloat(PREF_SCROLL_OFFSET, topOffset);
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreScrollPosition() {
|
private void restoreScrollPosition() {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class SPAUtil {
|
||||||
|
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
editor.putBoolean(PREF_HAS_QUERIED_SP_APPS, true);
|
editor.putBoolean(PREF_HAS_QUERIED_SP_APPS, true);
|
||||||
editor.commit();
|
editor.apply();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,7 +63,7 @@ public class SPAUtil {
|
||||||
SharedPreferences.Editor editor = PreferenceManager
|
SharedPreferences.Editor editor = PreferenceManager
|
||||||
.getDefaultSharedPreferences(c.getApplicationContext()).edit();
|
.getDefaultSharedPreferences(c.getApplicationContext()).edit();
|
||||||
editor.putBoolean(PREF_HAS_QUERIED_SP_APPS, false);
|
editor.putBoolean(PREF_HAS_QUERIED_SP_APPS, false);
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1086,7 +1086,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
editor.putInt(
|
editor.putInt(
|
||||||
PlaybackPreferences.PREF_CURRENT_PLAYER_STATUS, playerStatus);
|
PlaybackPreferences.PREF_CURRENT_PLAYER_STATUS, playerStatus);
|
||||||
|
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writePlayerStatusPlaybackPreferences() {
|
private void writePlayerStatusPlaybackPreferences() {
|
||||||
|
@ -1095,11 +1095,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
SharedPreferences.Editor editor = PreferenceManager
|
SharedPreferences.Editor editor = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getApplicationContext()).edit();
|
.getDefaultSharedPreferences(getApplicationContext()).edit();
|
||||||
int playerStatus = getCurrentPlayerStatusAsInt(mediaPlayer.getPlayerStatus());
|
int playerStatus = getCurrentPlayerStatusAsInt(mediaPlayer.getPlayerStatus());
|
||||||
|
editor.putInt(PlaybackPreferences.PREF_CURRENT_PLAYER_STATUS, playerStatus);
|
||||||
editor.putInt(
|
editor.apply();
|
||||||
PlaybackPreferences.PREF_CURRENT_PLAYER_STATUS, playerStatus);
|
|
||||||
|
|
||||||
editor.commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendNotificationBroadcast(int type, int code) {
|
private void sendNotificationBroadcast(int type, int code) {
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class ExternalMedia implements Playable {
|
||||||
editor.putLong(PREF_LAST_PLAYED_TIME, timestamp);
|
editor.putLong(PREF_LAST_PLAYED_TIME, timestamp);
|
||||||
position = newPosition;
|
position = newPosition;
|
||||||
lastPlayedTime = timestamp;
|
lastPlayedTime = timestamp;
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue