From e3642099bacfebaaa0c0835a9a39dd9c2a521934 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Thu, 11 Jan 2024 11:39:43 +0100 Subject: [PATCH] feat(android): optimize TiProperties (#13944) --- .../org/appcelerator/titanium/TiProperties.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/android/titanium/src/java/org/appcelerator/titanium/TiProperties.java b/android/titanium/src/java/org/appcelerator/titanium/TiProperties.java index 5a749494b34..e1283921d14 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/TiProperties.java +++ b/android/titanium/src/java/org/appcelerator/titanium/TiProperties.java @@ -38,7 +38,7 @@ public TiProperties(Context context, String name, boolean clear) { preferences = context.getSharedPreferences(name, Context.MODE_PRIVATE); if (clear) { - preferences.edit().clear().commit(); + preferences.edit().clear().apply(); } } @@ -103,7 +103,7 @@ public void setString(String key, String value) } else { editor.putString(key, value); } - editor.commit(); + editor.apply(); } /** @@ -160,7 +160,7 @@ public void setInt(String key, int value) SharedPreferences.Editor editor = preferences.edit(); editor.putInt(key, value); - editor.commit(); + editor.apply(); } /** @@ -208,7 +208,7 @@ public void setDouble(String key, double value) SharedPreferences.Editor editor = preferences.edit(); editor.putString(key, value + ""); - editor.commit(); + editor.apply(); } /** @@ -266,7 +266,7 @@ public void setBool(String key, boolean value) SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(key, value); - editor.commit(); + editor.apply(); } /** @@ -311,7 +311,7 @@ public void setList(String key, String[] value) } editor.putInt(key + ".length", value.length); - editor.commit(); + editor.apply(); } /** @@ -377,7 +377,7 @@ public void removeProperty(String key) if (preferences.contains(key)) { SharedPreferences.Editor editor = preferences.edit(); editor.remove(key); - editor.commit(); + editor.apply(); } } @@ -386,7 +386,7 @@ public void removeProperty(String key) */ public void removeAllProperties() { - preferences.edit().clear().commit(); + preferences.edit().clear().apply(); } public static void setSystemProperties(JSONObject prop)