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

Commit 34f5991e authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

Merge 6103e22c from honeycomb-mr1. do not merge.

LayoutLib: custom styles override the default style instead of replacing it.

Intead of reading either the custom or the default style for a widget, we
read both and use the values from the custom style if it exists, or
from the default style otherwise.

Change-Id: Ibcec2e9b1e8a95295ab26ede145c287ff2f30be4
parent c7b87766
Loading
Loading
Loading
Loading
+58 −53
Original line number Diff line number Diff line
@@ -509,14 +509,13 @@ public final class BridgeContext extends Activity {
        BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
                isPlatformFile);

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

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

        StyleResourceValue customStyleValues = null;
        if (customStyle != null) {
            ResourceValue item = mRenderResources.findResValue(customStyle,
                    false /*forceFrameworkOnly*/);
@@ -525,11 +524,13 @@ public final class BridgeContext extends Activity {
            item = mRenderResources.resolveResValue(item);

            if (item instanceof StyleResourceValue) {
                defStyleValues = (StyleResourceValue)item;
                customStyleValues = (StyleResourceValue)item;
            }
        }

        if (defStyleValues == null) {
        // resolve the defStyleAttr value into a IStyleResourceValue
        StyleResourceValue defStyleValues = null;

        if (defStyleAttr != 0) {
            // get the name from the int.
            String defStyleName = searchAttr(defStyleAttr);
@@ -595,7 +596,6 @@ public final class BridgeContext extends Activity {
                        null /*data*/);
            }
        }
        }

        String namespace = BridgeConstants.NS_RESOURCES;
        if (frameworkAttributes[0] == false) {
@@ -618,8 +618,13 @@ public final class BridgeContext extends Activity {
                if (value == null) {
                    ResourceValue resValue = null;

                    // look for the value in the defStyle first (and its parent if needed)
                    if (defStyleValues != null) {
                    // look for the value in the custom style first (and its parent if needed)
                    if (customStyleValues != null) {
                        resValue = mRenderResources.findItemInStyle(customStyleValues, name);
                    }

                    // then look for the value in the default Style (and its parent if needed)
                    if (resValue == null && defStyleValues != null) {
                        resValue = mRenderResources.findItemInStyle(defStyleValues, name);
                    }