mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-11-19 02:29:25 +01:00
Only apply preferences when they actually changed
This commit is contained in:
parent
c841a6dde1
commit
f0a0369bbe
@ -68,7 +68,9 @@ public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeL
|
||||
}
|
||||
|
||||
public static void setEnabled(Context context, boolean newStatus) {
|
||||
boolean changed = CheckinPrefs.get(context).isEnabled() != newStatus;
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(PREF_ENABLE_CHECKIN, newStatus).commit();
|
||||
if (!changed) return;
|
||||
if (newStatus) {
|
||||
context.sendOrderedBroadcast(new Intent(context, TriggerReceiver.class), null);
|
||||
}
|
||||
|
@ -219,7 +219,9 @@ public class GcmPrefs implements SharedPreferences.OnSharedPreferenceChangeListe
|
||||
}
|
||||
|
||||
public static void setEnabled(Context context, boolean newStatus) {
|
||||
boolean changed = GcmPrefs.get(context).isEnabled() != newStatus;
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(GcmPrefs.PREF_ENABLE_GCM, newStatus).commit();
|
||||
if (!changed) return;
|
||||
if (!newStatus) {
|
||||
McsService.stop(context);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user