summaryrefslogtreecommitdiffstats
path: root/go/quickstep
diff options
context:
space:
mode:
authorKevin <kevhan@google.com>2019-05-02 13:27:49 -0700
committerKevin <kevhan@google.com>2019-05-02 13:40:18 -0700
commitb731c07e0463f37c63d34b39eed329decac1a931 (patch)
tree24ed79450ff79aa3c9794d8dcf9dcf143f6ec7da /go/quickstep
parentd16f87f52d969578613abb3f17ed960ff1fefc56 (diff)
downloadandroid_packages_apps_Trebuchet-b731c07e0463f37c63d34b39eed329decac1a931.tar.gz
android_packages_apps_Trebuchet-b731c07e0463f37c63d34b39eed329decac1a931.tar.bz2
android_packages_apps_Trebuchet-b731c07e0463f37c63d34b39eed329decac1a931.zip
Check orientation changes on task item attaching
onConfigurationChanged is only passed down to views that are currently attached. Naturally, a recycler view has some views in its pool that are not attached and thus do not get the call when the orientation changes. When this happens and the view is then attached later, it can be in an incorrect orientation. To fix this, we save the current orientation the task item is using and check on attaching if it's still the same as the orientation the device is in. If it isn't we then run the orientation change logic. Bug: 131848689 Fix: 131848689 Test: Change orientation with some views not attached, see that they are correct orientation when attached Change-Id: I3dec501c332338444e321b4a50876c7840a5bc6e
Diffstat (limited to 'go/quickstep')
-rw-r--r--go/quickstep/src/com/android/quickstep/views/TaskItemView.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/go/quickstep/src/com/android/quickstep/views/TaskItemView.java b/go/quickstep/src/com/android/quickstep/views/TaskItemView.java
index a5f572898..6db801322 100644
--- a/go/quickstep/src/com/android/quickstep/views/TaskItemView.java
+++ b/go/quickstep/src/com/android/quickstep/views/TaskItemView.java
@@ -49,6 +49,7 @@ public final class TaskItemView extends LinearLayout {
private ImageView mIconView;
private ImageView mThumbnailView;
private float mContentTransitionProgress;
+ private int mDisplayedOrientation;
/**
* Property representing the content transition progress of the view. 1.0f represents that the
@@ -179,13 +180,27 @@ public final class TaskItemView extends LinearLayout {
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ onOrientationChanged(getResources().getConfiguration().orientation);
+ }
+
+ @Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
+ onOrientationChanged(newConfig.orientation);
+ }
+
+ private void onOrientationChanged(int newOrientation) {
+ if (mDisplayedOrientation == newOrientation) {
+ return;
+ }
+ mDisplayedOrientation = newOrientation;
int layerCount = mThumbnailDrawable.getNumberOfLayers();
for (int i = 0; i < layerCount; i++) {
Drawable drawable = mThumbnailDrawable.getDrawable(i);
if (drawable instanceof ThumbnailDrawable) {
- ((ThumbnailDrawable) drawable).setRequestedOrientation(newConfig.orientation);
+ ((ThumbnailDrawable) drawable).setRequestedOrientation(newOrientation);
}
}
mTaskIconThumbnailView.forceLayout();