summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Workspace.java
diff options
context:
space:
mode:
authorWinson <winsonc@google.com>2016-07-28 12:24:55 -0700
committerWinson <winsonc@google.com>2016-07-28 16:21:20 -0700
commitc7d2e83c15e85b2695e016213549d08e63c923b3 (patch)
treef0ca3675781bc9d6b9d3e4598271bd15c646a687 /src/com/android/launcher3/Workspace.java
parentd96fa1336921cc8c8bb4d773b2229b62df86e6ea (diff)
downloadandroid_packages_apps_Trebuchet-c7d2e83c15e85b2695e016213549d08e63c923b3.tar.gz
android_packages_apps_Trebuchet-c7d2e83c15e85b2695e016213549d08e63c923b3.tar.bz2
android_packages_apps_Trebuchet-c7d2e83c15e85b2695e016213549d08e63c923b3.zip
Working around incorrect wallpaper offsets being calculated in RTL.
- When launcher starts up, onCreate() triggers the launcher model loader to start, which calls bindScreens() to add the workspace pages. However, layout does not happen until the device is unlocked, which means that even though the default screen index and children are there the page scrolls are calculated incorrectly, and even in RTL, the page scroll for the 0th screen is zero (it should be at the right most edge of the workspace). This CL works around this by deferring until the first layout after bindScreens() to unlock the wallpaper offset from its default bounds. The workaround is only applied when the launcher activity is first created. Bug: 28795125 Change-Id: I33da0d7f934f5337d26e69f068f579a32897a837
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r--src/com/android/launcher3/Workspace.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 3c057e6fd..264da04d8 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -90,7 +90,6 @@ import com.android.launcher3.widget.PendingAddWidgetInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.concurrent.atomic.AtomicInteger;
/**
* The workspace is a wide area with a wallpaper and a finite number of pages.
@@ -253,6 +252,7 @@ public class Workspace extends PagedView
private boolean mWorkspaceFadeInAdjacentScreens;
final WallpaperOffsetInterpolator mWallpaperOffset;
+ private boolean mUnlockWallpaperFromDefaultPageOnLayout;
@Thunk Runnable mDelayedResizeRunnable;
private Runnable mDelayedSnapToPageRunnable;
@@ -1616,6 +1616,17 @@ public class Workspace extends PagedView
});
}
+ public void lockWallpaperToDefaultPage() {
+ mWallpaperOffset.setLockToDefaultPage(true);
+ }
+
+ public void unlockWallpaperFromDefaultPageOnNextLayout() {
+ if (mWallpaperOffset.isLockedToDefaultPage()) {
+ mUnlockWallpaperFromDefaultPageOnLayout = true;
+ requestLayout();
+ }
+ }
+
protected void snapToPage(int whichPage, Runnable r) {
snapToPage(whichPage, SLOW_PAGE_SNAP_ANIMATION_DURATION, r);
}
@@ -1797,6 +1808,10 @@ public class Workspace extends PagedView
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ if (mUnlockWallpaperFromDefaultPageOnLayout) {
+ mWallpaperOffset.setLockToDefaultPage(false);
+ mUnlockWallpaperFromDefaultPageOnLayout = false;
+ }
if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) {
mWallpaperOffset.syncWithScroll();
mWallpaperOffset.jumpToFinal();