summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2014-07-01 18:01:58 -0700
committerRaj Yengisetty <rajesh@cyngn.com>2015-07-24 19:57:44 -0700
commit6e3dfeb5b073ee03d8b904dca230f57b6dfa67ea (patch)
treede5979eed6821f97a941e2407e810a277f312950
parentf6055034dcc1b31397c86382585bd8e491d95411 (diff)
downloadandroid_packages_apps_Trebuchet-6e3dfeb5b073ee03d8b904dca230f57b6dfa67ea.tar.gz
android_packages_apps_Trebuchet-6e3dfeb5b073ee03d8b904dca230f57b6dfa67ea.tar.bz2
android_packages_apps_Trebuchet-6e3dfeb5b073ee03d8b904dca230f57b6dfa67ea.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
-rw-r--r--src/com/android/launcher3/PagedView.java2
-rw-r--r--src/com/android/launcher3/Workspace.java32
2 files changed, 33 insertions, 1 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 6c491ecfd..1490bdf2b 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 b3da60224..785e29690 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2332,6 +2332,38 @@ public class Workspace extends SmoothPagedView
private static final int HIDE_WORKSPACE_DURATION = 100;
+ 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) {
return getChangeStateAnimation(state, animated, delay, snapPage, null);
}