Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf12897c authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix bug #7363252 Popup and Dialog UI widgets should be RTL aware

- set the Configuration's layout direction in ViewRootImpl instead of PhoneWindow$DecorView
- then remove unecessary API on ListPopupWindow for passing the layout direction

Change-Id: Ia2c6e4aa8cb82aed9b088bc3b8004ea0a1ded1f3
parent 809bb404
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -28617,7 +28617,6 @@ package android.widget {
    method public void setHeight(int);
    method public void setHorizontalOffset(int);
    method public void setInputMethodMode(int);
    method public void setLayoutDirection(int);
    method public void setListSelector(android.graphics.drawable.Drawable);
    method public void setModal(boolean);
    method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);
+1 −2
Original line number Diff line number Diff line
@@ -16149,7 +16149,7 @@ package android.os {
  public class Looper {
    method public void dump(android.util.Printer, java.lang.String);
    method public static synchronized android.os.Looper getMainLooper();
    method public static android.os.Looper getMainLooper();
    method public java.lang.Thread getThread();
    method public static void loop();
    method public static android.os.Looper myLooper();
@@ -28617,7 +28617,6 @@ package android.widget {
    method public void setHeight(int);
    method public void setHorizontalOffset(int);
    method public void setInputMethodMode(int);
    method public void setLayoutDirection(int);
    method public void setListSelector(android.graphics.drawable.Drawable);
    method public void setModal(boolean);
    method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);
+6 −0
Original line number Diff line number Diff line
@@ -1182,6 +1182,7 @@ public final class ViewRootImpl implements ViewParent,
            viewVisibilityChanged = false;
            mLastConfiguration.setTo(host.getResources().getConfiguration());
            mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility;
            host.setLayoutDirection(mLastConfiguration.getLayoutDirection());
            host.dispatchAttachedToWindow(attachInfo, 0);
            mFitSystemWindowsInsets.set(mAttachInfo.mContentInsets);
            host.fitSystemWindows(mFitSystemWindowsInsets);
@@ -2684,7 +2685,12 @@ public final class ViewRootImpl implements ViewParent,
            // the one in them which may be newer.
            config = mView.getResources().getConfiguration();
            if (force || mLastConfiguration.diff(config) != 0) {
                final int lastLayoutDirection = mLastConfiguration.getLayoutDirection();
                final int currentLayoutDirection = config.getLayoutDirection();
                mLastConfiguration.setTo(config);
                if (lastLayoutDirection != currentLayoutDirection) {
                    mView.setLayoutDirection(currentLayoutDirection);
                }
                mView.dispatchConfigurationChanged(config);
            }
        }
+0 −1
Original line number Diff line number Diff line
@@ -1093,7 +1093,6 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
            mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
            mPopup.setListItemExpandMax(EXPAND_MAX);
        }
        mPopup.setLayoutDirection(getLayoutDirection());
        mPopup.show();
        mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
    }
+0 −17
Original line number Diff line number Diff line
@@ -1021,8 +1021,6 @@ public class ListPopupWindow {
                mDropDownList.setOnItemSelectedListener(mItemSelectedListener);
            }

            mDropDownList.setLayoutDirection(mLayoutDirection);

            dropDownView = mDropDownList;

            View hintView = mPromptView;
@@ -1131,21 +1129,6 @@ public class ListPopupWindow {
        return listContent + otherHeights;
    }

    /**
     * Set the layout direction for this popup. Should be a resolved direction as the
     * popup as no capacity to do the resolution on his own.
     *
     * @param layoutDirection One of {@link View#LAYOUT_DIRECTION_LTR},
     *   {@link View#LAYOUT_DIRECTION_RTL},
     *
     */
    public void setLayoutDirection(int layoutDirection) {
        mLayoutDirection = layoutDirection;
        if (mDropDownList != null) {
            mDropDownList.setLayoutDirection(mLayoutDirection);
        }
    }

    /**
     * <p>Wrapper class for a ListView. This wrapper can hijack the focus to
     * make sure the list uses the appropriate drawables and states when
Loading