Move SharedPreferences code to its own class.

Bug: 251502424
Test: Code compiled correctly.
Change-Id: Iea0d6ab2999504117546ee0f7adc0c7b8b45c065
This commit is contained in:
Stefan Andonian
2022-11-10 23:07:40 +00:00
parent 698239e16a
commit 146701ca3e
30 changed files with 88 additions and 72 deletions

View File

@@ -29,7 +29,7 @@ import android.content.SharedPreferences;
import android.text.TextUtils;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Utilities;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import java.util.Locale;
@@ -58,7 +58,7 @@ public class DeviceGridState implements Comparable<DeviceGridState> {
}
public DeviceGridState(Context context) {
SharedPreferences prefs = Utilities.getPrefs(context);
SharedPreferences prefs = LauncherPrefs.getPrefs(context);
mGridSizeString = prefs.getString(KEY_WORKSPACE_SIZE, "");
mNumHotseat = prefs.getInt(KEY_HOTSEAT_COUNT, -1);
mDeviceType = prefs.getInt(KEY_DEVICE_TYPE, TYPE_PHONE);
@@ -90,7 +90,7 @@ public class DeviceGridState implements Comparable<DeviceGridState> {
* Stores the device state to shared preferences
*/
public void writeToPrefs(Context context) {
Utilities.getPrefs(context).edit()
LauncherPrefs.getPrefs(context).edit()
.putString(KEY_WORKSPACE_SIZE, mGridSizeString)
.putInt(KEY_HOTSEAT_COUNT, mNumHotseat)
.putInt(KEY_DEVICE_TYPE, mDeviceType)