diff --git a/lawnchair/src/ch/deletescape/lawnchair/util/preferences/LawnchairPreferences.kt b/lawnchair/src/ch/deletescape/lawnchair/util/preferences/LawnchairPreferences.kt index 0f867dbb6b..86095eed23 100644 --- a/lawnchair/src/ch/deletescape/lawnchair/util/preferences/LawnchairPreferences.kt +++ b/lawnchair/src/ch/deletescape/lawnchair/util/preferences/LawnchairPreferences.kt @@ -2,6 +2,7 @@ package ch.deletescape.lawnchair.util.preferences import android.content.Context import android.content.SharedPreferences +import android.util.Log import com.android.launcher3.LauncherAppState import com.android.launcher3.Utilities @@ -17,6 +18,10 @@ class LawnchairPreferences(val context: Context) { LauncherAppState.getInstance(context).model.clearIconCache() LauncherAppState.getInstance(context).model.forceReload() } + WORKSPACE_ROWS, WORKSPACE_COLUMNS, ALL_APPS_COLUMNS, FOLDER_ROWS, FOLDER_COLUMNS, HOTSEAT_COLUMNS -> { + LauncherAppState.getInstance(context).invariantDeviceProfile.reInitGrid() + LauncherAppState.getInstance(context).model.forceReload() + } } } diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 7ae9ed2d68..efdd0b3a65 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -140,6 +140,8 @@ public class InvariantDeviceProfile { private ConfigMonitor mConfigMonitor; private OverlayMonitor mOverlayMonitor; + private Context mContext; + @VisibleForTesting public InvariantDeviceProfile() {} @@ -162,10 +164,12 @@ public class InvariantDeviceProfile { demoModeLayoutId = p.demoModeLayoutId; mExtraAttrs = p.mExtraAttrs; mOverlayMonitor = p.mOverlayMonitor; + mContext = p.mContext; } @TargetApi(23) private InvariantDeviceProfile(Context context) { + mContext = context; String gridName = getCurrentGridName(context); String newGridName = initGrid(context, gridName); if (!newGridName.equals(gridName)) { @@ -185,6 +189,7 @@ public class InvariantDeviceProfile { * This constructor should NOT have any monitors by design. */ public InvariantDeviceProfile(Context context, String gridName) { + mContext = context; String newName = initGrid(context, gridName); if (newName == null || !newName.equals(gridName)) { throw new IllegalArgumentException("Unknown grid name"); @@ -195,6 +200,7 @@ public class InvariantDeviceProfile { * This constructor should NOT have any monitors by design. */ public InvariantDeviceProfile(Context context, Display display) { + mContext = context; // Ensure that the main device profile is initialized InvariantDeviceProfile originalProfile = INSTANCE.get(context); String gridName = getCurrentGridName(context); @@ -322,6 +328,10 @@ public class InvariantDeviceProfile { } + public void reInitGrid() { + initGrid(mContext, getCurrentGridName(mContext)); + } + @Nullable public TypedValue getAttrValue(int attr) { return mExtraAttrs == null ? null : mExtraAttrs.get(attr);