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

Commit 2ca2d58e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "frameworks/base: Reginal requirement for RTL"

parents ba57d3a4 ecf8c6d2
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.animation.StateListAnimator;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.pm.ApplicationInfo;
import android.content.ClipData;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -6874,7 +6875,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    @ResolvedLayoutDir
    public int getLayoutDirection() {
        final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion;
        if (targetSdkVersion < JELLY_BEAN_MR1) {
        if (targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp()) {
            mPrivateFlags2 |= PFLAG2_LAYOUT_DIRECTION_RESOLVED;
            return LAYOUT_DIRECTION_RESOLVED_DEFAULT;
        }
@@ -13044,7 +13045,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private boolean isRtlCompatibilityMode() {
        final int targetSdkVersion = getContext().getApplicationInfo().targetSdkVersion;
        return targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport();
        return targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp() || !hasRtlSupport();
    }
    /**
     * Return true if we are in a system app context.
     */
    private boolean isSystemApp() {
        return ((getContext().getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) != 0);
    }
    /**
+4 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.view;

import android.animation.LayoutTransition;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.TypedArray;
@@ -6635,8 +6636,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            }

            final boolean hasRtlSupport = c.getApplicationInfo().hasRtlSupport();
            final boolean isSystemApp = (c.getApplicationInfo().flags &
                    ApplicationInfo.FLAG_SYSTEM) != 0;
            final int targetSdkVersion = c.getApplicationInfo().targetSdkVersion;
            if (targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport) {
            if (targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp || !hasRtlSupport) {
                mMarginFlags |= RTL_COMPATIBILITY_MODE_MASK;
            }

+4 −0
Original line number Diff line number Diff line
@@ -2851,6 +2851,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
            mOldItemCount = mItemCount;
            mItemCount = mAdapter.getCount();
        }
        // Position the fast scroller of list view when rtl.
        if (isLayoutRtl() && mFastScroll != null) {
            mFastScroll.setScrollbarPosition(getVerticalScrollbarPosition());
        }
    }

    @Override
+5 −1
Original line number Diff line number Diff line
@@ -387,7 +387,11 @@ public class CheckedTextView extends TextView implements Checkable {
                right = width - mBasePadding;
                left = right - mCheckMarkWidth;
            }
            if (isLayoutRtl()) {
                checkMarkDrawable.setBounds( mScrollX + left, top, mScrollX + right, bottom);
            } else {
                checkMarkDrawable.setBounds( left, top, right, bottom);
            }
            checkMarkDrawable.draw(canvas);

            final Drawable background = getBackground();
+19 −18
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.widget;
import com.android.internal.R;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
@@ -283,7 +284,9 @@ public class ExpandableListView extends ListView {
     */
    private boolean isRtlCompatibilityMode() {
        final int targetSdkVersion = mContext.getApplicationInfo().targetSdkVersion;
        return targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport();
        final boolean isSystemApp = (mContext.getApplicationInfo().flags &
            ApplicationInfo.FLAG_SYSTEM) != 0;
        return targetSdkVersion < JELLY_BEAN_MR1 && !isSystemApp || !hasRtlSupport();
    }

    /**
@@ -416,27 +419,25 @@ public class ExpandableListView extends ListView {
            // the left & right bounds
            if (pos.position.type != lastItemType) {
                if (pos.position.type == ExpandableListPosition.CHILD) {
                    if (isLayoutRtl) {
                        indicatorRect.left = (mChildIndicatorLeft == CHILD_INDICATOR_INHERIT) ?
                                mRight - mIndicatorRight : mRight - mChildIndicatorRight;
                        indicatorRect.right = (mChildIndicatorRight == CHILD_INDICATOR_INHERIT) ?
                                mRight - mIndicatorLeft : mRight - mChildIndicatorLeft;
                    } else {
                        indicatorRect.left = (mChildIndicatorLeft == CHILD_INDICATOR_INHERIT) ?
                                mIndicatorLeft : mChildIndicatorLeft;
                        indicatorRect.right = (mChildIndicatorRight == CHILD_INDICATOR_INHERIT) ?
                                mIndicatorRight : mChildIndicatorRight;
                } else {
                    indicatorRect.left = mIndicatorLeft;
                    indicatorRect.right = mIndicatorRight;
                    }

                if (isLayoutRtl) {
                    final int temp = indicatorRect.left;
                    indicatorRect.left = width - indicatorRect.right;
                    indicatorRect.right = width - temp;

                    indicatorRect.left -= mPaddingRight;
                    indicatorRect.right -= mPaddingRight;
                } else {
                    indicatorRect.left += mPaddingLeft;
                    indicatorRect.right += mPaddingLeft;
                    indicatorRect.left = isLayoutRtl ? (width - mIndicatorRight) : mIndicatorLeft;
                    indicatorRect.right = isLayoutRtl ? (width - mIndicatorLeft) : mIndicatorRight;
                }

                indicatorRect.left += isLayoutRtl ? -mPaddingRight : mPaddingLeft;
                indicatorRect.right += isLayoutRtl ? -mPaddingRight : mPaddingLeft;

                lastItemType = pos.position.type; 
            }

Loading