Loading tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java +8 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import com.android.internal.util.XmlUtils; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.android.BridgeContext; import com.android.layoutlib.bridge.android.BridgeXmlBlockParser; import com.android.layoutlib.bridge.android.RenderParamsFlags; import com.android.layoutlib.bridge.impl.ParserFactory; import com.android.layoutlib.bridge.impl.ResourceHelper; import com.android.resources.ResourceType; Loading Loading @@ -329,8 +330,13 @@ public final class BridgeTypedArray extends TypedArray { try { XmlPullParser parser = null; Boolean psiParserSupport = mContext.getLayoutlibCallback().getFlag( RenderParamsFlags.FLAG_KEY_XML_FILE_PARSER_SUPPORT); if (psiParserSupport != null && psiParserSupport) { // Get the state list file content from callback to parse PSI file XmlPullParser parser = mContext.getLayoutlibCallback().getXmlFileParser(value); parser = mContext.getLayoutlibCallback().getXmlFileParser(value); } if (parser == null) { // If used with a version of Android Studio that does not implement getXmlFileParser // fall back to reading the file from disk Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/RenderParamsFlags.java +8 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.layoutlib.bridge.android; import com.android.ide.common.rendering.api.LayoutlibCallback; import com.android.ide.common.rendering.api.RenderParams; import com.android.ide.common.rendering.api.SessionParams.Key; Loading @@ -42,11 +43,16 @@ public final class RenderParamsFlags { public static final Key<Boolean> FLAG_KEY_RECYCLER_VIEW_SUPPORT = new Key<Boolean>("recyclerViewSupport", Boolean.class); /** * The application package name. Used via * {@link com.android.ide.common.rendering.api.LayoutlibCallback#getFlag(Key)} * The application package name. Used via {@link LayoutlibCallback#getFlag(Key)} */ public static final Key<String> FLAG_KEY_APPLICATION_PACKAGE = new Key<String>("applicationPackage", String.class); /** * To tell LayoutLib that IDE supports providing XML Parser for a file (useful for getting in * memory contents of the file). Used via {@link LayoutlibCallback#getFlag(Key)} */ public static final Key<Boolean> FLAG_KEY_XML_FILE_PARSER_SUPPORT = new Key<Boolean>("xmlFileParser", Boolean.class); // Disallow instances. private RenderParamsFlags() {} Loading Loading
tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java +8 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import com.android.internal.util.XmlUtils; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.android.BridgeContext; import com.android.layoutlib.bridge.android.BridgeXmlBlockParser; import com.android.layoutlib.bridge.android.RenderParamsFlags; import com.android.layoutlib.bridge.impl.ParserFactory; import com.android.layoutlib.bridge.impl.ResourceHelper; import com.android.resources.ResourceType; Loading Loading @@ -329,8 +330,13 @@ public final class BridgeTypedArray extends TypedArray { try { XmlPullParser parser = null; Boolean psiParserSupport = mContext.getLayoutlibCallback().getFlag( RenderParamsFlags.FLAG_KEY_XML_FILE_PARSER_SUPPORT); if (psiParserSupport != null && psiParserSupport) { // Get the state list file content from callback to parse PSI file XmlPullParser parser = mContext.getLayoutlibCallback().getXmlFileParser(value); parser = mContext.getLayoutlibCallback().getXmlFileParser(value); } if (parser == null) { // If used with a version of Android Studio that does not implement getXmlFileParser // fall back to reading the file from disk Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/RenderParamsFlags.java +8 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.layoutlib.bridge.android; import com.android.ide.common.rendering.api.LayoutlibCallback; import com.android.ide.common.rendering.api.RenderParams; import com.android.ide.common.rendering.api.SessionParams.Key; Loading @@ -42,11 +43,16 @@ public final class RenderParamsFlags { public static final Key<Boolean> FLAG_KEY_RECYCLER_VIEW_SUPPORT = new Key<Boolean>("recyclerViewSupport", Boolean.class); /** * The application package name. Used via * {@link com.android.ide.common.rendering.api.LayoutlibCallback#getFlag(Key)} * The application package name. Used via {@link LayoutlibCallback#getFlag(Key)} */ public static final Key<String> FLAG_KEY_APPLICATION_PACKAGE = new Key<String>("applicationPackage", String.class); /** * To tell LayoutLib that IDE supports providing XML Parser for a file (useful for getting in * memory contents of the file). Used via {@link LayoutlibCallback#getFlag(Key)} */ public static final Key<Boolean> FLAG_KEY_XML_FILE_PARSER_SUPPORT = new Key<Boolean>("xmlFileParser", Boolean.class); // Disallow instances. private RenderParamsFlags() {} Loading