Merge changes I33da0d7f,I36c31609 into ub-launcher3-calgary

* changes:
  Working around incorrect wallpaper offsets being calculated in RTL.
  Fixing RTL wallpaper scrolling.
This commit is contained in:
Winson Chung
2016-07-29 05:49:20 +00:00
committed by Android (Google) Code Review
3 changed files with 84 additions and 46 deletions
+16 -1
View File
@@ -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();