@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 of the application.
|
ILayoutPullParser |
getParser(ResourceValue layoutResource)
Deprecated.
Returns a custom parser for a given layout.
|
ILayoutPullParser |
getParser(java.lang.String layoutName)
Deprecated.
This is replaced by
getParser(ResourceValue) but older version
of the layoutlib (before API7) will still call this method. |
java.lang.Integer |
getResourceId(ResourceType type,
java.lang.String name)
Deprecated.
Returns the id of a resource.
|
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.
|
Pair<ResourceType,java.lang.String> |
resolveResourceId(int id)
Deprecated.
Resolves the id of a resource Id.
|
java.lang.String |
resolveResourceId(int[] id)
Deprecated.
Resolves the id of a resource Id of type int[]
|
java.lang.Object loadView(java.lang.String name, 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
java.lang.String getNamespace()
This lets the Layout Lib load custom attributes for custom views.
Pair<ResourceType,java.lang.String> resolveResourceId(int id)
The resource id is the value of a R.<type>.<name>
, and
this method will return both the type and name of the resource.
id
- the Id to resolve.ResourceType
and resource name, or null if the id
does not match any resource.java.lang.String resolveResourceId(int[] id)
The resource id is the value of a R.styleable.<name>, and this method will return the name of the resource.
id
- the Id to resolve.null
if not found.java.lang.Integer getResourceId(ResourceType type, java.lang.String name)
The provided type and name must match an existing constant defined as
R.<type>.<name>
.
type
- the type of the resourcename
- the name of the resourcenull
if not found.@Deprecated ILayoutPullParser getParser(java.lang.String layoutName)
getParser(ResourceValue)
but older version
of the layoutlib (before API7) will still call this method.layoutName
- the name of the layout.ILayoutPullParser getParser(ResourceValue layoutResource)
layoutResource
- The layout.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()