public abstract class LayoutlibCallback extends java.lang.Object implements IProjectCallback, IProjectCallback
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.
Clients should use this instead of IProjectCallback to target both old and new
Layout Libraries.
IProjectCallback.ViewAttribute| Constructor and Description |
|---|
LayoutlibCallback() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<?> |
findClass(java.lang.String name)
Find a custom class in the project.
|
<T> T |
getFlag(SessionParams.Key<T> key)
A callback to query arbitrary data.
|
ParserFactory |
getParserFactory()
Get a ParserFactory which can be used to create XmlPullParsers.
|
java.lang.Integer |
getResourceValue(java.lang.String type,
java.lang.String name)
Returns the id of a resource.
|
org.xmlpull.v1.XmlPullParser |
getXmlFileParser(java.lang.String fileName)
Returns an
XmlPullParser for the psi version of an xml file. |
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. |
java.lang.String[] |
resolveResourceValue(int id)
Resolves the id of a resource Id.
|
java.lang.String |
resolveResourceValue(int[] id)
Resolves the id of a resource Id of type int[]
|
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, getParser, getParser, getResourceId, loadView, resolveResourceId, resolveResourceIdgetNamespace, loadViewpublic 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 ParserFactory getParserFactory()
@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@Nullable public org.xmlpull.v1.XmlPullParser getXmlFileParser(java.lang.String fileName)
XmlPullParser for the psi version of an xml file.
The call to the method should be guarded by a check for
RenderParamsFlag.FLAG_KEY_XML_FILE_PARSER_SUPPORT.fileName - name of the file to parsepublic final java.lang.Integer getResourceValue(java.lang.String type,
java.lang.String name)
IProjectCallbackThe provided type and name must match an existing constant defined as
R.<type>.<name>.
getResourceValue in interface IProjectCallbacktype - the type of the resourcename - the name of the resourcenull if not found.public final java.lang.String[] resolveResourceValue(int id)
IProjectCallbackThe resource id is the value of a R.<type>.<name>, and
this method will return both the type and name of the resource.
resolveResourceValue in interface IProjectCallbackid - the Id to resolve.public final java.lang.String resolveResourceValue(int[] id)
IProjectCallbackThe resource id is the value of a R.styleable.<name>, and this method will return the name of the resource.
resolveResourceValue in interface IProjectCallbackid - the Id to resolve.null if not found.