Focus running task in overview grid

- calculateTaskSize now returns the Rect for focused task
- Introduced calculateGridTaskSize for non-focused task, and translate non-focused tasks to fit the grid
- As Task Rect is now vertically centered, removed ClearAllButton's grid vertical translation
- When ClearAllButton is not shown (e.g. quickswitch), make sure ClearAllButton's scroll won't be used when page snapping. This happens when page scrolls are translated so they're negative.
- Added back ActionsView when task is focused below the TaskView, which become invisible as you scroll
- In Modal state, move the ActionsView down so it won't cover the TaskView

Bug: 175939487
Test: manual
Change-Id: Idfa94a51f856418adc0503cf04211dcb4b1814fe
This commit is contained in:
Alex Chau
2021-03-19 14:47:03 +00:00
parent 21dfadab76
commit dfde4d96ea
16 changed files with 353 additions and 129 deletions
@@ -18,6 +18,7 @@ package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import com.android.launcher3.BaseDraggingActivity;
@@ -70,13 +71,12 @@ public class OverviewModalTaskState extends OverviewState {
}
public static float[] getOverviewScaleAndOffsetForModalState(BaseDraggingActivity activity) {
Rect out = new Rect();
activity.<RecentsView>getOverviewPanel().getTaskSize(out);
int taskHeight = out.height();
activity.<RecentsView>getOverviewPanel().getModalTaskSize(out);
int newHeight = out.height();
Point taskSize = activity.<RecentsView>getOverviewPanel().getSelectedTaskSize();
Rect modalTaskSize = new Rect();
activity.<RecentsView>getOverviewPanel().getModalTaskSize(modalTaskSize);
float scale = (float) newHeight / taskHeight;
float scale = Math.min((float) modalTaskSize.height() / taskSize.y,
(float) modalTaskSize.width() / taskSize.x);
return new float[] {scale, NO_OFFSET};
}