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

Commit 98aec1c7 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Make layoutDirection API public

Change-Id: Ie125513e4ea72b33b42355dbc43f9b9b6d46d7eb
parent 62f24df5
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -593,6 +593,7 @@ package android {
    field public static final int layerType = 16843604; // 0x1010354
    field public static final int layout = 16842994; // 0x10100f2
    field public static final int layoutAnimation = 16842988; // 0x10100ec
    field public static final int layoutDirection = 16843689; // 0x10103a9
    field public static final int layout_above = 16843140; // 0x1010184
    field public static final int layout_alignBaseline = 16843142; // 0x1010186
    field public static final int layout_alignBottom = 16843146; // 0x101018a
@@ -614,10 +615,10 @@ package android {
    field public static final int layout_height = 16842997; // 0x10100f5
    field public static final int layout_margin = 16842998; // 0x10100f6
    field public static final int layout_marginBottom = 16843002; // 0x10100fa
    field public static final int layout_marginEnd = 16843692; // 0x10103ac
    field public static final int layout_marginEnd = 16843693; // 0x10103ad
    field public static final int layout_marginLeft = 16842999; // 0x10100f7
    field public static final int layout_marginRight = 16843001; // 0x10100f9
    field public static final int layout_marginStart = 16843691; // 0x10103ab
    field public static final int layout_marginStart = 16843692; // 0x10103ac
    field public static final int layout_marginTop = 16843000; // 0x10100f8
    field public static final int layout_row = 16843643; // 0x101037b
    field public static final int layout_rowSpan = 16843644; // 0x101037c
@@ -713,10 +714,10 @@ package android {
    field public static final int packageNames = 16843649; // 0x1010381
    field public static final int padding = 16842965; // 0x10100d5
    field public static final int paddingBottom = 16842969; // 0x10100d9
    field public static final int paddingEnd = 16843690; // 0x10103aa
    field public static final int paddingEnd = 16843691; // 0x10103ab
    field public static final int paddingLeft = 16842966; // 0x10100d6
    field public static final int paddingRight = 16842968; // 0x10100d8
    field public static final int paddingStart = 16843689; // 0x10103a9
    field public static final int paddingStart = 16843690; // 0x10103aa
    field public static final int paddingTop = 16842967; // 0x10100d7
    field public static final int panelBackground = 16842846; // 0x101005e
    field public static final int panelColorBackground = 16842849; // 0x1010061
@@ -7392,8 +7393,8 @@ package android.database.sqlite {
    ctor public SQLiteOpenHelper(android.content.Context, java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, int, android.database.DatabaseErrorHandler);
    method public synchronized void close();
    method public java.lang.String getDatabaseName();
    method public synchronized android.database.sqlite.SQLiteDatabase getReadableDatabase();
    method public synchronized android.database.sqlite.SQLiteDatabase getWritableDatabase();
    method public android.database.sqlite.SQLiteDatabase getReadableDatabase();
    method public android.database.sqlite.SQLiteDatabase getWritableDatabase();
    method public abstract void onCreate(android.database.sqlite.SQLiteDatabase);
    method public void onDowngrade(android.database.sqlite.SQLiteDatabase, int, int);
    method public void onOpen(android.database.sqlite.SQLiteDatabase);
@@ -23104,6 +23105,7 @@ package android.view {
    method public void buildDrawingCache(boolean);
    method public void buildLayer();
    method public boolean callOnClick();
    method public boolean canResolveLayoutDirection();
    method public boolean canScrollHorizontally(int);
    method public boolean canScrollVertically(int);
    method public void cancelLongPress();
@@ -23189,6 +23191,7 @@ package android.view {
    method public boolean getKeepScreenOn();
    method public android.view.KeyEvent.DispatcherState getKeyDispatcherState();
    method public int getLayerType();
    method public int getLayoutDirection();
    method public android.view.ViewGroup.LayoutParams getLayoutParams();
    method public final int getLeft();
    method protected float getLeftFadingEdgeStrength();
@@ -23218,6 +23221,8 @@ package android.view {
    method public final android.view.ViewParent getParent();
    method public float getPivotX();
    method public float getPivotY();
    method public int getResolvedLayoutDirection();
    method public int getResolvedLayoutDirection(android.graphics.drawable.Drawable);
    method public int getResolvedTextDirection();
    method public android.content.res.Resources getResources();
    method public final int getRight();
@@ -23285,7 +23290,9 @@ package android.view {
    method public boolean isHovered();
    method public boolean isInEditMode();
    method public boolean isInTouchMode();
    method protected static boolean isLayoutDirectionRtl(java.util.Locale);
    method public boolean isLayoutRequested();
    method public boolean isLayoutRtl();
    method public boolean isLongClickable();
    method public boolean isOpaque();
    method protected boolean isPaddingOffsetRequired();
@@ -23374,6 +23381,7 @@ package android.view {
    method public void requestLayout();
    method public boolean requestRectangleOnScreen(android.graphics.Rect);
    method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
    method public void resetResolvedLayoutDirection();
    method public void resetResolvedTextDirection();
    method public void resolvePadding();
    method public static int resolveSize(int, int);
@@ -23414,6 +23422,7 @@ package android.view {
    method public void setId(int);
    method public void setKeepScreenOn(boolean);
    method public void setLayerType(int, android.graphics.Paint);
    method public void setLayoutDirection(int);
    method public void setLayoutParams(android.view.ViewGroup.LayoutParams);
    method public final void setLeft(int);
    method public void setLongClickable(boolean);
@@ -23516,6 +23525,10 @@ package android.view {
    field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2
    field public static final int LAYER_TYPE_NONE = 0; // 0x0
    field public static final int LAYER_TYPE_SOFTWARE = 1; // 0x1
    field public static final int LAYOUT_DIRECTION_INHERIT = -2147483648; // 0x80000000
    field public static final int LAYOUT_DIRECTION_LOCALE = -1073741824; // 0xc0000000
    field public static final int LAYOUT_DIRECTION_LTR = 0; // 0x0
    field public static final int LAYOUT_DIRECTION_RTL = 1073741824; // 0x40000000
    field public static final int MEASURED_HEIGHT_STATE_SHIFT = 16; // 0x10
    field public static final int MEASURED_SIZE_MASK = 16777215; // 0xffffff
    field public static final int MEASURED_STATE_MASK = -16777216; // 0xff000000
@@ -23830,7 +23843,6 @@ package android.view {
    method public void requestDisallowInterceptTouchEvent(boolean);
    method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
    method public void requestTransparentRegion(android.view.View);
    method protected void resetResolvedLayoutDirection();
    method public void scheduleLayoutAnimation();
    method public void setAddStatesFromChildren(boolean);
    method public void setAlwaysDrawnWithCacheEnabled(boolean);
@@ -23868,6 +23880,7 @@ package android.view {
    ctor public ViewGroup.LayoutParams(android.content.Context, android.util.AttributeSet);
    ctor public ViewGroup.LayoutParams(int, int);
    ctor public ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams);
    method public void onResolveLayoutDirection(int);
    method protected void setBaseAttributes(android.content.res.TypedArray, int, int);
    field public static final deprecated int FILL_PARENT = -1; // 0xffffffff
    field public static final int MATCH_PARENT = -1; // 0xffffffff
+8 −26
Original line number Diff line number Diff line
@@ -956,28 +956,24 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    /**
     * Horizontal direction of this view is from Left to Right.
     * Use with {@link #setLayoutDirection}.
     * {@hide}
     */
    public static final int LAYOUT_DIRECTION_LTR = 0x00000000;
    /**
     * Horizontal direction of this view is from Right to Left.
     * Use with {@link #setLayoutDirection}.
     * {@hide}
     */
    public static final int LAYOUT_DIRECTION_RTL = 0x40000000;
    /**
     * Horizontal direction of this view is inherited from its parent.
     * Use with {@link #setLayoutDirection}.
     * {@hide}
     */
    public static final int LAYOUT_DIRECTION_INHERIT = 0x80000000;
    /**
     * Horizontal direction of this view is from deduced from the default language
     * script for the locale. Use with {@link #setLayoutDirection}.
     * {@hide}
     */
    public static final int LAYOUT_DIRECTION_LOCALE = 0xC0000000;
@@ -4833,8 +4829,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     *   {@link #LAYOUT_DIRECTION_INHERIT} or
     *   {@link #LAYOUT_DIRECTION_LOCALE}.
     * @attr ref android.R.styleable#View_layoutDirection
     *
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "layout", mapping = {
        @ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR,     to = "LTR"),
@@ -4856,8 +4850,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     *   {@link #LAYOUT_DIRECTION_LOCALE}.
     *
     * @attr ref android.R.styleable#View_layoutDirection
     *
     * @hide
     */
    @RemotableViewMethod
    public void setLayoutDirection(int layoutDirection) {
@@ -4873,8 +4865,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     *
     * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns
     * {@link #LAYOUT_DIRECTION_LTR} id the layout direction is not RTL.
     *
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "layout", mapping = {
        @ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR,     to = "RESOLVED_DIRECTION_LTR"),
@@ -4891,8 +4881,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * layout attribute and/or the inherited value from the parent.</p>
     *
     * @return true if the layout is right-to-left.
     *
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "layout")
    public boolean isLayoutRtl() {
@@ -9672,11 +9660,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    }
    /**
     * Return true if layout direction resolution can be done
     * Check if layout direction resolution can be done.
     *
     * @hide
     * @return true if layout direction resolution can be done otherwise return false.
     */
    protected boolean canResolveLayoutDirection() {
    public boolean canResolveLayoutDirection() {
        switch (getLayoutDirection()) {
            case LAYOUT_DIRECTION_INHERIT:
                return (mParent != null);
@@ -9691,23 +9679,19 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * Subclasses need to override this method to clear cached information that depends on the
     * resolved layout direction, or to inform child views that inherit their layout direction.
     * Overrides must also call the superclass implementation at the start of their implementation.
     *
     * @hide
     */
    protected void resetResolvedLayoutDirection() {
        // Reset the layout direction resolution
    public void resetResolvedLayoutDirection() {
        // Reset the current View resolution
        mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED;
        // Reset also the text direction
        resetResolvedTextDirection();
    }
    /**
     * Check if a Locale is corresponding to a RTL script.
     * Check if a Locale uses an RTL script.
     *
     * @param locale Locale to check
     * @return true if a Locale is corresponding to a RTL script.
     *
     * @hide
     * @return true if the Locale uses an RTL script.
     */
    protected static boolean isLayoutDirectionRtl(Locale locale) {
        return (LAYOUT_DIRECTION_RTL == LocaleUtil.getLayoutDirectionFromLocale(locale));
@@ -11865,8 +11849,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    * Return the layout direction of a given Drawable.
    *
    * @param who the Drawable to query
    *
    * @hide
    */
    public int getResolvedLayoutDirection(Drawable who) {
        return (who == mBGDrawable) ? getResolvedLayoutDirection() : LAYOUT_DIRECTION_DEFAULT;
@@ -13059,7 +13041,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        if (mParent != null) {
            if (mLayoutParams != null) {
                mLayoutParams.resolveWithDirection(getResolvedLayoutDirection());
                mLayoutParams.onResolveLayoutDirection(getResolvedLayoutDirection());
            }
            if (!mParent.isLayoutRequested()) {
                mParent.requestLayout();
+4 −8
Original line number Diff line number Diff line
@@ -4920,7 +4920,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    }

    @Override
    protected void resetResolvedLayoutDirection() {
    public void resetResolvedLayoutDirection() {
        super.resetResolvedLayoutDirection();

        // Take care of resetting the children resolution too
@@ -5123,10 +5123,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
         *
         * {@link View#LAYOUT_DIRECTION_LTR}
         * {@link View#LAYOUT_DIRECTION_RTL}
         *
         * @hide
         */
        protected void resolveWithDirection(int layoutDirection) {
        public void onResolveLayoutDirection(int layoutDirection) {
        }

        /**
@@ -5377,12 +5375,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager

        /**
         * This will be called by {@link android.view.View#requestLayout()}. Left and Right margins
         * maybe overriden depending on layout direction.
         *
         * @hide
         * may be overridden depending on layout direction.
         */
        @Override
        protected void resolveWithDirection(int layoutDirection) {
        public void onResolveLayoutDirection(int layoutDirection) {
            switch(layoutDirection) {
                case View.LAYOUT_DIRECTION_RTL:
                    leftMargin = (endMargin > DEFAULT_RELATIVE) ? endMargin : leftMargin;
+2 −0
Original line number Diff line number Diff line
@@ -3525,6 +3525,8 @@

  <public type="attr" name="textDirection"/>

  <public type="attr" name="layoutDirection" />

  <public type="attr" name="paddingStart"/>
  <public type="attr" name="paddingEnd"/>