Search in sources :

Example 81 with Transition

use of android.transition.Transition in project focus-android by mozilla-mobile.

the class FirstrunFragment method onAttach.

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    final Transition transition = TransitionInflater.from(context).inflateTransition(R.transition.firstrun_exit);
    setExitTransition(transition);
    // We will send a telemetry event whenever a new firstrun page is shown. However this page
    // listener won't fire for the initial page we are showing. So we are going to firing here.
    TelemetryWrapper.showFirstRunPageEvent(0);
}
Also used : Transition(android.transition.Transition)

Example 82 with Transition

use of android.transition.Transition in project Material-Movies by saulmm.

the class TransitionUtils method makeSharedElementEnterTransition.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static Transition makeSharedElementEnterTransition(Context context) {
    Transition changeBounds = new ChangeBounds();
    changeBounds.addTarget(R.id.item_movie_cover);
    return changeBounds;
}
Also used : ChangeBounds(android.transition.ChangeBounds) Transition(android.transition.Transition) TargetApi(android.annotation.TargetApi)

Example 83 with Transition

use of android.transition.Transition in project Material-Movies by saulmm.

the class MovieDetailActivity method configureEnterTransition.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void configureEnterTransition() {
    getWindow().setSharedElementEnterTransition(TransitionUtils.makeSharedElementEnterTransition(this));
    postponeEnterTransition();
    int moviePosition = getIntent().getIntExtra(MoviesActivity.EXTRA_MOVIE_POSITION, 0);
    mCoverImageView.setTransitionName(MoviesActivity.SHARED_ELEMENT_COVER + moviePosition);
    mObservableScrollView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override
        public boolean onPreDraw() {
            mObservableScrollView.getViewTreeObserver().removeOnPreDrawListener(this);
            startPostponedEnterTransition();
            return true;
        }
    });
    getWindow().getSharedElementEnterTransition().addListener(new TransitionAdapter() {

        @Override
        public void onTransitionEnd(Transition transition) {
            super.onTransitionEnd(transition);
            animateElementsByScale();
        }
    });
}
Also used : TransitionAdapter(com.hackvg.android.views.custom_listeners.TransitionAdapter) Transition(android.transition.Transition) ViewTreeObserver(android.view.ViewTreeObserver) TargetApi(android.annotation.TargetApi)

Example 84 with Transition

use of android.transition.Transition in project packages_apps_Contacts by AOKP.

the class ExpandingEntryCardView method expand.

private void expand() {
    ChangeBounds boundsTransition = new ChangeBounds();
    boundsTransition.setDuration(DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
    Fade fadeIn = new Fade(Fade.IN);
    fadeIn.setDuration(DURATION_EXPAND_ANIMATION_FADE_IN);
    fadeIn.setStartDelay(DELAY_EXPAND_ANIMATION_FADE_IN);
    TransitionSet transitionSet = new TransitionSet();
    transitionSet.addTransition(boundsTransition);
    transitionSet.addTransition(fadeIn);
    transitionSet.excludeTarget(R.id.text, /* exclude = */
    true);
    final ViewGroup transitionViewContainer = mAnimationViewGroup == null ? this : mAnimationViewGroup;
    transitionSet.addListener(new TransitionListener() {

        @Override
        public void onTransitionStart(Transition transition) {
            mListener.onExpand();
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            mListener.onExpandDone();
        }

        @Override
        public void onTransitionCancel(Transition transition) {
        }

        @Override
        public void onTransitionPause(Transition transition) {
        }

        @Override
        public void onTransitionResume(Transition transition) {
        }
    });
    TransitionManager.beginDelayedTransition(transitionViewContainer, transitionSet);
    mIsExpanded = true;
    // In order to insert new entries, we may need to inflate them for the first time
    inflateAllEntries(LayoutInflater.from(getContext()));
    insertEntriesIntoViewGroup();
    updateExpandCollapseButton(getCollapseButtonText(), DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
}
Also used : TransitionSet(android.transition.TransitionSet) ChangeBounds(android.transition.ChangeBounds) ViewGroup(android.view.ViewGroup) Transition(android.transition.Transition) TransitionListener(android.transition.Transition.TransitionListener) Fade(android.transition.Fade)

Example 85 with Transition

use of android.transition.Transition in project animate by hitherejoe.

the class TransitionInActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_transition_in);
    ButterKnife.bind(this);
    String transition = getIntent().getStringExtra(EXTRA_TRANSITION);
    switch(transition) {
        case TRANSITION_SLIDE_RIGHT:
            Transition transitionSlideRight = TransitionInflater.from(this).inflateTransition(R.transition.slide_right);
            getWindow().setEnterTransition(transitionSlideRight);
            break;
        case TRANSITION_SLIDE_BOTTOM:
            Transition transitionSlideBottom = TransitionInflater.from(this).inflateTransition(R.transition.slide_bottom);
            getWindow().setEnterTransition(transitionSlideBottom);
            break;
        case TRANSITION_FADE_FAST:
            Transition transitionFadeFast = TransitionInflater.from(this).inflateTransition(R.transition.fade_fast);
            getWindow().setEnterTransition(transitionFadeFast);
            break;
        case TRANSITION_FADE_SLOW:
            Transition transitionFadeSlow = TransitionInflater.from(this).inflateTransition(R.transition.fade_slow);
            getWindow().setEnterTransition(transitionFadeSlow);
            break;
        case TRANSITION_EXPLODE:
            Transition transitionExplode = TransitionInflater.from(this).inflateTransition(R.transition.explode);
            getWindow().setEnterTransition(transitionExplode);
            break;
        case TRANSITION_EXPLODE_BOUNCE:
            Transition transitionExplodeBounce = TransitionInflater.from(this).inflateTransition(R.transition.explode_bounce);
            getWindow().setEnterTransition(transitionExplodeBounce);
            break;
    }
    setSupportActionBar(mToolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null)
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Also used : Transition(android.transition.Transition) ActionBar(android.support.v7.app.ActionBar)

Aggregations

Transition (android.transition.Transition)176 TransitionSet (android.transition.TransitionSet)62 View (android.view.View)54 ViewGroup (android.view.ViewGroup)37 ArrayList (java.util.ArrayList)23 TransitionInflater (android.transition.TransitionInflater)19 Fade (android.transition.Fade)18 ViewTreeObserver (android.view.ViewTreeObserver)18 ChangeBounds (android.transition.ChangeBounds)17 Rect (android.graphics.Rect)12 List (java.util.List)12 TargetApi (android.annotation.TargetApi)11 TextView (android.widget.TextView)11 AutoTransition (android.transition.AutoTransition)10 Scene (android.transition.Scene)8 ObjectAnimator (android.animation.ObjectAnimator)7 Fragment (android.support.v4.app.Fragment)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 AdapterView (android.widget.AdapterView)6 ImageView (android.widget.ImageView)6