Skip to content

Basic animations

Alex Vasilkov edited this page Oct 21, 2015 · 3 revisions

You can animate opening from any view to GestureView with gestureView.getPositionAnimator().

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:

setDuration(long duration)
Clone this wiki locally