diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2019-01-11 15:08:44 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2019-01-11 15:09:06 -0800 |
commit | 7d892ff198bba98e4a0319a8b0340c80cba3a015 (patch) | |
tree | 8be423425e1aba47db879ea903224af76b4e2a91 /src/com/android/launcher3/InvariantDeviceProfile.java | |
parent | 367a4855993af5b82da9e8ce1b080b887e944282 (diff) | |
download | android_packages_apps_Trebuchet-7d892ff198bba98e4a0319a8b0340c80cba3a015.tar.gz android_packages_apps_Trebuchet-7d892ff198bba98e4a0319a8b0340c80cba3a015.tar.bz2 android_packages_apps_Trebuchet-7d892ff198bba98e4a0319a8b0340c80cba3a015.zip |
Adding API to set the current grid
Bug: 122262084
Change-Id: Ie356d4a90cf1e5a3715fde62cd3502384856e8b5
Diffstat (limited to 'src/com/android/launcher3/InvariantDeviceProfile.java')
-rw-r--r-- | src/com/android/launcher3/InvariantDeviceProfile.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 45bdea88a..dafd5bb91 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -247,7 +247,6 @@ public class InvariantDeviceProfile { } public void verifyConfigChangedInBackground(final Context context) { - String savedIconMaskPath = getDevicePrefs(context).getString(KEY_ICON_PATH_REF, ""); // Good place to check if grid size changed in themepicker when launcher was dead. if (savedIconMaskPath.isEmpty()) { @@ -260,6 +259,12 @@ public class InvariantDeviceProfile { } } + public void setCurrentGrid(Context context, String gridName) { + Context appContext = context.getApplicationContext(); + Utilities.getPrefs(appContext).edit().putString(KEY_IDP_GRID_NAME, gridName).apply(); + new MainThreadExecutor().execute(() -> onConfigChanged(appContext)); + } + private void onConfigChanged(Context context) { // Config changes, what shall we do? InvariantDeviceProfile oldProfile = new InvariantDeviceProfile(this); @@ -300,7 +305,8 @@ public class InvariantDeviceProfile { int type; while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) { - if ((type == XmlPullParser.START_TAG) && "grid-option".equals(parser.getName())) { + if ((type == XmlPullParser.START_TAG) + && GridOption.TAG_NAME.equals(parser.getName())) { GridOption gridOption = new GridOption(context, Xml.asAttributeSet(parser)); final int displayDepth = parser.getDepth(); @@ -451,6 +457,8 @@ public class InvariantDeviceProfile { public static final class GridOption { + public static final String TAG_NAME = "grid-option"; + public final String name; public final int numRows; public final int numColumns; |