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

Commit 99a238ad authored by Phil Weaver's avatar Phil Weaver Committed by Android (Google) Code Review
Browse files

Merge "Move accessibilityHeader from TextView to View" into pi-dev

parents 3fb64f7f 11fa7184
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -47613,6 +47613,7 @@ package android.view {
    method public void invalidateDrawable(android.graphics.drawable.Drawable);
    method public void invalidateOutline();
    method public boolean isAccessibilityFocused();
    method public boolean isAccessibilityHeading();
    method public boolean isActivated();
    method public boolean isAttachedToWindow();
    method public boolean isClickable();
@@ -47774,6 +47775,7 @@ package android.view {
    method public void sendAccessibilityEvent(int);
    method public void sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent);
    method public void setAccessibilityDelegate(android.view.View.AccessibilityDelegate);
    method public void setAccessibilityHeading(boolean);
    method public void setAccessibilityLiveRegion(int);
    method public void setAccessibilityPaneTitle(java.lang.CharSequence);
    method public void setAccessibilityTraversalAfter(int);
@@ -53849,7 +53851,6 @@ package android.widget {
    method public android.graphics.Typeface getTypeface();
    method public android.text.style.URLSpan[] getUrls();
    method public boolean hasSelection();
    method public boolean isAccessibilityHeading();
    method public boolean isAllCaps();
    method public boolean isCursorVisible();
    method public boolean isElegantTextHeight();
@@ -53872,7 +53873,6 @@ package android.widget {
    method protected void onTextChanged(java.lang.CharSequence, int, int, int);
    method public boolean onTextContextMenuItem(int);
    method public void removeTextChangedListener(android.text.TextWatcher);
    method public void setAccessibilityHeading(boolean);
    method public void setAllCaps(boolean);
    method public final void setAutoLinkMask(int);
    method public void setAutoSizeTextTypeUniformWithConfiguration(int, int, int, int);
+39 −4
Original line number Diff line number Diff line
@@ -697,6 +697,7 @@ import java.util.function.Predicate;
 * security policy. See also {@link MotionEvent#FLAG_WINDOW_IS_OBSCURED}.
 * </p>
 *
 * @attr ref android.R.styleable#View_accessibilityHeading
 * @attr ref android.R.styleable#View_alpha
 * @attr ref android.R.styleable#View_background
 * @attr ref android.R.styleable#View_clickable
@@ -2955,7 +2956,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *     1                             PFLAG3_SCREEN_READER_FOCUSABLE
     *    1                              PFLAG3_AGGREGATED_VISIBLE
     *   1                               PFLAG3_AUTOFILLID_EXPLICITLY_SET
     *  1                                available
     *  1                                PFLAG3_ACCESSIBILITY_HEADING
     * |-------|-------|-------|-------|
     */
@@ -3252,6 +3253,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private static final int PFLAG3_AUTOFILLID_EXPLICITLY_SET = 0x40000000;
    /**
     * Indicates if the View is a heading for accessibility purposes
     */
    private static final int PFLAG3_ACCESSIBILITY_HEADING = 0x80000000;
    /* End of masks for mPrivateFlags3 */
    /**
@@ -5475,6 +5481,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                case R.styleable.View_outlineAmbientShadowColor:
                    setOutlineAmbientShadowColor(a.getColor(attr, Color.BLACK));
                    break;
                case com.android.internal.R.styleable.View_accessibilityHeading:
                    setAccessibilityHeading(a.getBoolean(attr, false));
            }
        }
@@ -8795,6 +8803,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        info.addAction(AccessibilityAction.ACTION_SHOW_ON_SCREEN);
        populateAccessibilityNodeInfoDrawingOrderInParent(info);
        info.setPaneTitle(mAccessibilityPaneTitle);
        info.setHeading(isAccessibilityHeading());
    }
    /**
@@ -10782,11 +10791,37 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *                              accessibility tools.
     */
    public void setScreenReaderFocusable(boolean screenReaderFocusable) {
        updatePflags3AndNotifyA11yIfChanged(PFLAG3_SCREEN_READER_FOCUSABLE, screenReaderFocusable);
    }
    /**
     * Gets whether this view is a heading for accessibility purposes.
     *
     * @return {@code true} if the view is a heading, {@code false} otherwise.
     *
     * @attr ref android.R.styleable#View_accessibilityHeading
     */
    public boolean isAccessibilityHeading() {
        return (mPrivateFlags3 & PFLAG3_ACCESSIBILITY_HEADING) != 0;
    }
    /**
     * Set if view is a heading for a section of content for accessibility purposes.
     *
     * @param isHeading {@code true} if the view is a heading, {@code false} otherwise.
     *
     * @attr ref android.R.styleable#View_accessibilityHeading
     */
    public void setAccessibilityHeading(boolean isHeading) {
        updatePflags3AndNotifyA11yIfChanged(PFLAG3_ACCESSIBILITY_HEADING, isHeading);
    }
    private void updatePflags3AndNotifyA11yIfChanged(int mask, boolean newValue) {
        int pflags3 = mPrivateFlags3;
        if (screenReaderFocusable) {
            pflags3 |= PFLAG3_SCREEN_READER_FOCUSABLE;
        if (newValue) {
            pflags3 |= mask;
        } else {
            pflags3 &= ~PFLAG3_SCREEN_READER_FOCUSABLE;
            pflags3 &= ~mask;
        }
        if (pflags3 != mPrivateFlags3) {
+0 −31
Original line number Diff line number Diff line
@@ -317,7 +317,6 @@ import java.util.function.Supplier;
 * @attr ref android.R.styleable#TextView_autoSizeMaxTextSize
 * @attr ref android.R.styleable#TextView_autoSizeStepGranularity
 * @attr ref android.R.styleable#TextView_autoSizePresetSizes
 * @attr ref android.R.styleable#TextView_accessibilityHeading
 */
@RemoteView
public class TextView extends View implements ViewTreeObserver.OnPreDrawListener {
@@ -417,7 +416,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    private int mCurTextColor;
    private int mCurHintTextColor;
    private boolean mFreezesText;
    private boolean mIsAccessibilityHeading;

    private Editable.Factory mEditableFactory = Editable.Factory.getInstance();
    private Spannable.Factory mSpannableFactory = Spannable.Factory.getInstance();
@@ -1294,8 +1292,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                case com.android.internal.R.styleable.TextView_lineHeight:
                    lineHeight = a.getDimensionPixelSize(attr, -1);
                    break;
                case com.android.internal.R.styleable.TextView_accessibilityHeading:
                    mIsAccessibilityHeading = a.getBoolean(attr, false);
            }
        }

@@ -5212,32 +5208,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        }
    }

    /**
     * Gets whether this view is a heading for accessibility purposes.
     *
     * @return {@code true} if the view is a heading, {@code false} otherwise.
     *
     * @attr ref android.R.styleable#TextView_accessibilityHeading
     */
    public boolean isAccessibilityHeading() {
        return mIsAccessibilityHeading;
    }

    /**
     * Set if view is a heading for a section of content for accessibility purposes.
     *
     * @param isHeading {@code true} if the view is a heading, {@code false} otherwise.
     *
     * @attr ref android.R.styleable#TextView_accessibilityHeading
     */
    public void setAccessibilityHeading(boolean isHeading) {
        if (isHeading != mIsAccessibilityHeading) {
            mIsAccessibilityHeading = isHeading;
            notifyViewAccessibilityStateChangedIfNeeded(
                    AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED);
        }
    }

    /**
     * Convenience method to append the specified text to the TextView's
     * display buffer, upgrading it to {@link android.widget.TextView.BufferType#EDITABLE}
@@ -10833,7 +10803,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        info.setText(getTextForAccessibility());
        info.setHintText(mHint);
        info.setShowingHintText(isShowingHint());
        info.setHeading(mIsAccessibilityHeading);

        if (mBufferType == BufferType.EDITABLE) {
            info.setEditable(true);
+3 −2
Original line number Diff line number Diff line
@@ -3089,6 +3089,9 @@
             See {@link android.view.View#setAccessibilityPaneTitle(CharSequence)} -->
        <attr name="accessibilityPaneTitle" format="string" />

        <!-- Whether or not this view is a heading for accessibility purposes. -->
        <attr name="accessibilityHeading" format="boolean"/>

        <!-- Sets the color of the spot shadow that is drawn when the view has a positive Z or
             elevation value.
             <p>
@@ -4956,8 +4959,6 @@
            <!-- Justification by stretching word spacing. -->
            <enum name="inter_word" value = "1" />
        </attr>
        <!-- Whether or not this view is a heading for accessibility purposes. -->
        <attr name="accessibilityHeading" format="boolean"/>
    </declare-styleable>
    <declare-styleable name="TextViewAppearance">
        <!-- Base text color, typeface, size, and style. -->