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 |
clearAllCaches(java.lang.Object projectKey)
Clears all caches for a specific project.
|
void |
clearFontCache(java.lang.String path)
Removes a font file from the Typeface cache.
|
void |
clearResourceCaches(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.
|
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.lang.String nativeLibDirPath,
java.lang.String icuDataPath,
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.
|
public static final int API_CURRENT
public boolean init(java.util.Map<java.lang.String,java.lang.String> platformProperties,
java.io.File fontLocation,
java.lang.String nativeLibDirPath,
java.lang.String icuDataPath,
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.nativeLibDirPath - the absolute path of the directory containing all the native
libraries for layoutlib.icuDataPath - the location of the ICU data used natively.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 BufferedImageparams - the rendering parameters.public void clearResourceCaches(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 void clearFontCache(java.lang.String path)
path - path of the font file to remove from the cachepublic void clearAllCaches(java.lang.Object projectKey)
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