public abstract class LayoutlibCallback extends java.lang.Object implements IProjectCallback, XmlParserFactory
Even newer LayoutLibs use this directly instead of the the interface. This allows the
flexibility to add newer methods without having to update LayoutLib API
version.
IProjectCallback.ViewAttribute| Constructor and Description |
|---|
LayoutlibCallback() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<?> |
findClass(java.lang.String name)
Finds a custom class in the project.
|
<T> T |
getFlag(SessionParams.Key<T> key)
A callback to query arbitrary data.
|
ResourceNamespace.Resolver |
getImplicitNamespaces()
Returns an optional
ResourceNamespace.Resolver that knows namespace prefixes assumed
to be declared in every resource file. |
boolean |
hasAndroidXAppCompat()
Returns true if the module depends on androidx.appcompat.
|
boolean |
hasLegacyAppCompat()
Returns true if the module depends on android.support.v7.appcompat.
|
boolean |
isResourceNamespacingRequired()
Returns true if the module uses namespaced resources.
|
java.lang.Object |
loadClass(java.lang.String name,
java.lang.Class[] constructorSignature,
java.lang.Object[] constructorArgs)
Like
IProjectCallback.loadView(String, Class[], Object[]), but intended for loading classes that may
not be custom views. |
abstract boolean |
supports(int ideFeature)
Returns if the IDE supports the requested feature.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetActionBarCallback, getAdapterBinding, getAdapterItemValue, getNamespace, getOrGenerateResourceId, getParser, loadView, resolveResourceIdcreateXmlParser, createXmlParserForFile, createXmlParserForPsiFilepublic java.lang.Object loadClass(@NonNull
java.lang.String name,
@Nullable
java.lang.Class[] constructorSignature,
@Nullable
java.lang.Object[] constructorArgs)
throws java.lang.ClassNotFoundException
IProjectCallback.loadView(String, Class[], Object[]), but intended for loading classes that may
not be custom views.name - className in binary format (see ClassLoader)java.lang.ClassNotFoundException - any exceptions thrown when creating the instance is wrapped in
ClassNotFoundException.public abstract boolean supports(int ideFeature)
Features@Nullable
public <T> T getFlag(@NonNull
SessionParams.Key<T> key)
RenderParams.setFlag(SessionParams.Key,
Object). The main difference is that when using this, the IDE doesn't have to compute the
value in advance and thus may save on some computation.@NonNull
public java.lang.Class<?> findClass(@NonNull
java.lang.String name)
throws java.lang.ClassNotFoundException
Like loadClass(String, Class[], Object[]), but doesn't instantiate an object and
just returns the class found.
name - className in binary format. (see ClassLoader.java.lang.ClassNotFoundException@NonNull public ResourceNamespace.Resolver getImplicitNamespaces()
ResourceNamespace.Resolver that knows namespace prefixes assumed
to be declared in every resource file.
For backwards compatibility, in non-namespaced projects this contains the "tools" prefix
mapped to ResourceNamespace.TOOLS. Before the IDE understood resource namespaces,
this prefix was used for referring to sample data, even if the user didn't define the "tools"
prefix using xmlns:tools="...".
In namespaced projects this method returns an empty resolver, which means sample data
won't work without an explicit definition of a namespace prefix for the ResourceNamespace.TOOLS URI.
public boolean hasLegacyAppCompat()
public boolean hasAndroidXAppCompat()
public boolean isResourceNamespacingRequired()