Merge "Revert "Layoutlib changes to support the new ResourceUrl"" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
28119285e8
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user