summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2015-06-19 13:11:08 -0700
committerMatt Garnes <matt@cyngn.com>2015-06-22 19:09:38 +0000
commitcae95210719c7d520afcf1b5c6f088d776c974d2 (patch)
treed80d3d0c99aa812060628175b1d65faa4b7589f3 /src/com/android/launcher3/Launcher.java
parente806def329c6a928f98923ddb021ffd8acfb0b65 (diff)
downloadandroid_packages_apps_Trebuchet-cae95210719c7d520afcf1b5c6f088d776c974d2.tar.gz
android_packages_apps_Trebuchet-cae95210719c7d520afcf1b5c6f088d776c974d2.tar.bz2
android_packages_apps_Trebuchet-cae95210719c7d520afcf1b5c6f088d776c974d2.zip
Fix unintended dynamic grid resize side effects.
- Do not attempt to resize the grid unless the dynamic grid resize has been explicitly triggered. - Workspace Ids are 1 indexed not 0, so on resize, start at 1. - After resizing the grid, persist the changes to the DB. The initial implementation only did the resize in memory and did not persist this, causing side effects later. Bugs fixed: 1. Resize the dynamic grid from large to small. Add a new icon by installing a new app or adding a shortcut from file manager. The new icon will overlap one on one of the new pages. 2. Resize the grid from large to small in a previous version of trebuchet (before the grid resize feature was added). Icons on the outer edges of the grid will be lost but persist in the DB. Upgrade to a new version of Trebuchet. The icons will return to the workspace. Change-Id: I8b0defafb3299d1f3d534526a75f9253495d739d
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r--src/com/android/launcher3/Launcher.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 813d091df..682758909 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -337,6 +337,7 @@ public class Launcher extends Activity
private boolean mWorkspaceLoading = true;
private boolean mDynamicGridUpdateRequired = false;
+ private boolean mDynamicGridResizeRequired = false;
private boolean mPaused = true;
private boolean mRestoring;
@@ -457,7 +458,7 @@ public class Launcher extends Activity
Runnable mUpdateDynamicGridRunnable = new Runnable() {
@Override
public void run() {
- updateDynamicGrid();
+ updateDynamicGrid(false);
}
};
@@ -469,7 +470,7 @@ public class Launcher extends Activity
return;
}
- updateDynamicGrid();
+ updateDynamicGrid(false);
}
};
@@ -1323,7 +1324,7 @@ public class Launcher extends Activity
SettingsProvider.putInt(this,
SettingsProvider.SETTINGS_UI_DYNAMIC_GRID_SIZE, size.getValue());
- setUpdateDynamicGrid();
+ setUpdateDynamicGrid(true);
}
mOverviewSettingsPanel.notifyDataSetInvalidated();
@@ -5862,11 +5863,11 @@ public class Launcher extends Activity
return effect == null ? TransitionEffect.TRANSITION_EFFECT_NONE : effect.getName();
}
- public void updateDynamicGrid() {
- updateDynamicGrid(mWorkspace.getRestorePage());
+ public void updateDynamicGrid(boolean resizeGridIfNeeded) {
+ updateDynamicGrid(mWorkspace.getRestorePage(), resizeGridIfNeeded);
}
- public void updateDynamicGrid(int page) {
+ public void updateDynamicGrid(int page, boolean resizeGridIfNeeded) {
mSearchDropTargetBar.setupQSB(Launcher.this);
initializeDynamicGrid(true);
@@ -5875,19 +5876,22 @@ public class Launcher extends Activity
// Synchronized reload
mModel.resetLoadedState(true, true);
- mModel.startLoader(true, page);
+ int flag = resizeGridIfNeeded ? LauncherModel.LOADER_FLAG_RESIZE_GRID :
+ LauncherModel.LOADER_FLAG_NONE;
+ mModel.startLoader(true, page, flag);
mWorkspace.updateCustomContentVisibility();
mAppDrawerAdapter.reset();
}
- public void setUpdateDynamicGrid() {
+ public void setUpdateDynamicGrid(boolean resizeDynamicGrid) {
mDynamicGridUpdateRequired = true;
+ mDynamicGridResizeRequired = resizeDynamicGrid;
}
public boolean updateGridIfNeeded() {
if (mDynamicGridUpdateRequired) {
- updateDynamicGrid(mWorkspace.getCurrentPage());
+ updateDynamicGrid(mWorkspace.getCurrentPage(), mDynamicGridResizeRequired);
mDynamicGridUpdateRequired = false;
return true;
}