@Deprecated
public interface IProjectCallback
| Modifier and Type | Interface and Description |
|---|---|
static class |
IProjectCallback.ViewAttribute
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
ActionBarCallback |
getActionBarCallback()
Deprecated.
Returns a callback for Action Bar information needed by the Layout Library.
|
AdapterBinding |
getAdapterBinding(ResourceReference adapterViewRef,
java.lang.Object adapterCookie,
java.lang.Object viewObject)
Deprecated.
Returns an adapter binding for a given adapter view.
|
java.lang.Object |
getAdapterItemValue(ResourceReference adapterView,
java.lang.Object adapterCookie,
ResourceReference itemRef,
int fullPosition,
int positionPerType,
int fullParentPosition,
int parentPositionPerType,
ResourceReference viewRef,
IProjectCallback.ViewAttribute viewAttribute,
java.lang.Object defaultValue)
Deprecated.
Returns the value of an item used by an adapter.
|
java.lang.String |
getNamespace()
Deprecated.
Returns the namespace URI of the application.
|
int |
getOrGenerateResourceId(ResourceReference resource)
Deprecated.
Returns the numeric id for the given resource, potentially generating a fresh ID.
|
ILayoutPullParser |
getParser(ResourceValue layoutResource)
Deprecated.
Returns a custom parser for a value
|
java.lang.Object |
loadView(java.lang.String name,
java.lang.Class[] constructorSignature,
java.lang.Object[] constructorArgs)
Deprecated.
Loads a custom class with the given constructor signature and arguments.
|
ResourceReference |
resolveResourceId(int id)
Deprecated.
Finds the resource with a given id.
|
@Nullable
java.lang.Object loadView(@NotNull
java.lang.String name,
@NotNull
java.lang.Class[] constructorSignature,
java.lang.Object[] constructorArgs)
throws java.lang.Exception
Despite the name, the method is used not just for views (android.view.View), but potentially any class in the project's namespace. However, when the method is used for loading non-view classes the error messages reported may not be ideal, since the the IDE may assume those classes to be a view and try to use a different constructor or replace it with a MockView.
This is done so that LayoutLib can continue to work on older versions of the IDE. Newer
versions of LayoutLib should call LayoutlibCallback.loadClass(String, Class[],
Object[]) in such a case.
name - The fully qualified name of the class.constructorSignature - The signature of the class to useconstructorArgs - The arguments to use on the constructorjava.lang.Exception@NotNull java.lang.String getNamespace()
This lets the Layout Lib load custom attributes for custom views.
@Nullable ResourceReference resolveResourceId(int id)
int getOrGenerateResourceId(@NotNull
ResourceReference resource)
Calling this method for equal references will always produce the same result.
ILayoutPullParser getParser(@NotNull ResourceValue layoutResource)
layoutResource - Layout or a value referencing an _aapt attribute.java.lang.Object getAdapterItemValue(ResourceReference adapterView, java.lang.Object adapterCookie, ResourceReference itemRef, int fullPosition, int positionPerType, int fullParentPosition, int parentPositionPerType, ResourceReference viewRef, IProjectCallback.ViewAttribute viewAttribute, java.lang.Object defaultValue)
adapterView - The ResourceReference for the adapter view info.adapterCookie - the view cookie for this particular view.itemRef - the ResourceReference for the layout used by the adapter item.fullPosition - the position of the item in the full list.positionPerType - the position of the item if only items of the same type are
considered. If there is only one type of items, this is the same as
fullPosition.fullParentPosition - the full position of the item's parent. This is only
valid if the adapter view is an ExpandableListView.parentPositionPerType - the position of the parent's item, only considering items
of the same type. This is only valid if the adapter view is an ExpandableListView.
If there is only one type of items, this is the same as fullParentPosition.viewRef - The ResourceReference for the view we're trying to fill.viewAttribute - the attribute being queried.defaultValue - the default value for this attribute. The object class matches the
class associated with the IProjectCallback.ViewAttribute.IProjectCallback.ViewAttribute.getAttributeClass()AdapterBinding getAdapterBinding(ResourceReference adapterViewRef, java.lang.Object adapterCookie, java.lang.Object viewObject)
SessionParams does not have an AdapterBinding for
the given ResourceReference already.adapterViewRef - the reference of adapter view to return the adapter binding for.adapterCookie - the view cookie for this particular view.viewObject - the view object for the adapter.ActionBarCallback getActionBarCallback()