|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.ide.common.rendering.LayoutLibrary
public class LayoutLibrary
Class to use the Layout library.
Useload(String, ILogger, String)
to load the jar file.
Use the layout library with:
init(java.util.Map, java.io.File, java.util.Map>, com.android.ide.common.rendering.api.LayoutLog)
, supports(int)
, createSession(SessionParams)
,
dispose()
, clearCaches(Object)
.
Layout libraries before API level 5 used IProjectCallback
. Layout libraries from
API level 5 to 14 used IProjectCallback
.
Layout libraries since API 15 use LayoutlibCallback
. To target all Layout libraries,
use LayoutlibCallback
, which implements the other interfaces. Also, use
ILegacyPullParser
instead of ILayoutPullParser
.
These interfaces will ensure that both new and older Layout libraries can be accessed.
Field Summary | |
---|---|
static java.lang.String |
CLASS_BRIDGE
|
static java.lang.String |
FN_ICU_JAR
|
Constructor Summary | |
---|---|
protected |
LayoutLibrary()
|
Method Summary | |
---|---|
void |
clearCaches(java.lang.Object projectKey)
Clears the resource cache for a specific project. |
com.android.ide.common.rendering.api.RenderSession |
createSession(com.android.ide.common.rendering.api.SessionParams params)
Starts a layout session by inflating and rendering it. |
boolean |
dispose()
Prepares the layoutlib to unloaded. |
int |
getApiLevel()
Returns the API level of the layout library. |
java.lang.ClassLoader |
getClassLoader()
Returns the classloader used to load the classes in the layoutlib jar file. |
java.lang.String |
getLoadMessage()
Returns the message associated with the LoadStatus . |
int |
getRevision()
Returns the revision of the library inside a given (layoutlib) API level. |
LoadStatus |
getStatus()
Returns the LoadStatus of the loading of the layoutlib jar file. |
com.android.ide.common.rendering.api.Result |
getViewIndex(java.lang.Object viewObject)
Utility method returning the index of a given view in its parent. |
com.android.ide.common.rendering.api.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,
com.android.ide.common.rendering.api.LayoutLog log)
Initializes the Layout Library object. |
boolean |
isRtl(java.lang.String locale)
Returns true if the character orientation of the locale is right to left. |
static LayoutLibrary |
load(java.lang.String layoutLibJarOsPath,
com.android.utils.ILogger log,
java.lang.String toolName)
Loads the layoutlib.jar file located at the given path and returns a LayoutLibrary
object representing the result. |
com.android.ide.common.rendering.api.Result |
renderDrawable(com.android.ide.common.rendering.api.DrawableParams params)
Renders a Drawable. |
boolean |
supports(com.android.ide.common.rendering.api.Capability capability)
Deprecated. use supports(int) |
boolean |
supports(int capability)
Returns whether the LayoutLibrary supports a given Features . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASS_BRIDGE
public static final java.lang.String FN_ICU_JAR
Constructor Detail |
---|
protected LayoutLibrary()
Method Detail |
---|
public LoadStatus getStatus()
LoadStatus
of the loading of the layoutlib jar file.
public java.lang.String getLoadMessage()
LoadStatus
. This is mostly used when
getStatus()
returns LoadStatus.FAILED
.
public java.lang.ClassLoader getClassLoader()
public static LayoutLibrary load(java.lang.String layoutLibJarOsPath, com.android.utils.ILogger log, java.lang.String toolName)
LayoutLibrary
object representing the result.
If loading failed getStatus()
will reflect this, and mBridge
will
be null.
layoutLibJarOsPath
- the path of the jar filelog
- an optional log file.
LayoutLibrary
object always.public int getApiLevel()
public int getRevision()
getApiLevel()
.getRevision()
@Deprecated public boolean supports(com.android.ide.common.rendering.api.Capability capability)
supports(int)
Capability
.
Bridge.getCapabilities()
public boolean supports(int capability)
Features
.
Bridge.supports(int)
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, com.android.ide.common.rendering.api.LayoutLog log)
platformProperties
- The build properties for the platform.fontLocation
- the location of the fonts in the SDK target.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()
Bridge.dispose()
public com.android.ide.common.rendering.api.RenderSession createSession(com.android.ide.common.rendering.api.SessionParams params)
RenderSession
on which further actions can be taken.
Before taking further actions on the scene, it is recommended to use
supports(int)
to check what the scene can do.
RenderSession
object that contains the result of the scene creation and
first rendering or null if getStatus()
doesn't return LoadStatus.LOADED
.Bridge.createSession(SessionParams)
public com.android.ide.common.rendering.api.Result renderDrawable(com.android.ide.common.rendering.api.DrawableParams params)
Result.getData()
. It is of type BufferedImage
params
- the rendering parameters.
public void clearCaches(java.lang.Object projectKey)
projectKey
- the key for the project.Bridge.clearCaches(Object)
public com.android.ide.common.rendering.api.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 com.android.ide.common.rendering.api.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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |