diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-06-08 14:00:43 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-06-08 14:00:54 -0700 |
commit | 9d887a2c452f652624f0d28950c1b69cb37a8e23 (patch) | |
tree | 635a49f9f9b818f49ee4c69d0c02e9d1addfb3c7 /src/com/android/launcher3/graphics/IconShapeOverride.java | |
parent | 54ba601a99cd8cecc2750e305275c40ac2bfba8b (diff) | |
download | android_packages_apps_Trebuchet-9d887a2c452f652624f0d28950c1b69cb37a8e23.tar.gz android_packages_apps_Trebuchet-9d887a2c452f652624f0d28950c1b69cb37a8e23.tar.bz2 android_packages_apps_Trebuchet-9d887a2c452f652624f0d28950c1b69cb37a8e23.zip |
Adding a utility method for getting device prefs
Change-Id: I1e3c7df0a3f4e847b40d722d44890e441cc73509
Diffstat (limited to 'src/com/android/launcher3/graphics/IconShapeOverride.java')
-rw-r--r-- | src/com/android/launcher3/graphics/IconShapeOverride.java | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/com/android/launcher3/graphics/IconShapeOverride.java b/src/com/android/launcher3/graphics/IconShapeOverride.java index a0727fb4b..e2d1d50e4 100644 --- a/src/com/android/launcher3/graphics/IconShapeOverride.java +++ b/src/com/android/launcher3/graphics/IconShapeOverride.java @@ -15,13 +15,14 @@ */ package com.android.launcher3.graphics; +import static com.android.launcher3.Utilities.getDevicePrefs; + import android.annotation.TargetApi; import android.app.AlarmManager; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Build; import android.os.SystemClock; @@ -34,7 +35,6 @@ import android.text.TextUtils; import android.util.Log; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherFiles; import com.android.launcher3.LauncherModel; import com.android.launcher3.R; import com.android.launcher3.Utilities; @@ -101,7 +101,7 @@ public class IconShapeOverride { } catch (Exception e) { Log.e(TAG, "Unable to override icon shape", e); // revert value. - prefs(context).edit().remove(KEY_PREFERENCE).apply(); + getDevicePrefs(context).edit().remove(KEY_PREFERENCE).apply(); } } @@ -116,11 +116,7 @@ public class IconShapeOverride { } private static String getAppliedValue(Context context) { - return prefs(context).getString(KEY_PREFERENCE, ""); - } - - private static SharedPreferences prefs(Context context) { - return context.getSharedPreferences(LauncherFiles.DEVICE_PREFERENCES_KEY, 0); + return getDevicePrefs(context).getString(KEY_PREFERENCE, ""); } public static void handlePreferenceUi(ListPreference preference) { @@ -189,7 +185,7 @@ public class IconShapeOverride { @Override public void run() { // Synchronously write the preference. - prefs(mContext).edit().putString(KEY_PREFERENCE, mValue).commit(); + getDevicePrefs(mContext).edit().putString(KEY_PREFERENCE, mValue).commit(); // Clear the icon cache. LauncherAppState.getInstance(mContext).getIconCache().clear(); |