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

Commit 1d59871e authored by Deepanshu Gupta's avatar Deepanshu Gupta Committed by Android (Google) Code Review
Browse files

Merge "Resource resolution fixes." into lmp-dev

parents d801a123 b6864ac6
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -614,16 +614,28 @@ public final class BridgeTypedArray extends TypedArray {

            int pos = value.indexOf('/');
            String idName = value.substring(pos + 1);
            boolean create = value.startsWith("@+");
            boolean isFrameworkId =
                    mPlatformFile || value.startsWith("@android") || value.startsWith("@+android");

            // if this is a framework id
            if (mPlatformFile || value.startsWith("@android") || value.startsWith("@+android")) {
                // look for idName in the android R classes
                return mContext.getFrameworkResourceValue(ResourceType.ID, idName, defValue);
            // Look for the idName in project or android R class depending on isPlatform.
            if (create) {
                Integer idValue;
                if (isFrameworkId) {
                    idValue = Bridge.getResourceId(ResourceType.ID, idName);
                } else {
                    idValue = mContext.getProjectCallback().getResourceId(ResourceType.ID, idName);
                }

            // look for idName in the project R class.
                return idValue == null ? defValue : idValue;
            }
            // This calls the same method as in if(create), but doesn't create a dynamic id, if
            // one is not found.
            if (isFrameworkId) {
                return mContext.getFrameworkResourceValue(ResourceType.ID, idName, defValue);
            } else {
                return mContext.getProjectResourceValue(ResourceType.ID, idName, defValue);
            }
        }

        // not a direct id valid reference? resolve it
        Integer idValue;
+5 −1
Original line number Diff line number Diff line
@@ -288,6 +288,11 @@ public final class BridgeContext extends Context {
            value = mRenderResources.resolveResValue(value);
        }

        if (value == null) {
            // unable to find the attribute.
            return false;
        }

        // check if this is a style resource
        if (value instanceof StyleResourceValue) {
            // get the id that will represent this style.
@@ -295,7 +300,6 @@ public final class BridgeContext extends Context {
            return true;
        }


        int a;
        // if this is a framework value.
        if (value.isFramework()) {