diff options
| author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-10-17 17:20:19 -0700 |
|---|---|---|
| committer | Fabrice Di Meglio <fdimeglio@google.com> | 2012-10-18 18:02:56 -0700 |
| commit | b003e28c1d65d06fcb5690ff2955d007d8f7a626 (patch) | |
| tree | 1a260bed0cc2499057ad1af31041a87158871ea7 /core/java/android/view | |
| parent | fc2652efedeaae40c4a3748a8de9ee833e1443e1 (diff) | |
| download | frameworks_base-b003e28c1d65d06fcb5690ff2955d007d8f7a626.zip frameworks_base-b003e28c1d65d06fcb5690ff2955d007d8f7a626.tar.gz frameworks_base-b003e28c1d65d06fcb5690ff2955d007d8f7a626.tar.bz2 | |
Fix bug #7367429 Popup window should get its direction from it Anchor View if it can
- set the popup layout direction depending on the anchor view's layout direction
(if not defined before)
- make first pass of ViewRootImpl.performTraversals() and configuration update
not override any layout direction that could have been set before
Change-Id: I8e86ca805f0caf52c058d06aa7861df56fb862e6
Diffstat (limited to 'core/java/android/view')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 7ce3042..02c97ae 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -317,6 +317,8 @@ public final class ViewRootImpl implements ViewParent, private final int mDensity; private final int mNoncompatDensity; + private int mViewLayoutDirectionInitial; + /** * Consistency verifier for debugging purposes. */ @@ -465,6 +467,7 @@ public final class ViewRootImpl implements ViewParent, synchronized (this) { if (mView == null) { mView = view; + mViewLayoutDirectionInitial = mView.getRawLayoutDirection(); mFallbackEventHandler.setView(view); mWindowAttributes.copyFrom(attrs); attrs = mWindowAttributes; @@ -1184,7 +1187,10 @@ public final class ViewRootImpl implements ViewParent, viewVisibilityChanged = false; mLastConfiguration.setTo(host.getResources().getConfiguration()); mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility; - host.setLayoutDirection(mLastConfiguration.getLayoutDirection()); + // Set the layout direction if it has not been set before (inherit is the default) + if (mViewLayoutDirectionInitial == View.LAYOUT_DIRECTION_INHERIT) { + host.setLayoutDirection(mLastConfiguration.getLayoutDirection()); + } host.dispatchAttachedToWindow(attachInfo, 0); mFitSystemWindowsInsets.set(mAttachInfo.mContentInsets); host.fitSystemWindows(mFitSystemWindowsInsets); @@ -2680,7 +2686,8 @@ public final class ViewRootImpl implements ViewParent, final int lastLayoutDirection = mLastConfiguration.getLayoutDirection(); final int currentLayoutDirection = config.getLayoutDirection(); mLastConfiguration.setTo(config); - if (lastLayoutDirection != currentLayoutDirection) { + if (lastLayoutDirection != currentLayoutDirection && + mViewLayoutDirectionInitial == View.LAYOUT_DIRECTION_INHERIT) { mView.setLayoutDirection(currentLayoutDirection); } mView.dispatchConfigurationChanged(config); |
