|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.ide.common.rendering.api.RenderSession
public class RenderSession
An object allowing interaction with an Android layout.
This is returned by Bridge.createSession(SessionParams)
.
and can then be used for subsequent actions on the layout.
Constructor Summary | |
---|---|
RenderSession()
|
Method Summary | |
---|---|
Result |
animate(java.lang.Object targetObject,
java.lang.String animationName,
boolean isFrameworkAnimation,
IAnimationListener listener)
Starts playing an given animation on a given object. |
void |
dispose()
Discards the layout. |
java.util.Map<java.lang.String,java.lang.String> |
getDefaultProperties(java.lang.Object viewObject)
Returns a map of (XML attribute name, attribute value) containing only default attribute values, for the given view Object. |
java.awt.image.BufferedImage |
getImage()
Returns the rendering of the full layout. |
Result |
getProperty(java.lang.Object objectView,
java.lang.String propertyName)
returns the value of a given property on a given object. |
Result |
getResult()
Returns the last operation result. |
java.util.List<ViewInfo> |
getRootViews()
Returns the ViewInfo objects for the top level views. |
Result |
insertChild(java.lang.Object parentView,
ILayoutPullParser childXml,
int index,
IAnimationListener listener)
Inserts a new child in a ViewGroup object, and renders the result. |
boolean |
isAlphaChannelImage()
Returns true if the current image alpha channel is relevant. |
Result |
moveChild(java.lang.Object parentView,
java.lang.Object childView,
int index,
java.util.Map<java.lang.String,java.lang.String> layoutParams,
IAnimationListener listener)
Move a new child to a different ViewGroup object. |
Result |
removeChild(java.lang.Object childView,
IAnimationListener listener)
Removes a child from a ViewGroup object. |
Result |
render()
Re-renders the layout as-is. |
Result |
render(long timeout)
Re-renders the layout as-is, with a given timeout in case other renderings are being done. |
Result |
setProperty(java.lang.Object objectView,
java.lang.String propertyName,
java.lang.String propertyValue)
Sets the value of a given property on a given object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RenderSession()
Method Detail |
---|
public Result getResult()
public java.util.List<ViewInfo> getRootViews()
ViewInfo
objects for the top level views.
In most case the list will only contain one item. If the top level node is merge
though then it will contain all the items under the merge
tag.
This is reset to a new instance every time render()
is called and can be
null
if the call failed (and the method returned a Result
with
Result.Status.ERROR_UNKNOWN
or Result.Status.NOT_IMPLEMENTED
.
This can be safely modified by the caller.
ViewInfo
or null if there aren't any.public java.awt.image.BufferedImage getImage()
This is reset to a new instance every time render()
is called and can be
null
if the call failed (and the method returned a Result
with
Result.Status.ERROR_UNKNOWN
or Result.Status.NOT_IMPLEMENTED
.
public boolean isAlphaChannelImage()
public java.util.Map<java.lang.String,java.lang.String> getDefaultProperties(java.lang.Object viewObject)
viewObject
- the view object.
public Result render()
getRootViews()
and
getImage()
to access the result of the rendering.
This is equivalent to calling render(SceneParams.DEFAULT_TIMEOUT)
Result
indicating the status of the action.public Result render(long timeout)
getRootViews()
and
getImage()
to access the result of the rendering.
The Bridge
is only able to inflate or render one layout at a time. There
is an internal lock object whenever such an action occurs. The timeout parameter is used
when attempting to acquire the lock. If the timeout expires, the method will return
Result.Status.ERROR_TIMEOUT
.
timeout
- timeout for the rendering, in milliseconds.
Result
indicating the status of the action.public Result setProperty(java.lang.Object objectView, java.lang.String propertyName, java.lang.String propertyValue)
render()
is required.
Any amount of actions can be taken on the scene before render()
is called.
objectView
- propertyName
- propertyValue
-
Result
indicating the status of the action.
java.lang.IllegalArgumentException
- if the view object is not an android.view.Viewpublic Result getProperty(java.lang.Object objectView, java.lang.String propertyName)
Result
object. If the operation of querying the object for its
property was successful (check Result.isSuccess()
), then the property value
is set in the result and can be accessed through Result.getData()
.
objectView
- propertyName
-
Result
indicating the status of the action.
java.lang.IllegalArgumentException
- if the view object is not an android.view.Viewpublic Result insertChild(java.lang.Object parentView, ILayoutPullParser childXml, int index, IAnimationListener listener)
removeChild(Object, IAnimationListener)
The returned Result
object will contain the android.view.View object for
the newly inflated child. It is accessible through Result.getData()
.
parentView
- the parent View object to receive the new child.childXml
- an ILayoutPullParser
containing the content of the new child,
including ViewGroup.LayoutParams attributes.index
- the index at which position to add the new child into the parent. -1 means at
the end.listener
- an optional IAnimationListener
.
Result
indicating the status of the action.public Result moveChild(java.lang.Object parentView, java.lang.Object childView, int index, java.util.Map<java.lang.String,java.lang.String> layoutParams, IAnimationListener listener)
removeChild(Object, IAnimationListener)
The returned Result
object will contain the android.view.ViewGroup.LayoutParams
object created from the layoutParams map if it was non null
.
parentView
- the parent View object to receive the child. Can be the current parent
already.childView
- the view to move.index
- the index at which position to add the new child into the parent. -1 means at
the end.layoutParams
- an optional map of new ViewGroup.LayoutParams attribute. If non null,
then the current layout params of the view will be removed and a new one will
be inflated and set with the content of the map.listener
- an optional IAnimationListener
.
Result
indicating the status of the action.public Result removeChild(java.lang.Object childView, IAnimationListener listener)
render()
is required.
Any amount of actions can be taken on the scene before render()
is called.
childView
- the view object to remove from its parentlistener
- an optional IAnimationListener
.
Result
indicating the status of the action.public Result animate(java.lang.Object targetObject, java.lang.String animationName, boolean isFrameworkAnimation, IAnimationListener listener)
targetObject
- the view object to animateanimationName
- the name of the animation (res/anim) to play.listener
- the listener callback.
Result
indicating the status of the action.public void dispose()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |