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

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

Merge "Revert "Layoutlib changes to support the new ResourceUrl"" into oc-dev

parents 81b292ab 51b4387a
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import com.android.layoutlib.bridge.impl.ResourceHelper;
import com.android.layoutlib.bridge.util.NinePatchInputStream;
import com.android.ninepatch.NinePatch;
import com.android.resources.ResourceType;
import com.android.resources.ResourceUrl;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import com.android.util.Pair;

@@ -60,8 +59,6 @@ import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Iterator;

import static com.android.SdkConstants.ANDROID_NS_NAME;

@SuppressWarnings("deprecation")
public class Resources_Delegate {

@@ -140,8 +137,8 @@ public class Resources_Delegate {

            if (value == null) {
                // Unable to resolve the attribute, just leave the unresolved value
                value = new ResourceValue(ResourceUrl.create(resourceInfo.getFirst(), attributeName,
                        platformResFlag_out[0]), attributeName);
                value = new ResourceValue(resourceInfo.getFirst(), attributeName, attributeName,
                        platformResFlag_out[0]);
            }
            return Pair.of(attributeName, value);
        }
@@ -681,7 +678,7 @@ public class Resources_Delegate {
        String packageName;
        if (resourceInfo != null) {
            if (platformOut[0]) {
                packageName = ANDROID_NS_NAME;
                packageName = SdkConstants.ANDROID_NS_NAME;
            } else {
                packageName = resources.mContext.getPackageName();
                packageName = packageName == null ? SdkConstants.APP_PREFIX : packageName;
@@ -699,7 +696,7 @@ public class Resources_Delegate {
        Pair<ResourceType, String> resourceInfo = getResourceInfo(resources, resid, platformOut);
        if (resourceInfo != null) {
            if (platformOut[0]) {
                return ANDROID_NS_NAME;
                return SdkConstants.ANDROID_NS_NAME;
            }
            String packageName = resources.mContext.getPackageName();
            return packageName == null ? SdkConstants.APP_PREFIX : packageName;
+14 −20
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import com.android.layoutlib.bridge.android.view.WindowManagerImpl;
import com.android.layoutlib.bridge.impl.ParserFactory;
import com.android.layoutlib.bridge.impl.Stack;
import com.android.resources.ResourceType;
import com.android.resources.ResourceUrl;
import com.android.util.Pair;
import com.android.util.PropertiesMap;
import com.android.util.PropertiesMap.Property;
@@ -87,6 +86,7 @@ import android.util.TypedValue;
import android.view.BridgeInflater;
import android.view.Display;
import android.view.DisplayAdjustments;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
@@ -107,7 +107,6 @@ import java.util.List;
import java.util.Map;

import static android.os._Original_Build.VERSION_CODES.JELLY_BEAN_MR1;
import static com.android.SdkConstants.ANDROID_NS_NAME;
import static com.android.layoutlib.bridge.android.RenderParamsFlags.FLAG_KEY_APPLICATION_PACKAGE;

/**
@@ -122,23 +121,20 @@ public class BridgeContext extends Context {

    static {
        FRAMEWORK_PATCHED_VALUES.put("animateFirstView", new ResourceValue(
                ResourceUrl.create(ANDROID_NS_NAME, ResourceType.BOOL, "animateFirstView"),
                "false"));
        FRAMEWORK_PATCHED_VALUES.put("animateLayoutChanges", new ResourceValue(
                ResourceUrl.create(ANDROID_NS_NAME, ResourceType.BOOL, "animateLayoutChanges"),
                "false"));
                ResourceType.BOOL, "animateFirstView", "false", false));
        FRAMEWORK_PATCHED_VALUES.put("animateLayoutChanges",
                new ResourceValue(ResourceType.BOOL, "animateLayoutChanges", "false", false));


        FRAMEWORK_REPLACE_VALUES.put("textEditSuggestionItemLayout", new ResourceValue(
                ResourceUrl.create(ANDROID_NS_NAME, ResourceType.LAYOUT,
                        "textEditSuggestionItemLayout"), "text_edit_suggestion_item"));
        FRAMEWORK_REPLACE_VALUES.put("textEditSuggestionContainerLayout", new ResourceValue(
                ResourceUrl.create(ANDROID_NS_NAME, ResourceType.LAYOUT,
                        "textEditSuggestionContainerLayout"), "text_edit_suggestion_container"));
        FRAMEWORK_REPLACE_VALUES.put("textEditSuggestionHighlightStyle", new ResourceValue(
                ResourceUrl.create(ANDROID_NS_NAME, ResourceType.STYLE,
                        "textEditSuggestionHighlightStyle"),
                "TextAppearance.Holo.SuggestionHighlight"));
        FRAMEWORK_REPLACE_VALUES.put("textEditSuggestionItemLayout",
                new ResourceValue(ResourceType.LAYOUT, "textEditSuggestionItemLayout",
                        "text_edit_suggestion_item", true));
        FRAMEWORK_REPLACE_VALUES.put("textEditSuggestionContainerLayout",
                new ResourceValue(ResourceType.LAYOUT, "textEditSuggestionContainerLayout",
                        "text_edit_suggestion_container", true));
        FRAMEWORK_REPLACE_VALUES.put("textEditSuggestionHighlightStyle",
                new ResourceValue(ResourceType.STYLE, "textEditSuggestionHighlightStyle",
                        "TextAppearance.Holo.SuggestionHighlight", true));

    }

@@ -974,9 +970,7 @@ public class BridgeContext extends Context {
                    // there is a value in the XML, but we need to resolve it in case it's
                    // referencing another resource or a theme value.
                    ta.bridgeSetValue(index, attrName, frameworkAttr,
                            mRenderResources.resolveResValue(new ResourceValue(
                                    ResourceUrl.create(ResourceType.STRING, attrName,
                                            isPlatformFile), value)));
                            mRenderResources.resolveValue(null, attrName, value, isPlatformFile));
                }
            }
        }