2d Recents: show full task thumbnail and don't overlap header
Bug: 32101881 Test: On local sw600dp, tested recents layout Change-Id: Ibc3bf720f7ae3303b6283707c8114643a0e8d0af
This commit is contained in:
@@ -148,7 +148,7 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
|
||||
private ArrayList<Animator> mTmpAnimators = new ArrayList<>();
|
||||
|
||||
@ViewDebug.ExportedProperty(deepExport=true, prefix="thumbnail_")
|
||||
TaskViewThumbnail mThumbnailView;
|
||||
protected TaskViewThumbnail mThumbnailView;
|
||||
@ViewDebug.ExportedProperty(deepExport=true, prefix="header_")
|
||||
TaskViewHeader mHeaderView;
|
||||
private View mActionButtonView;
|
||||
@@ -239,7 +239,7 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks
|
||||
/**
|
||||
* Update the task view when the configuration changes.
|
||||
*/
|
||||
void onConfigurationChanged() {
|
||||
protected void onConfigurationChanged() {
|
||||
mHeaderView.onConfigurationChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ public class TaskViewThumbnail extends View {
|
||||
@ViewDebug.ExportedProperty(category="recents")
|
||||
private float mThumbnailScale;
|
||||
private float mFullscreenThumbnailScale;
|
||||
private boolean mSizeToFit = false;
|
||||
private boolean mOverlayHeaderOnThumbnailActionBar = true;
|
||||
private ActivityManager.TaskThumbnailInfo mThumbnailInfo;
|
||||
|
||||
private int mCornerRadius;
|
||||
@@ -140,9 +142,10 @@ public class TaskViewThumbnail extends View {
|
||||
canvas.drawRoundRect(0, 0, viewWidth, viewHeight, mCornerRadius, mCornerRadius,
|
||||
mLockedPaint);
|
||||
} else if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) {
|
||||
int topOffset = mTaskBar != null
|
||||
? mTaskBar.getHeight() - mCornerRadius
|
||||
: 0;
|
||||
int topOffset = 0;
|
||||
if (mTaskBar != null && mOverlayHeaderOnThumbnailActionBar) {
|
||||
topOffset = mTaskBar.getHeight() - mCornerRadius;
|
||||
}
|
||||
|
||||
// Draw the background, there will be some small overdraw with the thumbnail
|
||||
if (thumbnailWidth < viewWidth) {
|
||||
@@ -238,7 +241,7 @@ public class TaskViewThumbnail extends View {
|
||||
// If we haven't measured or the thumbnail is invalid, skip the thumbnail drawing
|
||||
// and only draw the background color
|
||||
mThumbnailScale = 0f;
|
||||
} else if (isStackTask) {
|
||||
} else if (isStackTask && !mSizeToFit) {
|
||||
float invThumbnailScale = 1f / mFullscreenThumbnailScale;
|
||||
if (mDisplayOrientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
if (mThumbnailInfo.screenOrientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
@@ -270,6 +273,19 @@ public class TaskViewThumbnail extends View {
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets whether the thumbnail should be resized to fit the task view in all orientations. */
|
||||
public void setSizeToFit(boolean flag) {
|
||||
mSizeToFit = flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the header should overlap (and hide) the action bar in the thumbnail, or
|
||||
* be stacked just above it.
|
||||
*/
|
||||
public void setOverlayHeaderOnThumbnailActionBar(boolean flag) {
|
||||
mOverlayHeaderOnThumbnailActionBar = flag;
|
||||
}
|
||||
|
||||
/** Updates the clip rect based on the given task bar. */
|
||||
void updateClipToTaskBar(View taskBar) {
|
||||
mTaskBar = taskBar;
|
||||
|
||||
@@ -23,6 +23,10 @@ import com.android.systemui.recents.views.AnimateableViewBounds;
|
||||
import com.android.systemui.recents.views.TaskView;
|
||||
|
||||
public class GridTaskView extends TaskView {
|
||||
|
||||
/** The height, in pixels, of the header view. */
|
||||
private int mHeaderHeight;
|
||||
|
||||
public GridTaskView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -37,6 +41,18 @@ public class GridTaskView extends TaskView {
|
||||
|
||||
public GridTaskView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
mHeaderHeight = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.recents_task_view_header_height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
// Show the full thumbnail and don't overlap with the header.
|
||||
mThumbnailView.setSizeToFit(true);
|
||||
mThumbnailView.setOverlayHeaderOnThumbnailActionBar(false);
|
||||
mThumbnailView.updateThumbnailScale();
|
||||
mThumbnailView.setTranslationY(mHeaderHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,4 +60,12 @@ public class GridTaskView extends TaskView {
|
||||
return new AnimateableGridViewBounds(this, mContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.recents_task_view_shadow_rounded_corners_radius));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged() {
|
||||
super.onConfigurationChanged();
|
||||
mHeaderHeight = mContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.recents_task_view_header_height);
|
||||
mThumbnailView.setTranslationY(mHeaderHeight);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user