-
Notifications
You must be signed in to change notification settings - Fork 386
Basic animations
You can animate opening from any view to GestureView
with gestureView.getPositionAnimator()
.
To make it possible your should have small "from" view and full screen "to" GestureView
, both views should hold same content (image). Once views are ready you can use next methods of PositionAnimator
to perform animation.
To start animation call:
enter(View from, boolean withAnimation)
- or -
enter(ViewPosition fromPos, boolean withAnimation)
To exit from GestureView
call:
exit(boolean withAnimation)
While GestureView
is opened "from" view can be changed (i.e. if notifyDataSetChanged()
was called for ListView). In this case you will need to update "from" view:
update(View from)
- or -
update(ViewPosition fromPos)
To check that GestureView
is currently opened you may use method:
isLeaving()
Typical usage of this method is next:
@Override
public void onBackPressed() {
if (!gestureView.getPositionAnimator().isLeaving()) {
gestureView.getPositionAnimator().exit(true);
} else {
super.onBackPressed();
}
}
In most cases you will need to listen for opening animation state to update other views accordingly. That can be done with:
addPositionUpdateListener(PositionUpdateListener listener)
removePositionUpdateListener(PositionUpdateListener listener)
Animation duration can be set with:
gestureView.getPositionAnimator().setDuration(long duration)