com.android.layoutlib.api
Interface ILayoutBridge


Deprecated. Extend Bridge instead.

@Deprecated
public interface ILayoutBridge

Entry point of the Layout Lib. Implementations of this interface provide a method to compute and render a layout.

getApiLevel() gives the ability to know which methods are available.

Changes in API level 5:

Changes in API level 4: Changes in API level 3: Changes in API level 2:


Field Summary
static int API_CURRENT
          Deprecated.  
 
Method Summary
 void clearCaches(java.lang.Object projectKey)
          Deprecated. Clears the resource cache for a specific project.
 ILayoutResult computeLayout(IXmlPullParser layoutDescription, java.lang.Object projectKey, int screenWidth, int screenHeight, boolean renderFullSize, int density, float xdpi, float ydpi, java.lang.String themeName, boolean isProjectTheme, java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> projectResources, java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> frameworkResources, IProjectCallback projectCallback, ILayoutLog logger)
          Deprecated. use Bridge.createSession(com.android.ide.common.rendering.api.SessionParams)
 ILayoutResult computeLayout(IXmlPullParser layoutDescription, java.lang.Object projectKey, int screenWidth, int screenHeight, int density, float xdpi, float ydpi, java.lang.String themeName, boolean isProjectTheme, java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> projectResources, java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> frameworkResources, IProjectCallback projectCallback, ILayoutLog logger)
          Deprecated. use Bridge.createSession(com.android.ide.common.rendering.api.SessionParams)
 ILayoutResult computeLayout(IXmlPullParser layoutDescription, java.lang.Object projectKey, int screenWidth, int screenHeight, java.lang.String themeName, boolean isProjectTheme, java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> projectResources, java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> frameworkResources, IProjectCallback projectCallback, ILayoutLog logger)
          Deprecated. use Bridge.createSession(com.android.ide.common.rendering.api.SessionParams)
 ILayoutResult computeLayout(IXmlPullParser layoutDescription, java.lang.Object projectKey, int screenWidth, int screenHeight, java.lang.String themeName, java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> projectResources, java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> frameworkResources, IProjectCallback projectCallback, ILayoutLog logger)
          Deprecated. use Bridge.createSession(com.android.ide.common.rendering.api.SessionParams)
 boolean dispose()
          Deprecated. Prepares the layoutlib to unloaded.
 int getApiLevel()
          Deprecated. Returns the API level of the layout library.
 boolean init(java.lang.String fontOsLocation, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> enumValueMap)
          Deprecated. Initializes the Bridge object.
 

Field Detail

API_CURRENT

static final int API_CURRENT
Deprecated. 
See Also:
Constant Field Values
Method Detail

getApiLevel

int getApiLevel()
Deprecated. 
Returns the API level of the layout library. While no methods will ever be removed, some may become deprecated, and some new ones will appear.

If calling this method throws an AbstractMethodError, then the API level should be considered to be 1.


init

boolean init(java.lang.String fontOsLocation,
             java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> enumValueMap)
Deprecated. 
Initializes the Bridge object.

Parameters:
fontOsLocation - the location of the fonts.
enumValueMap - map attrName => { map enumFlagName => Integer value }.
Returns:
true if success.
Since:
1

dispose

boolean dispose()
Deprecated. 
Prepares the layoutlib to unloaded.


computeLayout

@Deprecated
ILayoutResult computeLayout(IXmlPullParser layoutDescription,
                                       java.lang.Object projectKey,
                                       int screenWidth,
                                       int screenHeight,
                                       boolean renderFullSize,
                                       int density,
                                       float xdpi,
                                       float ydpi,
                                       java.lang.String themeName,
                                       boolean isProjectTheme,
                                       java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> projectResources,
                                       java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> frameworkResources,
                                       IProjectCallback projectCallback,
                                       ILayoutLog logger)
Deprecated. use Bridge.createSession(com.android.ide.common.rendering.api.SessionParams)

Starts a layout session by inflating and rendering it. The method returns a ILayoutResult on which further actions can be taken.

Parameters:
layoutDescription - the IXmlPullParser letting the LayoutLib Bridge visit the layout file.
projectKey - An Object identifying the project. This is used for the cache mechanism.
screenWidth - the screen width
screenHeight - the screen height
renderFullSize - if true, the rendering will render the full size needed by the layout. This size is never smaller than screenWidth x screenHeight.
density - the density factor for the screen.
xdpi - the screen actual dpi in X
ydpi - the screen actual dpi in Y
themeName - The name of the theme to use.
isProjectTheme - true if the theme is a project theme, false if it is a framework theme.
projectResources - the resources of the project. The map contains (String, map) pairs where the string is the type of the resource reference used in the layout file, and the map contains (String, IResourceValue) pairs where the key is the resource name, and the value is the resource value.
frameworkResources - the framework resources. The map contains (String, map) pairs where the string is the type of the resource reference used in the layout file, and the map contains (String, IResourceValue) pairs where the key is the resource name, and the value is the resource value.
projectCallback - The IProjectCallback object to get information from the project.
logger - the object responsible for displaying warning/errors to the user.
Returns:
a new ILayoutResult object that contains the result of the layout.
Since:
4

computeLayout

@Deprecated
ILayoutResult computeLayout(IXmlPullParser layoutDescription,
                                       java.lang.Object projectKey,
                                       int screenWidth,
                                       int screenHeight,
                                       int density,
                                       float xdpi,
                                       float ydpi,
                                       java.lang.String themeName,
                                       boolean isProjectTheme,
                                       java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> projectResources,
                                       java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> frameworkResources,
                                       IProjectCallback projectCallback,
                                       ILayoutLog logger)
Deprecated. use Bridge.createSession(com.android.ide.common.rendering.api.SessionParams)

Computes and renders a layout

Parameters:
layoutDescription - the IXmlPullParser letting the LayoutLib Bridge visit the layout file.
projectKey - An Object identifying the project. This is used for the cache mechanism.
screenWidth - the screen width
screenHeight - the screen height
density - the density factor for the screen.
xdpi - the screen actual dpi in X
ydpi - the screen actual dpi in Y
themeName - The name of the theme to use.
isProjectTheme - true if the theme is a project theme, false if it is a framework theme.
projectResources - the resources of the project. The map contains (String, map) pairs where the string is the type of the resource reference used in the layout file, and the map contains (String, IResourceValue) pairs where the key is the resource name, and the value is the resource value.
frameworkResources - the framework resources. The map contains (String, map) pairs where the string is the type of the resource reference used in the layout file, and the map contains (String, IResourceValue) pairs where the key is the resource name, and the value is the resource value.
projectCallback - The IProjectCallback object to get information from the project.
logger - the object responsible for displaying warning/errors to the user.
Returns:
a new ILayoutResult object that contains the result of the layout.
Since:
3

computeLayout

@Deprecated
ILayoutResult computeLayout(IXmlPullParser layoutDescription,
                                       java.lang.Object projectKey,
                                       int screenWidth,
                                       int screenHeight,
                                       java.lang.String themeName,
                                       boolean isProjectTheme,
                                       java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> projectResources,
                                       java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> frameworkResources,
                                       IProjectCallback projectCallback,
                                       ILayoutLog logger)
Deprecated. use Bridge.createSession(com.android.ide.common.rendering.api.SessionParams)

Computes and renders a layout

Parameters:
layoutDescription - the IXmlPullParser letting the LayoutLib Bridge visit the layout file.
projectKey - An Object identifying the project. This is used for the cache mechanism.
screenWidth - the screen width
screenHeight - the screen height
themeName - The name of the theme to use.
isProjectTheme - true if the theme is a project theme, false if it is a framework theme.
projectResources - the resources of the project. The map contains (String, map) pairs where the string is the type of the resource reference used in the layout file, and the map contains (String, IResourceValue) pairs where the key is the resource name, and the value is the resource value.
frameworkResources - the framework resources. The map contains (String, map) pairs where the string is the type of the resource reference used in the layout file, and the map contains (String, IResourceValue) pairs where the key is the resource name, and the value is the resource value.
projectCallback - The IProjectCallback object to get information from the project.
logger - the object responsible for displaying warning/errors to the user.
Returns:
a new ILayoutResult object that contains the result of the layout.
Since:
2

computeLayout

@Deprecated
ILayoutResult computeLayout(IXmlPullParser layoutDescription,
                                       java.lang.Object projectKey,
                                       int screenWidth,
                                       int screenHeight,
                                       java.lang.String themeName,
                                       java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> projectResources,
                                       java.util.Map<java.lang.String,java.util.Map<java.lang.String,IResourceValue>> frameworkResources,
                                       IProjectCallback projectCallback,
                                       ILayoutLog logger)
Deprecated. use Bridge.createSession(com.android.ide.common.rendering.api.SessionParams)

Computes and renders a layout

Parameters:
layoutDescription - the IXmlPullParser letting the LayoutLib Bridge visit the layout file.
projectKey - An Object identifying the project. This is used for the cache mechanism.
screenWidth -
screenHeight -
themeName - The name of the theme to use. In order to differentiate project and platform themes sharing the same name, all project themes must be prepended with a '*' character.
projectResources - the resources of the project. The map contains (String, map) pairs where the string is the type of the resource reference used in the layout file, and the map contains (String, IResourceValue) pairs where the key is the resource name, and the value is the resource value.
frameworkResources - the framework resources. The map contains (String, map) pairs where the string is the type of the resource reference used in the layout file, and the map contains (String, IResourceValue) pairs where the key is the resource name, and the value is the resource value.
projectCallback - The IProjectCallback object to get information from the project.
logger - the object responsible for displaying warning/errors to the user.
Returns:
a new ILayoutResult object that contains the result of the layout.
Since:
1

clearCaches

void clearCaches(java.lang.Object projectKey)
Deprecated. 
Clears the resource cache for a specific project.

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).

Parameters:
projectKey - the key for the project.
Since:
1