Merge "Icon size should update when grid config changes" into ub-launcher3-master
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ec3a966..fc3af7e 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;
@@ -285,8 +286,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);
@@ -406,6 +408,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);
@@ -1322,7 +1330,7 @@
TextKeyListener.getInstance().release();
clearPendingBinds();
-
+ LauncherAppState.getIDP(this).removeOnChangeListener(this);
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onDestroy();
}