Icon size should update when grid config changes
Bug: 123311886
More context: after IDP changes, DeviceProfile member is never updated
with newly calculated values.
However, all apps is still seriously broken, and I didn't address that
in this CL because jon may be working on it.
Change-Id: I69447a44c30ee467eec52b04bff0dc1afa5696a9
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index f09b6e8..177e780 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -153,7 +153,8 @@
* Default launcher application.
*/
public class Launcher extends BaseDraggingActivity implements LauncherExterns,
- LauncherModel.Callbacks, LauncherProviderChangeListener, UserEventDelegate{
+ LauncherModel.Callbacks, LauncherProviderChangeListener, UserEventDelegate,
+ InvariantDeviceProfile.OnIDPChangeListener {
public static final String TAG = "Launcher";
static final boolean LOGD = false;
@@ -283,8 +284,9 @@
LauncherAppState app = LauncherAppState.getInstance(this);
mOldConfig = new Configuration(getResources().getConfiguration());
mModel = app.setLauncher(this);
- initDeviceProfile(app.getInvariantDeviceProfile());
-
+ InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
+ initDeviceProfile(idp);
+ idp.addOnChangeListener(this);
mSharedPrefs = Utilities.getPrefs(this);
mIconCache = app.getIconCache();
mAccessibilityDelegate = new LauncherAccessibilityDelegate(this);
@@ -404,6 +406,12 @@
}
}
+ @Override
+ public void onIdpChanged(int changeFlags, InvariantDeviceProfile idp) {
+ initDeviceProfile(idp);
+ getRootView().dispatchInsets();
+ }
+
private void initDeviceProfile(InvariantDeviceProfile idp) {
// Load configuration-specific DeviceProfile
mDeviceProfile = idp.getDeviceProfile(this);
@@ -1316,7 +1324,7 @@
TextKeyListener.getInstance().release();
clearPendingBinds();
-
+ LauncherAppState.getIDP(this).removeOnChangeListener(this);
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onDestroy();
}