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

Commit 556866a2 authored by Xavier Ducrohet's avatar Xavier Ducrohet Committed by Android Git Automerger
Browse files

am 656d2165: Merge "Parser is optional in obtainStyledAttributes." into gingerbread

Merge commit '656d2165' into gingerbread-plus-aosp

* commit '656d2165':
  Parser is optional in obtainStyledAttributes.
parents 909a974f 656d2165
Loading
Loading
Loading
Loading
+11 −5
Original line number Original line Diff line number Diff line
@@ -245,8 +245,8 @@ public final class BridgeContext extends Context {
        BridgeXmlBlockParser parser = null;
        BridgeXmlBlockParser parser = null;
        if (set instanceof BridgeXmlBlockParser) {
        if (set instanceof BridgeXmlBlockParser) {
            parser = (BridgeXmlBlockParser)set;
            parser = (BridgeXmlBlockParser)set;
        } else {
        } else if (set != null) { // null parser is ok
            // reall this should not be happening since its instantiated in Bridge
            // really this should not be happening since its instantiated in Bridge
            mLogger.error("Parser is not a BridgeXmlBlockParser!");
            mLogger.error("Parser is not a BridgeXmlBlockParser!");
            return null;
            return null;
        }
        }
@@ -255,13 +255,16 @@ public final class BridgeContext extends Context {
        TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes);
        TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes);


        BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
        BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
                parser.isPlatformFile());
                parser != null ? parser.isPlatformFile() : true);


        // resolve the defStyleAttr value into a IStyleResourceValue
        // resolve the defStyleAttr value into a IStyleResourceValue
        IStyleResourceValue defStyleValues = null;
        IStyleResourceValue defStyleValues = null;


        // look for a custom style.
        // look for a custom style.
        String customStyle = parser.getAttributeValue(null /* namespace*/, "style");
        String customStyle = null;
        if (parser != null) {
            customStyle = parser.getAttributeValue(null /* namespace*/, "style");
        }
        if (customStyle != null) {
        if (customStyle != null) {
            IResourceValue item = findResValue(customStyle);
            IResourceValue item = findResValue(customStyle);


@@ -308,7 +311,10 @@ public final class BridgeContext extends Context {
                int index = styleAttribute.getKey().intValue();
                int index = styleAttribute.getKey().intValue();


                String name = styleAttribute.getValue();
                String name = styleAttribute.getValue();
                String value = parser.getAttributeValue(namespace, name);
                String value = null;
                if (parser != null) {
                    value = parser.getAttributeValue(namespace, name);
                }


                // if there's no direct value for this attribute in the XML, we look for default
                // if there's no direct value for this attribute in the XML, we look for default
                // values in the widget defStyle, and then in the theme.
                // values in the widget defStyle, and then in the theme.