Merge "Consider launching task's position on screen in pivot calculation" into sc-v2-dev
This commit is contained in:
commit
48644c75b3
|
@ -196,7 +196,8 @@ public final class TaskViewUtils {
|
|||
boolean showAsGrid = dp.overviewShowAsGrid;
|
||||
boolean parallaxCenterAndAdjacentTask =
|
||||
taskIndex != recentsView.getCurrentPage() && !showAsGrid;
|
||||
int startScroll = recentsView.getScrollOffset(taskIndex);
|
||||
int taskRectTranslationPrimary = recentsView.getScrollOffset(taskIndex);
|
||||
int taskRectTranslationSecondary = showAsGrid ? (int) v.getGridTranslationY() : 0;
|
||||
|
||||
RemoteTargetHandle[] topMostSimulators = null;
|
||||
|
||||
|
@ -213,9 +214,10 @@ public final class TaskViewUtils {
|
|||
|
||||
tvsLocal.fullScreenProgress.value = 0;
|
||||
tvsLocal.recentsViewScale.value = 1;
|
||||
tvsLocal.setScroll(startScroll);
|
||||
tvsLocal.setIsGridTask(v.isGridTask());
|
||||
tvsLocal.setGridTranslationY(v.getGridTranslationY());
|
||||
tvsLocal.getOrientationState().getOrientationHandler().set(tvsLocal,
|
||||
TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary,
|
||||
taskRectTranslationSecondary);
|
||||
|
||||
// Fade in the task during the initial 20% of the animation
|
||||
out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1,
|
||||
|
|
|
@ -102,7 +102,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
|||
private StagedSplitBounds mStagedSplitBounds;
|
||||
private boolean mDrawsBelowRecents;
|
||||
private boolean mIsGridTask;
|
||||
private float mGridTranslationY;
|
||||
private int mTaskRectTranslationX;
|
||||
private int mTaskRectTranslationY;
|
||||
|
||||
public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
|
||||
mContext = context;
|
||||
|
@ -157,15 +158,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
|||
fullTaskSize = new Rect(mTaskRect);
|
||||
mOrientationState.getOrientationHandler()
|
||||
.setSplitTaskSwipeRect(mDp, mTaskRect, mStagedSplitBounds, mStagePosition);
|
||||
if (mIsGridTask) {
|
||||
mTaskRect.offset(0, (int) mGridTranslationY);
|
||||
}
|
||||
mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY);
|
||||
} else {
|
||||
fullTaskSize = mTaskRect;
|
||||
}
|
||||
if (mIsGridTask) {
|
||||
fullTaskSize.offset(0, (int) mGridTranslationY);
|
||||
}
|
||||
fullTaskSize.offset(mTaskRectTranslationX, mTaskRectTranslationY);
|
||||
return mOrientationState.getFullScreenScaleAndPivot(fullTaskSize, mDp, mPivot);
|
||||
}
|
||||
|
||||
|
@ -225,10 +222,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the y-translation when overview is in grid.
|
||||
* Apply translations on TaskRect's starting location.
|
||||
*/
|
||||
public void setGridTranslationY(float gridTranslationY) {
|
||||
mGridTranslationY = gridTranslationY;
|
||||
public void setTaskRectTranslation(int taskRectTranslationX, int taskRectTranslationY) {
|
||||
mTaskRectTranslationX = taskRectTranslationX;
|
||||
mTaskRectTranslationY = taskRectTranslationY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -336,19 +334,19 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
|||
|
||||
// Apply TaskView matrix: taskRect, translate
|
||||
mMatrix.postTranslate(mTaskRect.left, mTaskRect.top);
|
||||
mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
|
||||
mOrientationState.getOrientationHandler().setPrimary(mMatrix, MATRIX_POST_TRANSLATE,
|
||||
taskPrimaryTranslation.value);
|
||||
mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
|
||||
taskSecondaryTranslation.value);
|
||||
mOrientationState.getOrientationHandler().setPrimary(
|
||||
mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
|
||||
|
||||
// Apply RecentsView matrix
|
||||
mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y);
|
||||
mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
|
||||
recentsViewSecondaryTranslation.value);
|
||||
mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
|
||||
mOrientationState.getOrientationHandler().setPrimary(mMatrix, MATRIX_POST_TRANSLATE,
|
||||
recentsViewPrimaryTranslation.value);
|
||||
mOrientationState.getOrientationHandler().set(
|
||||
mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
|
||||
applyWindowToHomeRotation(mMatrix);
|
||||
|
||||
// Crop rect is the inverse of thumbnail matrix
|
||||
|
|
|
@ -747,7 +747,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||
|
||||
int primarySize = mOrientationHandler.getPrimaryValue(getWidth(), getHeight());
|
||||
int scroll = OverScroll.dampedScroll(getUndampedOverScrollShift(), primarySize);
|
||||
mOrientationHandler.set(canvas, CANVAS_TRANSLATE, scroll);
|
||||
mOrientationHandler.setPrimary(canvas, CANVAS_TRANSLATE, scroll);
|
||||
|
||||
if (mOverScrollShift != scroll) {
|
||||
mOverScrollShift = scroll;
|
||||
|
|
|
@ -252,7 +252,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
|||
if (0 <= mCurrentPage && mCurrentPage < getPageCount()) {
|
||||
newPosition = getScrollForPage(mCurrentPage) + mCurrentPageScrollDiff;
|
||||
}
|
||||
mOrientationHandler.set(this, VIEW_SCROLL_TO, newPosition);
|
||||
mOrientationHandler.setPrimary(this, VIEW_SCROLL_TO, newPosition);
|
||||
mScroller.startScroll(mScroller.getCurrX(), 0, newPosition - mScroller.getCurrX(), 0);
|
||||
forceFinishScroller();
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
|||
int oldPos = mOrientationHandler.getPrimaryScroll(this);
|
||||
int newPos = mScroller.getCurrX();
|
||||
if (oldPos != newPos) {
|
||||
mOrientationHandler.set(this, VIEW_SCROLL_TO, mScroller.getCurrX());
|
||||
mOrientationHandler.setPrimary(this, VIEW_SCROLL_TO, mScroller.getCurrX());
|
||||
}
|
||||
|
||||
if (mAllowOverScroll) {
|
||||
|
@ -1280,7 +1280,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
|||
mLastMotionRemainder = delta - movedDelta;
|
||||
|
||||
if (delta != 0) {
|
||||
mOrientationHandler.set(this, VIEW_SCROLL_BY, movedDelta);
|
||||
mOrientationHandler.setPrimary(this, VIEW_SCROLL_BY, movedDelta);
|
||||
|
||||
if (mAllowOverScroll) {
|
||||
final float pulledToX = oldScroll + delta;
|
||||
|
|
|
@ -101,12 +101,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> void set(T target, Int2DAction<T> action, int param) {
|
||||
public <T> void setPrimary(T target, Int2DAction<T> action, int param) {
|
||||
action.call(target, 0, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void set(T target, Float2DAction<T> action, float param) {
|
||||
public <T> void setPrimary(T target, Float2DAction<T> action, float param) {
|
||||
action.call(target, 0, param);
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
|||
action.call(target, param, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void set(T target, Int2DAction<T> action, int primaryParam,
|
||||
int secondaryParam) {
|
||||
action.call(target, secondaryParam, primaryParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPrimaryDirection(MotionEvent event, int pointerIndex) {
|
||||
return event.getY(pointerIndex);
|
||||
|
|
|
@ -65,9 +65,10 @@ public interface PagedOrientationHandler {
|
|||
Float2DAction<Canvas> CANVAS_TRANSLATE = Canvas::translate;
|
||||
Float2DAction<Matrix> MATRIX_POST_TRANSLATE = Matrix::postTranslate;
|
||||
|
||||
<T> void set(T target, Int2DAction<T> action, int param);
|
||||
<T> void set(T target, Float2DAction<T> action, float param);
|
||||
<T> void setPrimary(T target, Int2DAction<T> action, int param);
|
||||
<T> void setPrimary(T target, Float2DAction<T> action, float param);
|
||||
<T> void setSecondary(T target, Float2DAction<T> action, float param);
|
||||
<T> void set(T target, Int2DAction<T> action, int primaryParam, int secondaryParam);
|
||||
float getPrimaryDirection(MotionEvent event, int pointerIndex);
|
||||
float getPrimaryVelocity(VelocityTracker velocityTracker, int pointerId);
|
||||
int getMeasuredSize(View view);
|
||||
|
|
|
@ -101,12 +101,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> void set(T target, Int2DAction<T> action, int param) {
|
||||
public <T> void setPrimary(T target, Int2DAction<T> action, int param) {
|
||||
action.call(target, param, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void set(T target, Float2DAction<T> action, float param) {
|
||||
public <T> void setPrimary(T target, Float2DAction<T> action, float param) {
|
||||
action.call(target, param, 0);
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
|||
action.call(target, 0, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void set(T target, Int2DAction<T> action, int primaryParam,
|
||||
int secondaryParam) {
|
||||
action.call(target, primaryParam, secondaryParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPrimaryDirection(MotionEvent event, int pointerIndex) {
|
||||
return event.getX(pointerIndex);
|
||||
|
|
Loading…
Reference in New Issue