Merge pull request #3424 from ByteHamster/preferences-apply

Calling apply() on preferences edit
This commit is contained in:
H. Lehmann 2019-09-20 22:06:19 +02:00 committed by GitHub
commit ee02dc40fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 13 deletions

View File

@ -240,7 +240,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean(PREF_IS_FIRST_LAUNCH, false);
edit.commit();
edit.apply();
}
}

View File

@ -149,7 +149,7 @@ public abstract class EpisodesListFragment extends Fragment {
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(PREF_SCROLL_POSITION, firstItem);
editor.putFloat(PREF_SCROLL_OFFSET, topOffset);
editor.commit();
editor.apply();
}
private void restoreScrollPosition() {
@ -162,7 +162,7 @@ public abstract class EpisodesListFragment extends Fragment {
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(PREF_SCROLL_POSITION, 0);
editor.putFloat(PREF_SCROLL_OFFSET, 0.0f);
editor.commit();
editor.apply();
}
}

View File

@ -223,7 +223,7 @@ public class QueueFragment extends Fragment {
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(PREF_SCROLL_POSITION, firstItem);
editor.putFloat(PREF_SCROLL_OFFSET, topOffset);
editor.commit();
editor.apply();
}
private void restoreScrollPosition() {

View File

@ -46,7 +46,7 @@ public class SPAUtil {
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(PREF_HAS_QUERIED_SP_APPS, true);
editor.commit();
editor.apply();
return true;
} else {
@ -63,7 +63,7 @@ public class SPAUtil {
SharedPreferences.Editor editor = PreferenceManager
.getDefaultSharedPreferences(c.getApplicationContext()).edit();
editor.putBoolean(PREF_HAS_QUERIED_SP_APPS, false);
editor.commit();
editor.apply();
}
}
}

View File

@ -1086,7 +1086,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
editor.putInt(
PlaybackPreferences.PREF_CURRENT_PLAYER_STATUS, playerStatus);
editor.commit();
editor.apply();
}
private void writePlayerStatusPlaybackPreferences() {
@ -1095,11 +1095,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
SharedPreferences.Editor editor = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext()).edit();
int playerStatus = getCurrentPlayerStatusAsInt(mediaPlayer.getPlayerStatus());
editor.putInt(
PlaybackPreferences.PREF_CURRENT_PLAYER_STATUS, playerStatus);
editor.commit();
editor.putInt(PlaybackPreferences.PREF_CURRENT_PLAYER_STATUS, playerStatus);
editor.apply();
}
private void sendNotificationBroadcast(int type, int code) {

View File

@ -182,7 +182,7 @@ public class ExternalMedia implements Playable {
editor.putLong(PREF_LAST_PLAYED_TIME, timestamp);
position = newPosition;
lastPlayedTime = timestamp;
editor.commit();
editor.apply();
}
@Override