diff options
| author | 2016-12-16 16:06:33 -0800 | |
|---|---|---|
| committer | 2016-12-16 18:02:35 -0800 | |
| commit | 5f61536cba19352e2833a35521f02b6618f804fd (patch) | |
| tree | 29b95b8db96a3b915d39e33bae59bf0474415e92 | |
| parent | 0f0ca8e136bc158d8d9fa57ec62f5b5831481fd0 (diff) | |
2d Recents: show full task thumbnail and don't overlap header
Bug: 32101881
Test: On local sw600dp, tested recents layout
Change-Id: Ibc3bf720f7ae3303b6283707c8114643a0e8d0af
3 files changed, 46 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 9b305151b703..2f4ad6a4d7ce 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -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(); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java index 780cbca3c2b3..01976bc1eee6 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java @@ -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; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskView.java index da14e2bdf50c..325e71a847b0 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskView.java @@ -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); + } } |