Interface TransitionContext
-
public interface TransitionContextThe stage on which aTransitionanimates a page change.Given to
Transition.run(TransitionContext, TransitionListener), it exposes the outgoing and incoming content, the content area size, and the two primitives a transition uses to render itself:positionContents(int, int, int, int)to slide the content widgets, andblendIncoming(int)to fade the incoming content in over the outgoing one. A transition registers itsAnimationwithanimate(Animation)so the navigator can snap it to completion if a new navigation interrupts it.Both content widgets share the same content area, laid out to fill it. Coordinates passed to
positionContents(int, int, int, int)are relative to the top-left of the content area.The navigator supplies the implementation; an application consumes this interface from its
Transitionand is not expected to implement it.- Since:
- 0.2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidanimate(Animation animation)Registers and starts the animation that drives this transition.voidblendIncoming(int opacity)Blends the incoming content over the outgoing one at the given opacity and requests a render.intgetContentHeight()Returns the height of the content area shared by both contents.intgetContentWidth()Returns the width of the content area shared by both contents.WidgetgetIncomingContent()Returns the content of the page being entered.WidgetgetOutgoingContent()Returns the content of the page being left, ornullwhen there is none.voidpositionContents(int outgoingX, int outgoingY, int incomingX, int incomingY)Positions the outgoing and incoming contents within the content area and requests a render.
-
-
-
Method Detail
-
getOutgoingContent
@Nullable Widget getOutgoingContent()
Returns the content of the page being left, ornullwhen there is none.- Returns:
- the outgoing content, or
nullif there is none.
-
getIncomingContent
Widget getIncomingContent()
Returns the content of the page being entered.- Returns:
- the incoming content.
-
getContentWidth
int getContentWidth()
Returns the width of the content area shared by both contents.- Returns:
- the content width in pixels.
-
getContentHeight
int getContentHeight()
Returns the height of the content area shared by both contents.- Returns:
- the content height in pixels.
-
positionContents
void positionContents(int outgoingX, int outgoingY, int incomingX, int incomingY)Positions the outgoing and incoming contents within the content area and requests a render.Coordinates are relative to the top-left of the content area. When there is no outgoing content, its coordinates are ignored.
- Parameters:
outgoingX- the x of the outgoing content.outgoingY- the y of the outgoing content.incomingX- the x of the incoming content.incomingY- the y of the incoming content.
-
blendIncoming
void blendIncoming(int opacity)
Blends the incoming content over the outgoing one at the given opacity and requests a render.- Parameters:
opacity- the incoming content opacity, from0(fully transparent) to255(fully opaque).
-
animate
void animate(Animation animation)
Registers and starts the animation that drives this transition.The navigator stops this animation if a new navigation interrupts the transition.
- Parameters:
animation- the animation to run.
-
-