summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2014-07-01 18:01:58 -0700
committerMatt Garnes <matt@cyngn.com>2014-07-02 09:48:59 -0700
commit3de1e805afc243c10721fb32c3eeac51e4d0bd33 (patch)
tree87768f8bc8bf9c11c084dd2f53ea15d79b06b23d /src
parentebf8f37515c23a167cef2bb8cff04854c52fd35b (diff)
downloadandroid_packages_apps_Trebuchet-3de1e805afc243c10721fb32c3eeac51e4d0bd33.tar.gz
android_packages_apps_Trebuchet-3de1e805afc243c10721fb32c3eeac51e4d0bd33.tar.bz2
android_packages_apps_Trebuchet-3de1e805afc243c10721fb32c3eeac51e4d0bd33.zip
Fix Settings Panel bug causing frozen overview.
Previously, toggling search panel would freeze Overview mode until the user exited back to the regular launcher. Also, the current page would be lost. Fix this by computing the new scroll bounds immediately when the setting is toggled. Change-Id: Ib3587cfcea61e15b3d8b280113ce986cc57f2f9d
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/PagedView.java2
-rw-r--r--src/com/android/launcher3/Workspace.java32
-rw-r--r--src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java2
3 files changed, 35 insertions, 1 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 7f145aea2..11b2bf77a 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -143,7 +143,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
private boolean mCancelTap;
- private int[] mPageScrolls;
+ protected int[] mPageScrolls;
protected final static int TOUCH_STATE_REST = 0;
protected final static int TOUCH_STATE_SCROLLING = 1;
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 7e3584115..9617ace5b 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2261,6 +2261,38 @@ public class Workspace extends SmoothPagedView
setImportantForAccessibility(accessible);
}
+ public void updatePageScrollForCustomPage(boolean enabled) {
+ int diff;
+ // If multiple PageScrolls have been computed already,
+ // find the distance between the first and second scroll.
+ if(mPageScrolls.length > 1) {
+ diff = mPageScrolls[1] - mPageScrolls[0];
+ } else {
+ // The scroll distance will just be the width of the viewport
+ diff = getViewportWidth();
+ }
+
+ // Create an ArrayList to hold PageScrolls while we work with them
+ ArrayList<Integer> list = new ArrayList<Integer>();
+ for(int i : mPageScrolls) {
+ list.add(i);
+ }
+
+ // If custom page is enabled, add another page scroll entry
+ if(enabled){
+ list.add(list.get(list.size() - 1) + diff);
+ } else {
+ // disabling custom page, remove the last element
+ list.remove(list.size() - 1);
+ }
+
+ // Replace mPageScrolls with the list content
+ mPageScrolls = new int[list.size()];
+ for(int i = 0; i < list.size();i++) {
+ mPageScrolls[i] = list.get(i);
+ }
+ }
+
Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage) {
if (mState == state) {
return null;
diff --git a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
index 805b51e37..4b0d40833 100644
--- a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
+++ b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
@@ -310,6 +310,8 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
v,
SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH_SCREEN_LEFT,
R.bool.preferences_interface_homescreen_search_screen_left_default);
+ mLauncher.restoreGelSetting();
+ mLauncher.getWorkspace().updatePageScrollForCustomPage(!current);
mLauncher.updateDynamicGrid();
}
} else if (value.equals(res