Separate TaskView translationX into dismiss + offset translations
- Previously, these both setTranslationX() directly, meaning one could clobber the other. Now they are set independently and aggregated to setTranslationX(). - For fake landscape, we actually are setting translationY, so had to create both translationX and translationY properties, and set the appropriate one via the current orientation handler's "primary" dimension. Fixes: 176766821 Change-Id: I00ed0bd73dbea00f4018de62260ed35f4d6966a5
This commit is contained in:
1 parent
da5e714ca1
commit
10a2b9c8af
2 files changed
+107
-3
No files matched your search
@@ -152,6 +152,58 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
}
|
||||
};
|
||||
|
||||
private static final FloatProperty<TaskView> FILL_DISMISS_GAP_TRANSLATION_X =
|
||||
new FloatProperty<TaskView>("fillDismissGapTranslationX") {
|
||||
@Override
|
||||
public void setValue(TaskView taskView, float v) {
|
||||
taskView.setFillDismissGapTranslationX(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(TaskView taskView) {
|
||||
return taskView.mFillDismissGapTranslationX;
|
||||
}
|
||||
};
|
||||
|
||||
private static final FloatProperty<TaskView> FILL_DISMISS_GAP_TRANSLATION_Y =
|
||||
new FloatProperty<TaskView>("fillDismissGapTranslationY") {
|
||||
@Override
|
||||
public void setValue(TaskView taskView, float v) {
|
||||
taskView.setFillDismissGapTranslationY(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(TaskView taskView) {
|
||||
return taskView.mFillDismissGapTranslationY;
|
||||
}
|
||||
};
|
||||
|
||||
private static final FloatProperty<TaskView> TASK_OFFSET_TRANSLATION_X =
|
||||
new FloatProperty<TaskView>("taskOffsetTranslationX") {
|
||||
@Override
|
||||
public void setValue(TaskView taskView, float v) {
|
||||
taskView.setTaskOffsetTranslationX(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(TaskView taskView) {
|
||||
return taskView.mTaskOffsetTranslationX;
|
||||
}
|
||||
};
|
||||
|
||||
private static final FloatProperty<TaskView> TASK_OFFSET_TRANSLATION_Y =
|
||||
new FloatProperty<TaskView>("taskOffsetTranslationY") {
|
||||
@Override
|
||||
public void setValue(TaskView taskView, float v) {
|
||||
taskView.setTaskOffsetTranslationY(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(TaskView taskView) {
|
||||
return taskView.mTaskOffsetTranslationY;
|
||||
}
|
||||
};
|
||||
|
||||
private final OnAttachStateChangeListener mTaskMenuStateListener =
|
||||
new OnAttachStateChangeListener() {
|
||||
@Override
|
||||
@@ -179,6 +231,13 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
private final FullscreenDrawParams mCurrentFullscreenParams;
|
||||
private final StatefulActivity mActivity;
|
||||
|
||||
// Various causes of changing primary translation, which we aggregate to setTranslationX/Y().
|
||||
// TODO: We should do this for secondary translation properties as well.
|
||||
private float mFillDismissGapTranslationX;
|
||||
private float mFillDismissGapTranslationY;
|
||||
private float mTaskOffsetTranslationX;
|
||||
private float mTaskOffsetTranslationY;
|
||||
|
||||
private ObjectAnimator mIconAndDimAnimator;
|
||||
private float mIconScaleAnimStartProgress = 0;
|
||||
private float mFocusTransitionProgress = 1;
|
||||
@@ -601,6 +660,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
|
||||
protected void resetViewTransforms() {
|
||||
setCurveScale(1);
|
||||
mFillDismissGapTranslationX = mTaskOffsetTranslationX = 0f;
|
||||
mFillDismissGapTranslationY = mTaskOffsetTranslationY = 0f;
|
||||
setTranslationX(0f);
|
||||
setTranslationY(0f);
|
||||
setTranslationZ(0);
|
||||
@@ -745,6 +806,44 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
return mCurveScale;
|
||||
}
|
||||
|
||||
private void setFillDismissGapTranslationX(float x) {
|
||||
mFillDismissGapTranslationX = x;
|
||||
applyTranslationX();
|
||||
}
|
||||
|
||||
private void setFillDismissGapTranslationY(float y) {
|
||||
mFillDismissGapTranslationY = y;
|
||||
applyTranslationY();
|
||||
}
|
||||
|
||||
private void setTaskOffsetTranslationX(float x) {
|
||||
mTaskOffsetTranslationX = x;
|
||||
applyTranslationX();
|
||||
}
|
||||
|
||||
private void setTaskOffsetTranslationY(float y) {
|
||||
mTaskOffsetTranslationY = y;
|
||||
applyTranslationY();
|
||||
}
|
||||
|
||||
private void applyTranslationX() {
|
||||
setTranslationX(mFillDismissGapTranslationX + mTaskOffsetTranslationX);
|
||||
}
|
||||
|
||||
private void applyTranslationY() {
|
||||
setTranslationY(mFillDismissGapTranslationY + mTaskOffsetTranslationY);
|
||||
}
|
||||
|
||||
public FloatProperty<TaskView> getPrimaryFillDismissGapTranslationProperty() {
|
||||
return getPagedOrientationHandler().getPrimaryValue(
|
||||
FILL_DISMISS_GAP_TRANSLATION_X, FILL_DISMISS_GAP_TRANSLATION_Y);
|
||||
}
|
||||
|
||||
public FloatProperty<TaskView> getPrimaryTaskOffsetTranslationProperty() {
|
||||
return getPagedOrientationHandler().getPrimaryValue(
|
||||
TASK_OFFSET_TRANSLATION_X, TASK_OFFSET_TRANSLATION_Y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
// TODO: Clip-out the icon region from the thumbnail, since they are overlapping.
|
||||
|
||||
Reference in new issue
Block a user