summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin <kevhan@google.com>2019-04-23 15:00:41 -0700
committerKevin <kevhan@google.com>2019-04-25 17:43:48 -0700
commita4949471bed4c6fc8bcedb35a3bcc99df2d8e149 (patch)
treed2edbf5bd39de38683f7b582956c764cd1f370fc
parentefe84750930e369763d73a76c647695d7e600bee (diff)
downloadandroid_packages_apps_Trebuchet-a4949471bed4c6fc8bcedb35a3bcc99df2d8e149.tar.gz
android_packages_apps_Trebuchet-a4949471bed4c6fc8bcedb35a3bcc99df2d8e149.tar.bz2
android_packages_apps_Trebuchet-a4949471bed4c6fc8bcedb35a3bcc99df2d8e149.zip
Rotate thumbnail view based off device orientation
In landscape mode, recents thumbnails should be shown horizontally, so this CL modifies the custom view so that it resizes to display a horizontal snapshot. Bug: 114136250 Bug: 131095241 Test: Rotate recents, see view width change appropriately Change-Id: Ic3d8d039535c673567d19c372da211d177691a81
-rw-r--r--go/quickstep/src/com/android/quickstep/views/TaskThumbnailIconView.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/go/quickstep/src/com/android/quickstep/views/TaskThumbnailIconView.java b/go/quickstep/src/com/android/quickstep/views/TaskThumbnailIconView.java
index b1c60dd97..0bad77b60 100644
--- a/go/quickstep/src/com/android/quickstep/views/TaskThumbnailIconView.java
+++ b/go/quickstep/src/com/android/quickstep/views/TaskThumbnailIconView.java
@@ -16,6 +16,9 @@
package com.android.quickstep.views;
+import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
+import static android.view.View.MeasureSpec.makeMeasureSpec;
+
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
@@ -53,15 +56,20 @@ final class TaskThumbnailIconView extends ViewGroup {
int width = height;
setMeasuredDimension(width, height);
+
int subItemSize = (int) (SUBITEM_FRAME_RATIO * height);
if (mThumbnailView.getVisibility() != GONE) {
- int thumbnailHeightSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
- int thumbnailWidthSpec = MeasureSpec.makeMeasureSpec(subItemSize, MeasureSpec.EXACTLY);
+ boolean isPortrait =
+ (getResources().getConfiguration().orientation == ORIENTATION_PORTRAIT);
+ int thumbnailHeightSpec =
+ makeMeasureSpec(isPortrait ? height : subItemSize, MeasureSpec.EXACTLY);
+ int thumbnailWidthSpec =
+ makeMeasureSpec(isPortrait ? subItemSize : width, MeasureSpec.EXACTLY);
measureChild(mThumbnailView, thumbnailWidthSpec, thumbnailHeightSpec);
}
if (mIconView.getVisibility() != GONE) {
- int iconHeightSpec = MeasureSpec.makeMeasureSpec(subItemSize, MeasureSpec.EXACTLY);
- int iconWidthSpec = MeasureSpec.makeMeasureSpec(subItemSize, MeasureSpec.EXACTLY);
+ int iconHeightSpec = makeMeasureSpec(subItemSize, MeasureSpec.EXACTLY);
+ int iconWidthSpec = makeMeasureSpec(subItemSize, MeasureSpec.EXACTLY);
measureChild(mIconView, iconWidthSpec, iconHeightSpec);
}
}