Remove grid scaling in Overveiw
- Grid scaling has problem that scales task icon and menu, which makes it hard to control icon size and text size in the manula - Replaced the whole concept with dedicated Task size calculation in grid layout - Support different icon size in TaskView in grid and removed task_thumbnail_top_margin - Removed grid progress in TaskViewSimulator as well - Refactored how ClearAllButton scroll and translations are calcualted to align clear all properly in grid - Make page center calculation aware of PagedView pivot and scaling Bug: 174464863 Test: Manual on two screens Change-Id: I47b13ef6e55c6e16c52ea04225f5bde02ed82fc2
This commit is contained in:
@@ -279,7 +279,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
private float mFullscreenProgress;
|
||||
private float mGridProgress;
|
||||
private float mFullscreenScale = 1;
|
||||
private float mGridScale = 1;
|
||||
private final FullscreenDrawParams mCurrentFullscreenParams;
|
||||
private final StatefulActivity mActivity;
|
||||
|
||||
@@ -298,7 +297,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
private float mGridTranslationY;
|
||||
// Offset translation does not affect scroll calculation.
|
||||
private float mGridOffsetTranslationX;
|
||||
private float mNonRtlVisibleOffset;
|
||||
|
||||
private ObjectAnimator mIconAndDimAnimator;
|
||||
private float mIconScaleAnimStartProgress = 0;
|
||||
@@ -678,9 +676,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
|
||||
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
|
||||
snapshotParams.topMargin = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
|
||||
int taskIconMargin = mActivity.getDeviceProfile().overviewTaskMarginPx;
|
||||
int taskIconHeight = (int) getResources().getDimension(R.dimen.task_thumbnail_icon_size);
|
||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||
snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
|
||||
int taskIconMargin = deviceProfile.overviewTaskMarginPx;
|
||||
int taskIconHeight = deviceProfile.overviewTaskIconSizePx;
|
||||
LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
|
||||
switch (orientationHandler.getRotation()) {
|
||||
case ROTATION_90:
|
||||
@@ -709,8 +708,11 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
break;
|
||||
}
|
||||
mSnapshotView.setLayoutParams(snapshotParams);
|
||||
iconParams.width = iconParams.height = taskIconHeight;
|
||||
mIconView.setLayoutParams(iconParams);
|
||||
mIconView.setRotation(orientationHandler.getDegreesRotated());
|
||||
snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
|
||||
mSnapshotView.setLayoutParams(snapshotParams);
|
||||
|
||||
if (mMenuView != null) {
|
||||
mMenuView.onRotationChanged();
|
||||
@@ -790,8 +792,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
|
||||
@Override
|
||||
public void onRecycle() {
|
||||
mFullscreenTranslationX = mGridTranslationX = mGridTranslationY =
|
||||
mGridOffsetTranslationX = mBoxTranslationY = mNonRtlVisibleOffset = 0f;
|
||||
mFullscreenTranslationX = mGridTranslationX =
|
||||
mGridTranslationY = mGridOffsetTranslationX = mBoxTranslationY = 0f;
|
||||
resetViewTransforms();
|
||||
// Clear any references to the thumbnail (it will be re-read either from the cache or the
|
||||
// system on next bind)
|
||||
@@ -801,7 +803,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScroll(ScrollState scrollState) {
|
||||
public void onPageScroll(ScrollState scrollState, boolean gridEnabled) {
|
||||
// Don't do anything if it's modal.
|
||||
if (mModalness > 0) {
|
||||
return;
|
||||
@@ -904,11 +906,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
return mFullscreenScale;
|
||||
}
|
||||
|
||||
public void setGridScale(float gridScale) {
|
||||
mGridScale = gridScale;
|
||||
applyScale();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves TaskView between carousel and 2 row grid.
|
||||
*
|
||||
@@ -925,8 +922,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
float scale = 1;
|
||||
float fullScreenProgress = EXAGGERATED_EASE.getInterpolation(mFullscreenProgress);
|
||||
scale *= Utilities.mapRange(fullScreenProgress, 1f, mFullscreenScale);
|
||||
float gridProgress = ACCEL_DEACCEL.getInterpolation(mGridProgress);
|
||||
scale *= Utilities.mapRange(gridProgress, 1f, mGridScale);
|
||||
setScaleX(scale);
|
||||
setScaleY(scale);
|
||||
}
|
||||
@@ -989,10 +984,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
applyTranslationX();
|
||||
}
|
||||
|
||||
public void setNonRtlVisibleOffset(float nonRtlVisibleOffset) {
|
||||
mNonRtlVisibleOffset = nonRtlVisibleOffset;
|
||||
}
|
||||
|
||||
public float getScrollAdjustment(boolean fullscreenEnabled, boolean gridEnabled) {
|
||||
float scrollAdjustment = 0;
|
||||
if (fullscreenEnabled) {
|
||||
@@ -1004,22 +995,19 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
return scrollAdjustment;
|
||||
}
|
||||
|
||||
public float getOffsetAdjustment(boolean fullscreenEnabled, boolean gridEnabled) {
|
||||
public float getOffsetAdjustment(boolean fullscreenEnabled,boolean gridEnabled) {
|
||||
float offsetAdjustment = getScrollAdjustment(fullscreenEnabled, gridEnabled);
|
||||
if (gridEnabled) {
|
||||
offsetAdjustment += mGridOffsetTranslationX + mNonRtlVisibleOffset;
|
||||
offsetAdjustment += mGridOffsetTranslationX;
|
||||
}
|
||||
return offsetAdjustment;
|
||||
}
|
||||
|
||||
public float getSizeAdjustment(boolean fullscreenEnabled, boolean gridEnabled) {
|
||||
public float getSizeAdjustment(boolean fullscreenEnabled) {
|
||||
float sizeAdjustment = 1;
|
||||
if (fullscreenEnabled) {
|
||||
sizeAdjustment *= mFullscreenScale;
|
||||
}
|
||||
if (gridEnabled) {
|
||||
sizeAdjustment *= mGridScale;
|
||||
}
|
||||
return sizeAdjustment;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user