Always focus a task in overview
- Focus first task when applying load plan - Focus the next task in shorter row when focused task is dismissed, scale the snapshot and translate the task into focused position - Always show actions view as there is always a focused task. Update scroll alpha when toggling grid enabled - In fallback recents, take into account that home task will be dismissed when determining rows for the grid, ensuring next focused task won't affect row balancing - Bring back clearAllShortTotalCompensation as there isn't always a snappedTaskView (e.g. when snapped to ClearAllButton) - Ensure that getFocusedTaskView is only used when showAsGrid is true Bug: 187839470 Fixes: 188001858 Fixes: 189057812 Test: manual Change-Id: I6f31ef469c58fda70d2dd8caa2ee7d8a80c7f03b
This commit is contained in:
@@ -166,7 +166,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
private static final List<Rect> SYSTEM_GESTURE_EXCLUSION_RECT =
|
||||
Collections.singletonList(new Rect());
|
||||
|
||||
private static final FloatProperty<TaskView> FOCUS_TRANSITION =
|
||||
public static final FloatProperty<TaskView> FOCUS_TRANSITION =
|
||||
new FloatProperty<TaskView>("focusTransition") {
|
||||
@Override
|
||||
public void setValue(TaskView taskView, float v) {
|
||||
@@ -335,6 +335,19 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
}
|
||||
};
|
||||
|
||||
public static final FloatProperty<TaskView> SNAPSHOT_SCALE =
|
||||
new FloatProperty<TaskView>("snapshotScale") {
|
||||
@Override
|
||||
public void setValue(TaskView taskView, float v) {
|
||||
taskView.setSnapshotScale(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(TaskView taskView) {
|
||||
return taskView.mSnapshotView.getScaleX();
|
||||
}
|
||||
};
|
||||
|
||||
private final TaskOutlineProvider mOutlineProvider;
|
||||
|
||||
private Task mTask;
|
||||
@@ -523,8 +536,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
return mTask;
|
||||
}
|
||||
|
||||
public boolean hasTaskId(int taskId) {
|
||||
return mTask != null && mTask.key != null && mTask.key.id == taskId;
|
||||
public int getTaskId() {
|
||||
return mTask != null && mTask.key != null ? mTask.key.id : -1;
|
||||
}
|
||||
|
||||
public TaskThumbnailView getThumbnail() {
|
||||
@@ -846,6 +859,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
mSplitSelectTranslationX = 0f;
|
||||
mDismissTranslationY = mTaskOffsetTranslationY = mTaskResistanceTranslationY =
|
||||
mSplitSelectTranslationY = 0f;
|
||||
setSnapshotScale(1f);
|
||||
applyTranslationX();
|
||||
applyTranslationY();
|
||||
setTranslationZ(0);
|
||||
@@ -925,6 +939,9 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
if (mActivity.getDeviceProfile().isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get()) {
|
||||
setPivotX(getLayoutDirection() == LAYOUT_DIRECTION_RTL ? 0 : right - left);
|
||||
setPivotY(mSnapshotView.getTop());
|
||||
mSnapshotView.setPivotX(
|
||||
getLayoutDirection() == LAYOUT_DIRECTION_RTL ? 0 : right - left);
|
||||
mSnapshotView.setPivotY(0);
|
||||
} else {
|
||||
setPivotX((right - left) * 0.5f);
|
||||
setPivotY(mSnapshotView.getTop() + mSnapshotView.getHeight() * 0.5f);
|
||||
@@ -955,6 +972,11 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
return mFullscreenScale;
|
||||
}
|
||||
|
||||
private void setSnapshotScale(float dismissScale) {
|
||||
mSnapshotView.setScaleX(dismissScale);
|
||||
mSnapshotView.setScaleY(dismissScale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves TaskView between carousel and 2 row grid.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user