am 88cc3f5a: Merge "Fixing overscroll with single page (issue 10937081)" into jb-ub-now-indigo-rose
* commit '88cc3f5aa2e9ac3ae0b24e563a44d320cc089cd8': Fixing overscroll with single page (issue 10937081)
|
Before Width: | Height: | Size: 848 B After Width: | Height: | Size: 858 B |
|
Before Width: | Height: | Size: 547 B After Width: | Height: | Size: 552 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 4.5 KiB |
@@ -71,7 +71,7 @@
|
|||||||
<integer name="config_dragFadeOutDuration">250</integer>
|
<integer name="config_dragFadeOutDuration">250</integer>
|
||||||
|
|
||||||
<!-- Camera distance for the overscroll effect -->
|
<!-- Camera distance for the overscroll effect -->
|
||||||
<integer name="config_cameraDistance">6500</integer>
|
<integer name="config_cameraDistance">8000</integer>
|
||||||
|
|
||||||
<!-- Whether or not to use custom clings if a custom workspace layout is passed in -->
|
<!-- Whether or not to use custom clings if a custom workspace layout is passed in -->
|
||||||
<bool name="config_useCustomClings">false</bool>
|
<bool name="config_useCustomClings">false</bool>
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ public class Workspace extends SmoothPagedView
|
|||||||
private final int[] mTempXY = new int[2];
|
private final int[] mTempXY = new int[2];
|
||||||
private int[] mTempVisiblePagesRange = new int[2];
|
private int[] mTempVisiblePagesRange = new int[2];
|
||||||
private boolean mOverscrollTransformsSet;
|
private boolean mOverscrollTransformsSet;
|
||||||
|
private float mLastOverscrollPivotX;
|
||||||
public static final int DRAG_BITMAP_PADDING = 2;
|
public static final int DRAG_BITMAP_PADDING = 2;
|
||||||
private boolean mWorkspaceFadeInAdjacentScreens;
|
private boolean mWorkspaceFadeInAdjacentScreens;
|
||||||
|
|
||||||
@@ -1413,22 +1414,20 @@ public class Workspace extends SmoothPagedView
|
|||||||
final float rightBiasedPivot = 0.75f;
|
final float rightBiasedPivot = 0.75f;
|
||||||
final int lowerIndex = 0;
|
final int lowerIndex = 0;
|
||||||
final int upperIndex = getChildCount() - 1;
|
final int upperIndex = getChildCount() - 1;
|
||||||
if (isRtl) {
|
|
||||||
index = mOverScrollX < 0 ? upperIndex : lowerIndex;
|
final boolean isLeftPage = mOverScrollX < 0;
|
||||||
pivotX = (index == 0 ? leftBiasedPivot : rightBiasedPivot);
|
index = (!isRtl && isLeftPage) || (isRtl && !isLeftPage) ? lowerIndex : upperIndex;
|
||||||
} else {
|
pivotX = isLeftPage ? rightBiasedPivot : leftBiasedPivot;
|
||||||
index = mOverScrollX < 0 ? lowerIndex : upperIndex;
|
|
||||||
pivotX = (index == 0 ? rightBiasedPivot : leftBiasedPivot);
|
|
||||||
}
|
|
||||||
|
|
||||||
CellLayout cl = (CellLayout) getChildAt(index);
|
CellLayout cl = (CellLayout) getChildAt(index);
|
||||||
float scrollProgress = getScrollProgress(screenCenter, cl, index);
|
float scrollProgress = getScrollProgress(screenCenter, cl, index);
|
||||||
final boolean isLeftPage = (isRtl ? index > 0 : index == 0);
|
|
||||||
cl.setOverScrollAmount(Math.abs(scrollProgress), isLeftPage);
|
cl.setOverScrollAmount(Math.abs(scrollProgress), isLeftPage);
|
||||||
float rotation = -WORKSPACE_OVERSCROLL_ROTATION * scrollProgress;
|
float rotation = -WORKSPACE_OVERSCROLL_ROTATION * scrollProgress;
|
||||||
cl.setRotationY(rotation);
|
cl.setRotationY(rotation);
|
||||||
if (!mOverscrollTransformsSet) {
|
|
||||||
|
if (!mOverscrollTransformsSet || Float.compare(mLastOverscrollPivotX, pivotX) != 0) {
|
||||||
mOverscrollTransformsSet = true;
|
mOverscrollTransformsSet = true;
|
||||||
|
mLastOverscrollPivotX = pivotX;
|
||||||
cl.setCameraDistance(mDensity * mCameraDistance);
|
cl.setCameraDistance(mDensity * mCameraDistance);
|
||||||
cl.setPivotX(cl.getMeasuredWidth() * pivotX);
|
cl.setPivotX(cl.getMeasuredWidth() * pivotX);
|
||||||
cl.setPivotY(cl.getMeasuredHeight() * 0.5f);
|
cl.setPivotY(cl.getMeasuredHeight() * 0.5f);
|
||||||
|
|||||||