Use PersistedTaskSnapshotData to calculate TaskView size
- Disabled variable width for running task, as PersistedTaskSnapshotData is not always up to date for current task after rotating the device Bug: 174464656 Test: Test tablet overview with different comination of portrait/landscape wide/narrow thumbnails in portrait/landscape Change-Id: Ifa01e72020ccaf422e3975b092462de85fa19efd
This commit is contained in:
1 parent
8dd4ddc7ae
commit
3a06568d8b
4 files changed
+18
-39
No files matched your search
@@ -48,6 +48,7 @@ import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -449,7 +450,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
cancelPendingLoadTasks();
|
||||
mTask = task;
|
||||
mSnapshotView.bind(task);
|
||||
updateTaskSize();
|
||||
setOrientationState(orientedState);
|
||||
}
|
||||
|
||||
@@ -457,6 +457,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
return mTask;
|
||||
}
|
||||
|
||||
public boolean hasTaskId(int taskId) {
|
||||
return mTask != null && mTask.key != null && mTask.key.id == taskId;
|
||||
}
|
||||
|
||||
public TaskThumbnailView getThumbnail() {
|
||||
return mSnapshotView;
|
||||
}
|
||||
@@ -1077,9 +1081,11 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
previewPositionHelper);
|
||||
}
|
||||
|
||||
void updateTaskSize() {
|
||||
void updateTaskSize(boolean variableWidth) {
|
||||
ViewGroup.LayoutParams params = getLayoutParams();
|
||||
if (mActivity.getDeviceProfile().isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get()) {
|
||||
float thumbnailRatio = mTask != null ? mTask.getVisibleThumbnailRatio() : 0f;
|
||||
if (variableWidth && mActivity.getDeviceProfile().isTablet
|
||||
&& FeatureFlags.ENABLE_OVERVIEW_GRID.get() && thumbnailRatio != 0f) {
|
||||
final int thumbnailPadding = (int) getResources().getDimension(
|
||||
R.dimen.task_thumbnail_top_margin);
|
||||
|
||||
@@ -1087,7 +1093,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
int taskWidth = lastComputedTaskSize.width();
|
||||
int taskHeight = lastComputedTaskSize.height();
|
||||
int boxLength = Math.max(taskWidth, taskHeight);
|
||||
float thumbnailRatio = mSnapshotView.getThumbnailRatio();
|
||||
|
||||
int expectedWidth;
|
||||
int expectedHeight;
|
||||
|
||||
Reference in new issue
Block a user