summaryrefslogtreecommitdiffstats
path: root/go/quickstep
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-04-26 00:57:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-26 00:57:58 +0000
commitf5ef0be08dbca0937556c1c11479202ff6940b35 (patch)
tree1ff511ab784b6c608ba6d1fabe78123b029b7013 /go/quickstep
parentb6b7952d12429df5af50c2d66f9153c38d5e7f98 (diff)
parenta4949471bed4c6fc8bcedb35a3bcc99df2d8e149 (diff)
downloadandroid_packages_apps_Trebuchet-f5ef0be08dbca0937556c1c11479202ff6940b35.tar.gz
android_packages_apps_Trebuchet-f5ef0be08dbca0937556c1c11479202ff6940b35.tar.bz2
android_packages_apps_Trebuchet-f5ef0be08dbca0937556c1c11479202ff6940b35.zip
Merge "Rotate thumbnail view based off device orientation" into ub-launcher3-qt-dev
Diffstat (limited to 'go/quickstep')
-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);
}
}