Example usage for android.transition Fade addListener

List of usage examples for android.transition Fade addListener

Introduction

In this page you can find the example usage for android.transition Fade addListener.

Prototype

public Transition addListener(TransitionListener listener) 

Source Link

Document

Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end.

Usage

From source file:org.huxizhijian.hhcomicviewer.ui.entry.ComicDetailsActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setupEnterAnimations() {
    Fade enterTransition = new Fade(); //
    getWindow().setEnterTransition(enterTransition);
    enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));//
    enterTransition.addListener(new Transition.TransitionListener() {
        @Override/*  ww w  .j a  v a2s.com*/
        public void onTransitionStart(Transition transition) {
            transition.removeListener(this);
            animateRevealShow(mBinding.appBarComicDetails);//toolbar
        }

        @Override
        public void onTransitionEnd(Transition transition) {

        }

        @Override
        public void onTransitionCancel(Transition transition) {

        }

        @Override
        public void onTransitionPause(Transition transition) {

        }

        @Override
        public void onTransitionResume(Transition transition) {

        }
    });
}

From source file:org.huxizhijian.hhcomicviewer.ui.entry.ComicDetailsActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setupExitAnimations() {
    Fade returnTransition = new Fade(); //
    getWindow().setReturnTransition(returnTransition);
    returnTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));//
    returnTransition.addListener(new Transition.TransitionListener() {
        @Override// w  ww .ja  va 2  s .  c o  m
        public void onTransitionStart(Transition transition) {
            //?
            transition.removeListener(this);
            mBinding.FABComicDetails.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onTransitionEnd(Transition transition) {
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
}

From source file:com.zertinteractive.wallpaper.MainActivity.java

@SuppressWarnings("NewApi")
private void setupExitAnimations() {
    Fade returnTransition = new Fade();
    getWindow().setReturnTransition(returnTransition);
    returnTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
    returnTransition.setStartDelay(getResources().getInteger(R.integer.anim_duration_medium));
    returnTransition.addListener(new Transition.TransitionListener() {
        @Override/*from   w  w w  .  j  a v a 2s .com*/
        public void onTransitionStart(Transition transition) {
            transition.removeListener(this);
            animateButtonsOut();
            animateRevealHide(recyclerView);
        }

        @Override
        public void onTransitionEnd(Transition transition) {
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
}