summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/qsb
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2017-09-19 14:43:17 -0700
committerJon Miranda <jonmiranda@google.com>2017-09-19 14:43:17 -0700
commit6bed350b75ad407ba85ae15d62551194dd0a69d4 (patch)
tree363c2c2169a60199342422f1848bab283c41c2d0 /src/com/android/launcher3/qsb
parentd926a9316f61a7540b00ecd42acba8013e715f92 (diff)
downloadpackages_apps_Trebuchet-6bed350b75ad407ba85ae15d62551194dd0a69d4.tar.gz
packages_apps_Trebuchet-6bed350b75ad407ba85ae15d62551194dd0a69d4.tar.bz2
packages_apps_Trebuchet-6bed350b75ad407ba85ae15d62551194dd0a69d4.zip
Fix bug where widgets are inflated in the wrong orientation.
The bug is that in onResume, the context may tell us the wrong orientation. As a workaround, we store the orientation that the Launcher is created with, and we use that orientation to check whether we actually need to reinflate the widgets. Bug: 64916689 Change-Id: I5194debbd217a573d1f177c31d8c0abdf9da51b5
Diffstat (limited to 'src/com/android/launcher3/qsb')
-rw-r--r--src/com/android/launcher3/qsb/QsbContainerView.java4
-rw-r--r--src/com/android/launcher3/qsb/QsbWidgetHostView.java4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/com/android/launcher3/qsb/QsbContainerView.java b/src/com/android/launcher3/qsb/QsbContainerView.java
index d26f9f646..27a07c217 100644
--- a/src/com/android/launcher3/qsb/QsbContainerView.java
+++ b/src/com/android/launcher3/qsb/QsbContainerView.java
@@ -36,6 +36,7 @@ import android.widget.FrameLayout;
import com.android.launcher3.AppWidgetResizeFrame;
import com.android.launcher3.InvariantDeviceProfile;
+import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -193,7 +194,8 @@ public class QsbContainerView extends FrameLayout {
@Override
public void onResume() {
super.onResume();
- if (mQsb != null && mQsb.isReinflateRequired()) {
+ int orientation = Launcher.getLauncher(getContext()).getOrientation();
+ if (mQsb != null && mQsb.isReinflateRequired(orientation)) {
rebindFragment();
}
}
diff --git a/src/com/android/launcher3/qsb/QsbWidgetHostView.java b/src/com/android/launcher3/qsb/QsbWidgetHostView.java
index 8b6fa1651..a8a41f664 100644
--- a/src/com/android/launcher3/qsb/QsbWidgetHostView.java
+++ b/src/com/android/launcher3/qsb/QsbWidgetHostView.java
@@ -47,9 +47,9 @@ public class QsbWidgetHostView extends AppWidgetHostView {
}
- public boolean isReinflateRequired() {
+ public boolean isReinflateRequired(int orientation) {
// Re-inflate is required if the orientation has changed since last inflation.
- return mPreviousOrientation != getResources().getConfiguration().orientation;
+ return mPreviousOrientation != orientation;
}