Skip to content

Commit e9a33c6

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Fix bug #7363252 Popup and Dialog UI widgets should be RTL aware" into jb-mr1-dev
2 parents 161cfef + cf12897 commit e9a33c6

6 files changed

Lines changed: 6 additions & 22 deletions

File tree

api/17.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28617,7 +28617,6 @@ package android.widget {
2861728617
method public void setHeight(int);
2861828618
method public void setHorizontalOffset(int);
2861928619
method public void setInputMethodMode(int);
28620-
method public void setLayoutDirection(int);
2862128620
method public void setListSelector(android.graphics.drawable.Drawable);
2862228621
method public void setModal(boolean);
2862328622
method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);

api/current.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28619,7 +28619,6 @@ package android.widget {
2861928619
method public void setHeight(int);
2862028620
method public void setHorizontalOffset(int);
2862128621
method public void setInputMethodMode(int);
28622-
method public void setLayoutDirection(int);
2862328622
method public void setListSelector(android.graphics.drawable.Drawable);
2862428623
method public void setModal(boolean);
2862528624
method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);

core/java/android/view/ViewRootImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,7 @@ private void performTraversals() {
11841184
viewVisibilityChanged = false;
11851185
mLastConfiguration.setTo(host.getResources().getConfiguration());
11861186
mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility;
1187+
host.setLayoutDirection(mLastConfiguration.getLayoutDirection());
11871188
host.dispatchAttachedToWindow(attachInfo, 0);
11881189
mFitSystemWindowsInsets.set(mAttachInfo.mContentInsets);
11891190
host.fitSystemWindows(mFitSystemWindowsInsets);
@@ -2676,7 +2677,12 @@ void updateConfiguration(Configuration config, boolean force) {
26762677
// the one in them which may be newer.
26772678
config = mView.getResources().getConfiguration();
26782679
if (force || mLastConfiguration.diff(config) != 0) {
2680+
final int lastLayoutDirection = mLastConfiguration.getLayoutDirection();
2681+
final int currentLayoutDirection = config.getLayoutDirection();
26792682
mLastConfiguration.setTo(config);
2683+
if (lastLayoutDirection != currentLayoutDirection) {
2684+
mView.setLayoutDirection(currentLayoutDirection);
2685+
}
26802686
mView.dispatchConfigurationChanged(config);
26812687
}
26822688
}

core/java/android/widget/AutoCompleteTextView.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,6 @@ public void showDropDown() {
10931093
mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
10941094
mPopup.setListItemExpandMax(EXPAND_MAX);
10951095
}
1096-
mPopup.setLayoutDirection(getLayoutDirection());
10971096
mPopup.show();
10981097
mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
10991098
}

core/java/android/widget/ListPopupWindow.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,6 @@ public void onNothingSelected(AdapterView<?> parent) {
10211021
mDropDownList.setOnItemSelectedListener(mItemSelectedListener);
10221022
}
10231023

1024-
mDropDownList.setLayoutDirection(mLayoutDirection);
1025-
10261024
dropDownView = mDropDownList;
10271025

10281026
View hintView = mPromptView;
@@ -1131,21 +1129,6 @@ public void onNothingSelected(AdapterView<?> parent) {
11311129
return listContent + otherHeights;
11321130
}
11331131

1134-
/**
1135-
* Set the layout direction for this popup. Should be a resolved direction as the
1136-
* popup as no capacity to do the resolution on his own.
1137-
*
1138-
* @param layoutDirection One of {@link View#LAYOUT_DIRECTION_LTR},
1139-
* {@link View#LAYOUT_DIRECTION_RTL},
1140-
*
1141-
*/
1142-
public void setLayoutDirection(int layoutDirection) {
1143-
mLayoutDirection = layoutDirection;
1144-
if (mDropDownList != null) {
1145-
mDropDownList.setLayoutDirection(mLayoutDirection);
1146-
}
1147-
}
1148-
11491132
/**
11501133
* <p>Wrapper class for a ListView. This wrapper can hijack the focus to
11511134
* make sure the list uses the appropriate drawables and states when

policy/src/com/android/internal/policy/impl/PhoneWindow.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2867,8 +2867,6 @@ private void installDecor() {
28672867
mDecor = generateDecor();
28682868
mDecor.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
28692869
mDecor.setIsRootNamespace(true);
2870-
mDecor.setLayoutDirection(
2871-
getContext().getResources().getConfiguration().getLayoutDirection());
28722870
if (!mInvalidatePanelMenuPosted && mInvalidatePanelMenuFeatures != 0) {
28732871
mDecor.postOnAnimation(mInvalidatePanelMenuRunnable);
28742872
}

0 commit comments

Comments
 (0)