field public static final int autoUrlDetect = 16843404; // 0x101028c
field public static final int autoVerify = 16844014; // 0x10104ee
field public static final int autofillHints = 16844121; // 0x1010559
+ field public static final int autofilledHighlight = 16844139; // 0x101056b
field public static final int background = 16842964; // 0x10100d4
field public static final int backgroundDimAmount = 16842802; // 0x1010032
field public static final int backgroundDimEnabled = 16843295; // 0x101021f
field public static final int alert_light_frame = 17301505; // 0x1080001
field public static final int arrow_down_float = 17301506; // 0x1080002
field public static final int arrow_up_float = 17301507; // 0x1080003
- field public static final int autofilled_highlight = 17301684; // 0x10800b4
field public static final int bottom_bar = 17301658; // 0x108009a
field public static final int btn_default = 17301508; // 0x1080004
field public static final int btn_default_small = 17301509; // 0x1080005
field public static final int autoUrlDetect = 16843404; // 0x101028c
field public static final int autoVerify = 16844014; // 0x10104ee
field public static final int autofillHints = 16844121; // 0x1010559
+ field public static final int autofilledHighlight = 16844139; // 0x101056b
field public static final int background = 16842964; // 0x10100d4
field public static final int backgroundDimAmount = 16842802; // 0x1010032
field public static final int backgroundDimEnabled = 16843295; // 0x101021f
field public static final int alert_light_frame = 17301505; // 0x1080001
field public static final int arrow_down_float = 17301506; // 0x1080002
field public static final int arrow_up_float = 17301507; // 0x1080003
- field public static final int autofilled_highlight = 17301684; // 0x10800b4
field public static final int bottom_bar = 17301658; // 0x108009a
field public static final int btn_default = 17301508; // 0x1080004
field public static final int btn_default_small = 17301509; // 0x1080005
field public static final int autoUrlDetect = 16843404; // 0x101028c
field public static final int autoVerify = 16844014; // 0x10104ee
field public static final int autofillHints = 16844121; // 0x1010559
+ field public static final int autofilledHighlight = 16844139; // 0x101056b
field public static final int background = 16842964; // 0x10100d4
field public static final int backgroundDimAmount = 16842802; // 0x1010032
field public static final int backgroundDimEnabled = 16843295; // 0x101021f
field public static final int alert_light_frame = 17301505; // 0x1080001
field public static final int arrow_down_float = 17301506; // 0x1080002
field public static final int arrow_up_float = 17301507; // 0x1080003
- field public static final int autofilled_highlight = 17301684; // 0x10800b4
field public static final int bottom_bar = 17301658; // 0x108009a
field public static final int btn_default = 17301508; // 0x1080004
field public static final int btn_default_small = 17301509; // 0x1080005
public static final int LAST_APP_ACCESSIBILITY_ID = Integer.MAX_VALUE / 2;
/**
+ * Attribute to find the autofilled highlight
+ *
+ * @see #getAutofilledDrawable()
+ */
+ private static final int[] AUTOFILL_HIGHLIGHT_ATTR =
+ new int[]{android.R.attr.autofilledHighlight};
+
+ /**
* Signals that compatibility booleans have been initialized according to
* target SDK versions.
*/
* <p>See {@link #autofill(AutofillValue)} and
* {@link #onProvideAutofillVirtualStructure(ViewStructure, int)} for more info.
* <p>To indicate that a virtual view was autofilled
- * <code>@android:drawable/autofilled_highlight</code> should be drawn over it until the data
+ * <code>?android:attr/autofilledHighlight</code> should be drawn over it until the data
* changes.
*
* @param values map of values to be autofilled, keyed by virtual child id.
+ *
+ * @attr ref android.R.styleable#Theme_autofilledHighlight
*/
public void autofill(@NonNull @SuppressWarnings("unused") SparseArray<AutofillValue> values) {
}
*
* @throws IllegalStateException if the drawable could not be found.
*/
- @NonNull private Drawable getAutofilledDrawable() {
+ @Nullable private Drawable getAutofilledDrawable() {
// Lazily load the isAutofilled drawable.
if (mAttachInfo.mAutofilledDrawable == null) {
- mAttachInfo.mAutofilledDrawable = mContext.getDrawable(R.drawable.autofilled_highlight);
-
- if (mAttachInfo.mAutofilledDrawable == null) {
- throw new IllegalStateException(
- "Could not find android:drawable/autofilled_highlight");
- }
+ TypedArray a = mContext.getTheme().obtainStyledAttributes(AUTOFILL_HIGHLIGHT_ATTR);
+ int attributeResourceId = a.getResourceId(0, 0);
+ mAttachInfo.mAutofilledDrawable = mContext.getDrawable(attributeResourceId);
+ a.recycle();
}
return mAttachInfo.mAutofilledDrawable;
if (isAutofilled()) {
Drawable autofilledHighlight = getAutofilledDrawable();
- autofilledHighlight.setBounds(0, 0, getWidth(), getHeight());
- autofilledHighlight.draw(canvas);
+ if (autofilledHighlight != null) {
+ autofilledHighlight.setBounds(0, 0, getWidth(), getHeight());
+ autofilledHighlight.draw(canvas);
+ }
}
}
mode. -->
<attr name="colorMultiSelectHighlight" format="color" />
+ <!-- Drawable to be drawn over the view to mark it as autofilled-->
+ <attr name="autofilledHighlight" format="reference" />
+
<!-- Default disabled alpha for widgets that set enabled/disabled alpha programmatically. -->
<attr name="disabledAlpha" format="float" />
<!-- The alpha applied to the foreground color to create the primary text color. -->
<!-- @hide @SystemApi -->
<public name="requiredSystemPropertyValue" />
<public name="justificationMode" />
+ <public name="autofilledHighlight" />
</public-group>
<public-group type="style" first-id="0x010302e0">
<public name="autofill" />
</public-group>
- <public-group type="drawable" first-id="0x010800b4">
- <public name="autofilled_highlight" />
+ <public-group type="drawable" first-id="0x010800b5">
+ <!-- 0x010800b4 was removed -->
<public name="ic_picture_in_picture" />
</public-group>
<java-symbol type="attr" name="windowFixedHeightMinor" />
<java-symbol type="attr" name="accessibilityFocusedDrawable"/>
<java-symbol type="attr" name="isLightTheme"/>
+ <java-symbol type="attr" name="autofilledHighlight"/>
<java-symbol type="bool" name="action_bar_embed_tabs" />
<java-symbol type="bool" name="action_bar_expanded_action_views_exclusive" />
<!-- Accessibility focused drawable -->
<item name="accessibilityFocusedDrawable">@drawable/view_accessibility_focused</item>
+ <!-- Autofilled highlight drawable -->
+ <item name="autofilledHighlight">@drawable/autofilled_highlight</item>
+
<!-- Lighting and shadow properties -->
<item name="lightY">@dimen/light_y</item>
<item name="lightZ">@dimen/light_z</item>