diff options
author | Jerome Gaillard <jgaillard@google.com> | 2022-02-14 12:23:00 +0000 |
---|---|---|
committer | Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | 2022-02-16 13:01:44 +0000 |
commit | 2cb5c82c7a5914fd7017d7cfde6b5d0b90288417 (patch) | |
tree | db099402f5f2e90cf59b3d211fd156748e8e5f97 | |
parent | 66ef062b52567ab2c014735ca3c40ba51579b097 (diff) | |
download | layoutlib-2cb5c82c7a5914fd7017d7cfde6b5d0b90288417.tar.gz |
Delete always true flags
FLAG_KEY_RECYCLER_VIEW_SUPPORT and FLAG_KEY_XML_FILE_PARSER_SUPPORT
always have true values. This removes them.
Bug: 153986571
Test: N/A
Change-Id: Ifff5dc065dc0aeba00e12bd763c90359f5463c1a
(cherry picked from commit ce38bf9dd4d1aab2ddef469ee92b623b1b75bc17)
Merged-In:Ifff5dc065dc0aeba00e12bd763c90359f5463c1a
3 files changed, 3 insertions, 28 deletions
diff --git a/bridge/src/android/graphics/Typeface_Delegate.java b/bridge/src/android/graphics/Typeface_Delegate.java index 1ad8358671..d9d38ad4c3 100644 --- a/bridge/src/android/graphics/Typeface_Delegate.java +++ b/bridge/src/android/graphics/Typeface_Delegate.java @@ -22,7 +22,6 @@ import com.android.ide.common.rendering.api.ResourceNamespace; 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.DelegateManager; import com.android.layoutlib.bridge.impl.RenderAction; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; @@ -66,14 +65,7 @@ public final class Typeface_Delegate { String lowerCaseValue = path.toLowerCase(); if (lowerCaseValue.endsWith(AndroidConstants.DOT_XML)) { // create a block parser for the file - Boolean psiParserSupport = context.getLayoutlibCallback().getFlag( - RenderParamsFlags.FLAG_KEY_XML_FILE_PARSER_SUPPORT); - XmlPullParser parser; - if (psiParserSupport != null && psiParserSupport) { - parser = context.getLayoutlibCallback().createXmlParserForPsiFile(path); - } else { - parser = context.getLayoutlibCallback().createXmlParserForFile(path); - } + XmlPullParser parser = context.getLayoutlibCallback().createXmlParserForPsiFile(path); if (parser != null) { // TODO(b/156609434): The aapt namespace should not matter for parsing font files? diff --git a/bridge/src/com/android/layoutlib/bridge/android/RenderParamsFlags.java b/bridge/src/com/android/layoutlib/bridge/android/RenderParamsFlags.java index b40be33c95..d9317a99fb 100644 --- a/bridge/src/com/android/layoutlib/bridge/android/RenderParamsFlags.java +++ b/bridge/src/com/android/layoutlib/bridge/android/RenderParamsFlags.java @@ -36,24 +36,13 @@ public final class RenderParamsFlags { new Key<Boolean>("disableBitmapCaching", Boolean.class); public static final Key<Boolean> FLAG_KEY_RENDER_ALL_DRAWABLE_STATES = new Key<Boolean>("renderAllDrawableStates", Boolean.class); - /** - * To tell LayoutLib that the IDE supports RecyclerView. - * <p/> - * Default is false. - */ - public static final Key<Boolean> FLAG_KEY_RECYCLER_VIEW_SUPPORT = - new Key<Boolean>("recyclerViewSupport", Boolean.class); + /** * 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); + /** * To tell LayoutLib to not render when creating a new session. This allows controlling when the first * layout rendering will happen. diff --git a/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java b/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java index 83f1f305f7..46dd0b4149 100644 --- a/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java +++ b/bridge/src/com/android/layoutlib/bridge/android/support/RecyclerViewUtil.java @@ -20,7 +20,6 @@ import com.android.ide.common.rendering.api.ILayoutLog; import com.android.ide.common.rendering.api.LayoutlibCallback; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.android.BridgeContext; -import com.android.layoutlib.bridge.android.RenderParamsFlags; import com.android.layoutlib.common.util.ReflectionUtils; import com.android.layoutlib.common.util.ReflectionUtils.ReflectionException; @@ -120,11 +119,6 @@ public class RecyclerViewUtil { @Nullable private static Object createAdapter(@NonNull LayoutlibCallback layoutlibCallback, @NonNull String adapterClassName) throws ReflectionException { - Boolean ideSupport = - layoutlibCallback.getFlag(RenderParamsFlags.FLAG_KEY_RECYCLER_VIEW_SUPPORT); - if (ideSupport != Boolean.TRUE) { - return null; - } try { return layoutlibCallback.loadClass(adapterClassName, new Class[0], new Object[0]); } catch (Exception e) { |