Support rendering layout that use the new res-auto namespace.
Change-Id: I9b89c965dc8c9458e74c15ab8ff765e16e1b32c2
This commit is contained in:
@@ -39,6 +39,9 @@ public class BridgeConstants {
|
|||||||
/** Namespace for the resource XML */
|
/** Namespace for the resource XML */
|
||||||
public final static String NS_RESOURCES = "http://schemas.android.com/apk/res/android";
|
public final static String NS_RESOURCES = "http://schemas.android.com/apk/res/android";
|
||||||
|
|
||||||
|
/** App auto namespace */
|
||||||
|
public final static String NS_APP_RES_AUTO = "http://schemas.android.com/apk/res-auto";
|
||||||
|
|
||||||
public final static String R = "com.android.internal.R";
|
public final static String R = "com.android.internal.R";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ import android.content.res.BridgeResources;
|
|||||||
import android.content.res.BridgeTypedArray;
|
import android.content.res.BridgeTypedArray;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.content.res.Resources.Theme;
|
import android.content.res.Resources.Theme;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.database.DatabaseErrorHandler;
|
import android.database.DatabaseErrorHandler;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||||
@@ -78,8 +78,8 @@ import java.io.InputStream;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@@ -615,7 +615,8 @@ public final class BridgeContext extends Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String namespace = BridgeConstants.NS_RESOURCES;
|
String namespace = BridgeConstants.NS_RESOURCES;
|
||||||
if (frameworkAttributes.get() == false) {
|
boolean useFrameworkNS = frameworkAttributes.get();
|
||||||
|
if (useFrameworkNS == false) {
|
||||||
// need to use the application namespace
|
// need to use the application namespace
|
||||||
namespace = mProjectCallback.getNamespace();
|
namespace = mProjectCallback.getNamespace();
|
||||||
}
|
}
|
||||||
@@ -628,6 +629,12 @@ public final class BridgeContext extends Context {
|
|||||||
String value = null;
|
String value = null;
|
||||||
if (set != null) {
|
if (set != null) {
|
||||||
value = set.getAttributeValue(namespace, name);
|
value = set.getAttributeValue(namespace, name);
|
||||||
|
|
||||||
|
// if this is an app attribute, and the first get fails, try with the
|
||||||
|
// new res-auto namespace as well
|
||||||
|
if (useFrameworkNS == false && value == null) {
|
||||||
|
value = set.getAttributeValue(BridgeConstants.NS_APP_RES_AUTO, 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
|
||||||
|
|||||||
Reference in New Issue
Block a user