Changes page alignment in PagedView calcualtion

- Align pages to right (instead of left) in RTL, to make scroll calculation for grid overview easier for out of orientation tasks
- Changed TaskView pivot direction to be consistent with page alignment
- Add scroll offset for ClearAllButton to align to left in RTL
- Fixed Workspace scroll issues in RTL, and removed needs to use panelCount when calculating page scroll

Bug: 175939487
Test: Test carousel/grid overveiw, Workspace, Folder scroll view for normal/RTL
Change-Id: Ic0ba88e5d58638e1149d97a68a978d80fbf26774
This commit is contained in:
Alex Chau
2021-03-29 17:37:53 +01:00
parent e6583cbb75
commit b5c4d1108f
4 changed files with 18 additions and 40 deletions
@@ -295,8 +295,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
// The following grid translations scales with mGridProgress.
private float mGridTranslationX;
private float mGridTranslationY;
// Offset translation does not affect scroll calculation.
private float mGridOffsetTranslationX;
private ObjectAnimator mIconAndDimAnimator;
private float mIconScaleAnimStartProgress = 0;
@@ -792,8 +790,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
@Override
public void onRecycle() {
mFullscreenTranslationX = mGridTranslationX =
mGridTranslationY = mGridOffsetTranslationX = mBoxTranslationY = 0f;
mFullscreenTranslationX = mGridTranslationX = mGridTranslationY = mBoxTranslationY = 0f;
resetViewTransforms();
// Clear any references to the thumbnail (it will be re-read either from the cache or the
// system on next bind)
@@ -874,7 +871,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (mActivity.getDeviceProfile().isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get()) {
setPivotX(getLayoutDirection() == LAYOUT_DIRECTION_RTL ? (right - left) : 0);
setPivotX(getLayoutDirection() == LAYOUT_DIRECTION_RTL ? 0 : right - left);
setPivotY(mSnapshotView.getTop());
} else {
setPivotX((right - left) * 0.5f);
@@ -979,11 +976,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
return mGridTranslationY;
}
public void setGridOffsetTranslationX(float gridOffsetTranslationX) {
mGridOffsetTranslationX = gridOffsetTranslationX;
applyTranslationX();
}
public float getScrollAdjustment(boolean fullscreenEnabled, boolean gridEnabled) {
float scrollAdjustment = 0;
if (fullscreenEnabled) {
@@ -996,11 +988,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
}
public float getOffsetAdjustment(boolean fullscreenEnabled,boolean gridEnabled) {
float offsetAdjustment = getScrollAdjustment(fullscreenEnabled, gridEnabled);
if (gridEnabled) {
offsetAdjustment += mGridOffsetTranslationX;
}
return offsetAdjustment;
return getScrollAdjustment(fullscreenEnabled, gridEnabled);
}
public float getSizeAdjustment(boolean fullscreenEnabled) {
@@ -1019,7 +1007,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
private void applyTranslationX() {
setTranslationX(mDismissTranslationX + mTaskOffsetTranslationX + mTaskResistanceTranslationX
+ getFullscreenTrans(mFullscreenTranslationX)
+ getGridTrans(mGridTranslationX + mGridOffsetTranslationX));
+ getGridTrans(mGridTranslationX));
}
private void applyTranslationY() {