apply instead of commit

This commit is contained in:
Milos Kozak 2021-02-19 16:17:50 +01:00
parent aeb4de66dd
commit bd0758b846
5 changed files with 5 additions and 5 deletions

View file

@ -532,7 +532,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = sharedPreferences.edit(); SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("wearcontrol", wearcontrol); editor.putBoolean("wearcontrol", wearcontrol);
editor.commit(); editor.apply();
} }
} else if (path.equals(NEW_CHANGECONFIRMATIONREQUEST_PATH)) { } else if (path.equals(NEW_CHANGECONFIRMATIONREQUEST_PATH)) {
String title = DataMapItem.fromDataItem(event.getDataItem()).getDataMap().getString("title"); String title = DataMapItem.fromDataItem(event.getDataItem()).getDataMap().getString("title");

View file

@ -193,7 +193,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
private void changeChartTimeframe() { private void changeChartTimeframe() {
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
timeframe = (timeframe%5) + 1; timeframe = (timeframe%5) + 1;
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).apply();
} }
protected void onWatchModeChanged(WatchMode watchMode) { protected void onWatchModeChanged(WatchMode watchMode) {

View file

@ -55,7 +55,7 @@ public class Home extends BaseWatchFace {
private void changeChartTimeframe() { private void changeChartTimeframe() {
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
timeframe = (timeframe%5) + 1; timeframe = (timeframe%5) + 1;
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).apply();
} }
@Override @Override

View file

@ -56,7 +56,7 @@ public class Home2 extends BaseWatchFace {
private void changeChartTimeframe() { private void changeChartTimeframe() {
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
timeframe = (timeframe%5) + 1; timeframe = (timeframe%5) + 1;
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).apply();
} }
@Override @Override

View file

@ -264,6 +264,6 @@ public class Steampunk extends BaseWatchFace {
pointSize = 1; pointSize = 1;
} }
setupCharts(); setupCharts();
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).apply();
} }
} }