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

Commit 831f3ce9 authored by Deepanshu Gupta's avatar Deepanshu Gupta
Browse files

Add stub getThemeAttributeId() to BridgeTypedArray

The method is used to obtain theme attribute IDs for drawables for
caching.

The changeset also fixes some minor style issues found by code
inspection.

Change-Id: Ib5fe05511397b5ec7cb8e64f6b2769ec2c355f41
parent 6f127c9b
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -52,9 +52,9 @@ public final class BridgeTypedArray extends TypedArray {
    private final BridgeContext mContext;
    private final boolean mPlatformFile;

    private ResourceValue[] mResourceData;
    private String[] mNames;
    private boolean[] mIsFramework;
    private final ResourceValue[] mResourceData;
    private final String[] mNames;
    private final boolean[] mIsFramework;

    public BridgeTypedArray(BridgeResources resources, BridgeContext context, int len,
            boolean platformFile) {
@@ -81,8 +81,8 @@ public final class BridgeTypedArray extends TypedArray {
    }

    /**
     * Seals the array after all calls to {@link #bridgeSetValue(int, String, ResourceValue)} have
     * been done.
     * Seals the array after all calls to
     * {@link #bridgeSetValue(int, String, boolean, ResourceValue)} have been done.
     * <p/>This allows to compute the list of non default values, permitting
     * {@link #getIndexCount()} to return the proper value.
     */
@@ -252,7 +252,7 @@ public final class BridgeTypedArray extends TypedArray {
            for (String keyword : keywords) {
                Integer i = map.get(keyword.trim());
                if (i != null) {
                    result |= i.intValue();
                    result |= i;
                } else {
                    Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
                            String.format(
@@ -731,7 +731,7 @@ public final class BridgeTypedArray extends TypedArray {
        }

        // not a direct id valid reference? resolve it
        Integer idValue = null;
        Integer idValue;

        if (resValue.isFramework()) {
            idValue = Bridge.getResourceId(resValue.getResourceType(),
@@ -742,7 +742,7 @@ public final class BridgeTypedArray extends TypedArray {
        }

        if (idValue != null) {
            return idValue.intValue();
            return idValue;
        }

        Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_RESOLVE,
@@ -753,6 +753,12 @@ public final class BridgeTypedArray extends TypedArray {
        return defValue;
    }

    @Override
    public int getThemeAttributeId(int index, int defValue) {
        // TODO: Get the right Theme Attribute ID to enable caching of the drawables.
        return defValue;
    }

    /**
     * Retrieve the Drawable for the attribute at <var>index</var>.  This
     * gets the resource ID of the selected attribute, and uses
@@ -854,6 +860,7 @@ public final class BridgeTypedArray extends TypedArray {
     */
    @Override
    public boolean hasValue(int index) {
        //noinspection SimplifiableIfStatement
        if (index < 0 || index >= mResourceData.length) {
            return false;
        }