Search in sources :

Example 6 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 7 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 8 with Transition

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

the class TransitionSecondActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_transition_second);
    rowContainer = (LinearLayout) findViewById(R.id.row_container2);
    Slide slideExitTransition = new Slide(Gravity.BOTTOM);
    slideExitTransition.excludeTarget(android.R.id.navigationBarBackground, true);
    slideExitTransition.excludeTarget(android.R.id.statusBarBackground, true);
    getWindow().getEnterTransition().addListener(new TransitionAdapter() {

        @Override
        public void onTransitionEnd(Transition transition) {
            super.onTransitionEnd(transition);
            getWindow().getEnterTransition().removeListener(this);
            for (int i = 0; i < rowContainer.getChildCount(); i++) {
                View rowView = rowContainer.getChildAt(i);
                rowView.animate().setStartDelay(i * SCALE_DELAY).scaleX(1).scaleY(1);
            }
        }
    });
}
Also used : Slide(android.transition.Slide) TransitionAdapter(com.saulmm.material.utils.TransitionAdapter) Transition(android.transition.Transition) View(android.view.View)

Example 9 with Transition

use of android.transition.Transition in project BottomSheet by soarcn.

the class BottomSheet method showFullItems.

private void showFullItems() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Transition changeBounds = new ChangeBounds();
        changeBounds.setDuration(300);
        TransitionManager.beginDelayedTransition(list, changeBounds);
    }
    actions = fullMenuItem;
    updateSection();
    adapter.notifyDataSetChanged();
    list.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    icon.setVisibility(View.VISIBLE);
    icon.setImageDrawable(close);
    icon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showShortItems();
        }
    });
    setListLayout();
}
Also used : ChangeBounds(android.transition.ChangeBounds) Transition(android.transition.Transition) GridView(android.widget.GridView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 10 with Transition

use of android.transition.Transition in project platform_frameworks_base by android.

the class VolumeDialog method updateExpandedH.

private void updateExpandedH(final boolean expanded, final boolean dismissing) {
    if (mExpanded == expanded)
        return;
    mExpanded = expanded;
    mExpandButtonAnimationRunning = isAttached();
    if (D.BUG)
        Log.d(TAG, "updateExpandedH " + expanded);
    updateExpandButtonH();
    updateFooterH();
    TransitionManager.endTransitions(mDialogView);
    final VolumeRow activeRow = getActiveRow();
    if (!dismissing) {
        mWindow.setLayout(mWindow.getAttributes().width, ViewGroup.LayoutParams.MATCH_PARENT);
        AutoTransition transition = new AutoTransition();
        transition.setDuration(mExpandButtonAnimationDuration);
        transition.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
        transition.addListener(new Transition.TransitionListener() {

            @Override
            public void onTransitionStart(Transition transition) {
            }

            @Override
            public void onTransitionEnd(Transition transition) {
                mWindow.setLayout(mWindow.getAttributes().width, ViewGroup.LayoutParams.WRAP_CONTENT);
            }

            @Override
            public void onTransitionCancel(Transition transition) {
            }

            @Override
            public void onTransitionPause(Transition transition) {
                mWindow.setLayout(mWindow.getAttributes().width, ViewGroup.LayoutParams.WRAP_CONTENT);
            }

            @Override
            public void onTransitionResume(Transition transition) {
            }
        });
        TransitionManager.beginDelayedTransition(mDialogView, transition);
    }
    updateRowsH(activeRow);
    rescheduleTimeoutH();
}
Also used : AutoTransition(android.transition.AutoTransition) Transition(android.transition.Transition) AutoTransition(android.transition.AutoTransition)

Aggregations

Transition (android.transition.Transition)160 TransitionSet (android.transition.TransitionSet)57 View (android.view.View)51 ViewGroup (android.view.ViewGroup)36 ArrayList (java.util.ArrayList)20 TransitionInflater (android.transition.TransitionInflater)19 ViewTreeObserver (android.view.ViewTreeObserver)18 Fade (android.transition.Fade)17 ChangeBounds (android.transition.ChangeBounds)14 TextView (android.widget.TextView)11 TargetApi (android.annotation.TargetApi)10 Rect (android.graphics.Rect)10 List (java.util.List)10 AutoTransition (android.transition.AutoTransition)9 Scene (android.transition.Scene)8 ObjectAnimator (android.animation.ObjectAnimator)7 AdapterView (android.widget.AdapterView)6 ImageView (android.widget.ImageView)6 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5