Use a transition to define changes between panels. You can define a transition to describe how and when to make a change between two variants of a panel. You can define a list of transitions for each panel.
Use the <Transitions>
XML tag as a container for one or more <Transition>
definitions in the configuration of a single <TaskPanel>
or <DecorPanel>
.
You can use this tag to define a set of animation rules to govern when and how
a panel should change the visual state from one distinct variant to another.
XML attributes
The <Transitions>
tag can define default values for these child <Transition>
elements:
Attribute | Status | Description |
---|---|---|
<defaultDuration> |
Optional | Specifies a default duration in milliseconds to be applied to all
child <Transition> The system's |
defaultInterpolator |
Optional | References an Android Interpolator XML resource ID. For example,
If no default interpolator is specified, the system typically defaults
to an |
XML child elements
The child element of <Transitions>
is <Transition>
, the core element
used to define a specific animation path between PanelState
variants. Multiple
<Transition>
elements can be nested within a single <Transitions>
block.
Sample code
In this sample, fromVariant
is optional. When not defined, the current
variant is used. If fromVariant
is defined, the transition is used only
when all parameters match. Parameters are specified in the Event and
fromVariant
.
<Transitions defaultDuration="400"
defaultInterpolator="@android:anim/linear_interpolator">
<Transition fromVariant="closed_app"
toVariant="opened_app">
<Event id="app_opened" panel="application_panel" />
</Transition>
</Transitions>
Transition
A transition describes how to animate a change in visual state between two variants of a panel. A transition outlines the path from a variant to a variant. To do so, the transition specifies details such as the animation to apply and the event needed to trigger the animation.
For a panel, transitions can define animations for properties such as bounds, visibility, and alpha. If a custom animator is not specified, a default animator is used.
XML attributes
The <Transition>
tag uses several attributes to define the characteristics of
the animation and the conditions under which it is to occur.
XML child elements
<Event>
defines the properties of the event that can trigger the transition.
Attribute | Status | Description |
---|---|---|
<id> |
Mandatory | Unique identifier of the event to activate the trigger. |
<panelId> |
Optional | Unique identifier of the panel associated with the event. |
componentName |
Optional | Component name associated with this event. |
packageName |
Optional | Package name associated with the event. |
Sample code
<Transitions defaultDuration="400"
defaultInterpolator="@android:anim/accelerate_interpolator">
<!-- A transition from 'closed_app' to 'opened_app' variant, triggered by 'open_app_event' -->
<Transition fromVariant="closed_app"
toVariant="opened_app">
<Event id="app_opened" panel="application_panel" />
<Transition>
<!-- A transition from 'opened_app' to 'closed_app' variant, using a custom animator -->
<Transition fromVariant="opened_app"
toVariant="closed_app"
animator="@animator/close_app">
<Event id="_System_PanelEmptyEvent"
panelId="application_panel" />
<Transition>
</Transitions>