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

Commit 380edb9e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Resource ID support for view inspector"

parents 710cd3fa e8914812
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -53562,6 +53562,7 @@ package android.view.inspector {
    method public int mapIntFlag(@NonNull String, @AttrRes int, @NonNull android.view.inspector.IntFlagMapping);
    method public int mapLong(@NonNull String, @AttrRes int);
    method public int mapObject(@NonNull String, @AttrRes int);
    method public int mapResourceId(@NonNull String, @AttrRes int);
    method public int mapShort(@NonNull String, @AttrRes int);
  }
@@ -53584,6 +53585,7 @@ package android.view.inspector {
    method public void readIntFlag(int, int);
    method public void readLong(int, long);
    method public void readObject(int, @Nullable Object);
    method public void readResourceId(int, @AnyRes int);
    method public void readShort(int, short);
  }
+1 −0
Original line number Diff line number Diff line
@@ -3061,6 +3061,7 @@ package android.view.inspector {
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_ENUM;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_FLAG;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType NONE;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType RESOURCE_ID;
  }

}
+12 −1
Original line number Diff line number Diff line
@@ -233,6 +233,17 @@ public @interface InspectableProperty {
         * @hide
         */
        @TestApi
        GRAVITY
        GRAVITY,

        /**
         * Value is a resource ID
         *
         * This type is inferred from the presence of a resource ID annotation such as
         * {@link android.annotation.AnyRes}.
         *
         * @hide
         */
        @TestApi
        RESOURCE_ID
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -156,6 +156,16 @@ public interface PropertyMapper {
            @AttrRes int attributeId,
            @NonNull IntEnumMapping mapping);

    /**
     * Map a string name to an integer ID for an attribute that contains resource IDs.
     *
     * @param name The name of the property
     * @param attributeId If the property is from an XML attribute, the resource ID of the property
     * @return An integer ID for the property
     * @throws PropertyConflictException If the property name is already mapped as another type.
     */
    int mapResourceId(@NonNull String name, @AttrRes int attributeId);

    /**
     * Map a string name to an integer ID for a flag set packed into an int property.
     *
+13 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view.inspector;

import android.annotation.AnyRes;
import android.annotation.ColorInt;
import android.annotation.ColorLong;
import android.annotation.NonNull;
@@ -150,7 +151,7 @@ public interface PropertyReader {
    void readColor(int id, @Nullable Color value);

    /**
     * Read {@link android.view.Gravity} packed into an primitive {int}.
     * Read {@link android.view.Gravity} packed into an primitive {@code int}.
     *
     * @param id Identifier of the property from a {@link PropertyMapper}
     * @param value Value of the property
@@ -159,7 +160,7 @@ public interface PropertyReader {
    void readGravity(int id, int value);

    /**
     * Read an enumeration packed into a primitive {int}.
     * Read an enumeration packed into a primitive {@code int}.
     *
     * @param id Identifier of the property from a {@link PropertyMapper}
     * @param value Value of the property
@@ -168,7 +169,7 @@ public interface PropertyReader {
    void readIntEnum(int id, int value);

    /**
     * Read a flag packed into a primitive {int}.
     * Read a flag packed into a primitive {@code int}.
     *
     * @param id Identifier of the property from a {@link PropertyMapper}
     * @param value Value of the property
@@ -176,6 +177,15 @@ public interface PropertyReader {
     */
    void readIntFlag(int id, int value);

    /**
     * Read an integer that contains a resource ID.
     *
     * @param id Identifier of the property from a {@link PropertyMapper}
     * @param value Value of the property
     * @throws PropertyTypeMismatchException If the property ID is not mapped as a resource ID.
     */
    void readResourceId(int id, @AnyRes int value);

    /**
     * Thrown if a client calls a typed read method for a property of a different type.
     */
Loading