public abstract class Bridge
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
API_CURRENT |
Constructor and Description |
---|
Bridge() |
Modifier and Type | Method and Description |
---|---|
void |
clearCaches(java.lang.Object projectKey)
Clears the resource cache for a specific project.
|
RenderSession |
createSession(SessionParams params)
Starts a layout session by inflating and rendering it.
|
boolean |
dispose()
Prepares the layoutlib to unloaded.
|
abstract int |
getApiLevel()
Returns the API level of the layout library.
|
java.util.EnumSet<Capability> |
getCapabilities()
Deprecated.
use
supports(int) |
int |
getRevision()
Returns the revision of the library inside a given (layoutlib) API level.
|
Result |
getViewBaseline(java.lang.Object viewObject)
Deprecated.
use the extended ViewInfo.
|
Result |
getViewIndex(java.lang.Object viewObject)
Utility method returning the index of a given view in its parent.
|
Result |
getViewParent(java.lang.Object viewObject)
Utility method returning the parent of a given view object.
|
boolean |
init(java.util.Map<java.lang.String,java.lang.String> platformProperties,
java.io.File fontLocation,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> enumValueMap,
LayoutLog log)
Initializes the Bridge object.
|
boolean |
isRtl(java.lang.String locale)
Returns true if the character orientation of the locale is right to left.
|
Result |
renderDrawable(DrawableParams params)
Renders a Drawable.
|
boolean |
supports(int feature)
Returns true if the layout library supports the given feature.
|
public static final int API_CURRENT
public abstract int getApiLevel()
While no methods will ever be removed, some may become deprecated, and some new ones will appear.
All Layout libraries based on Bridge
return at minimum an API level of 5.
public int getRevision()
getApiLevel()
.getRevision()
@Deprecated public java.util.EnumSet<Capability> getCapabilities()
supports(int)
EnumSet
of the supported Capability
.EnumSet
with the supported capabilities.public boolean supports(int feature)
Features
public boolean init(java.util.Map<java.lang.String,java.lang.String> platformProperties, java.io.File fontLocation, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> enumValueMap, LayoutLog log)
platformProperties
- The build properties for the platform.fontLocation
- the location of the fonts.enumValueMap
- map attrName ⇒ { map enumFlagName ⇒ Integer value }. This is typically
read from attrs.xml in the SDK target.log
- a LayoutLog
object. Can be null.public boolean dispose()
public RenderSession createSession(SessionParams params)
RenderSession
on which further actions can be taken.RenderSession
object that contains the result of the scene creation and
first rendering.public Result renderDrawable(DrawableParams params)
Result.getData()
. It is of type BufferedImage
params
- the rendering parameters.public void clearCaches(java.lang.Object projectKey)
This cache contains bitmaps and nine patches that are loaded from the disk and reused until this method is called.
The cache is not configuration dependent and should only be cleared when a resource changes (at this time only bitmaps and 9 patches go into the cache).
The project key provided must be similar to the one passed in RenderParams
.
projectKey
- the key for the project.public Result getViewParent(java.lang.Object viewObject)
viewObject
- the object for which to return the parent.Result
indicating the status of the action, and if success, the parent
object in Result.getData()
public Result getViewIndex(java.lang.Object viewObject)
viewObject
- the object for which to return the index.Result
indicating the status of the action, and if success, the index in
the parent in Result.getData()
public boolean isRtl(java.lang.String locale)
locale
- The locale formatted as language-region@Deprecated public Result getViewBaseline(java.lang.Object viewObject)
viewObject
- the object for which to return the index.