@Override protected void onCreate(Bundle savedInstanceState) { // getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); Slide slideIn = new Slide(); slideIn.setDuration(500); //设置为进入 slideIn.setMode(Visibility.MODE_IN); //设置从右边进入 slideIn.setSlideEdge(Gravity.RIGHT); getWindow().setEnterTransition(new ChangeImageTransform().setDuration(3000)); // getWindow().setEnterTransition(new Explode().setDuration(2000)); // getWindow().setExitTransition(new Explode().setDuration(2000)); Slide slideReturn =new Slide(); slideReturn.setDuration(500); slideReturn.setSlideEdge(Gravity.LEFT); slideReturn.setMode(Visibility.MODE_OUT); getWindow().setReturnTransition (slideReturn ); setContentView(R.layout.activity_img_transition); mImageView = (ImageView) findViewById(R.id.img); // Transition sharedElementEnterTransition = getWindow().getSharedElementEnterTransition(); }
private void initAnimation() { if (Build.VERSION.SDK_INT >= 21) { //To enable window content transitions in your code instead, call the Window.requestFeature() method: getWindow().requestFeature(android.view.Window.FEATURE_CONTENT_TRANSITIONS); Transition ts_enter = new ChangeImageTransform(); //Slide(); //Explode(); Transition ts_exit = new ChangeTransform(); ts_enter.setDuration(400); ts_exit.setDuration(400); /* If you have set an enter transition for the second activity, the transition is also activated when the activity starts. */ getWindow().setEnterTransition(ts_enter); getWindow().setExitTransition(ts_exit); } }
public FragmentSharedElementTransition() { addTransition(new ChangeBounds()); addTransition(new Fade()); addTransition(new ChangeImageTransform()); addTransition(new ChangeTransform()); setInterpolator(new FastOutSlowInInterpolator()); }
@TargetApi(TARGET_API) private Transition getDefaultTransition() { TransitionSet set = new TransitionSet(); set.addTransition(new ChangeBounds()); set.addTransition(new Fade()); set.addTransition(new ChangeImageTransform()); set.setInterpolator(new FastOutSlowInInterpolator()); return set; }
public ImageTransition() { setOrdering(ORDERING_TOGETHER); addTransition(new ChangeBounds()); addTransition(new ChangeTransform()); addTransition(new ChangeImageTransform()); setPathMotion(new ArcMotion()); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void init() { setOrdering(ORDERING_TOGETHER); addTransition(new ChangeBounds()). addTransition(new ChangeTransform()). addTransition(new ChangeImageTransform()); super.addListener(this); }
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public DetailsTransition() { setOrdering(ORDERING_TOGETHER); addTransition(new ChangeBounds()) .addTransition(new ChangeTransform()) .addTransition(new ChangeImageTransform()); }
@Override public void showMovieDetails(Movie movie, MovieListItemBinding B) { setSelectedMovie(movie); if (isTwoPane()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { fragmentTwoPane = MovieDetailFragment.newInstance(movie); fragmentTwoPane.setSharedElementEnterTransition(new ChangeImageTransform()); getSupportFragmentManager().beginTransaction() .replace(R.id.movieDetailContainer, fragmentTwoPane) .addToBackStack(null) .addSharedElement(B.imagePoster, getString(R.string.poster_image_transition)) .commit(); } else { loadTwoPaneMovieDetails(movie); } } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { //Shared Element Transition of Poster Image from Master List to Detail screen ActivityOptionsCompat profileImageTransitionOptions = ActivityOptionsCompat .makeSceneTransitionAnimation(this, B.imagePoster, getString(R.string.poster_image_transition)); MovieDetailActivity.start(this, movie, profileImageTransitionOptions); } else { MovieDetailActivity.start(this, movie); } } }
public SharedElementTransition(Context context, AttributeSet attrs) { super(context, attrs); fabTransition = new CircleTransition(context, attrs); imageTransition = new ChangeImageTransform(context, attrs); defaultTransition = new ChangeBounds(context, attrs); fabTransitionName = context.getString(R.string.transition_fab); transitionProperties = initTransProps(); if (BuildConfig.DEBUG && TextUtils.isEmpty(fabTransitionName)) { throw new AssertionError("Transition name should not be empty"); } }
private void setupTransition() { int transitionType = getIntent().getIntExtra(EXTRA_TRANSITION_TYPE, -1); Window window = getWindow(); window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); window.setAllowEnterTransitionOverlap(true); switch (transitionType) { case TRAN_TYPE_EXPLODE: window.setEnterTransition(new Explode()); window.setExitTransition(new Explode()); break; case TRAN_TYPE_SLIDE: window.setEnterTransition(new Slide(Gravity.LEFT)); window.setExitTransition(new Slide(Gravity.RIGHT)); break; case TRAN_TYPE_FADE: window.setEnterTransition(new Fade(Fade.MODE_IN)); window.setExitTransition(new Fade(Fade.MODE_OUT)); break; case TRAN_TYPE_VIEW_SHARE: window.requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS); window.setSharedElementEnterTransition(new ChangeImageTransform()); window.setSharedElementExitTransition(new ChangeImageTransform()); break; } }
private void init() { setOrdering(ORDERING_TOGETHER); addTransition(new ChangeBounds()). addTransition(new ChangeTransform()). addTransition(new ChangeImageTransform()); }
private MorphTransition(int shape) { setOrdering(ORDERING_TOGETHER); addTransition(new MusicCoverViewTransition(shape)); addTransition(new ChangeImageTransform()); addTransition(new ChangeTransform()); }
public DetailTransition() { setOrdering(ORDERING_TOGETHER); addTransition(new ChangeBounds()) .addTransition(new ChangeTransform()) . addTransition(new ChangeImageTransform()); }
private void setTransition() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } final TransitionSet transition = new TransitionSet(); ChangeBounds transition1 = new ChangeBounds(); transition.addTransition(transition1); ChangeTransform transition2 = new ChangeTransform(); transition.addTransition(transition2); ChangeClipBounds transition3 = new ChangeClipBounds(); transition.addTransition(transition3); ChangeImageTransform transition4 = new ChangeImageTransform(); transition.addTransition(transition4); transition.setDuration(SHARED_ELEMENT_TRANSITION_DURATION); FastOutSlowInInterpolator interpolator = new FastOutSlowInInterpolator(); transition1.setInterpolator(interpolator); transition2.setInterpolator(interpolator); transition3.setInterpolator(interpolator); transition4.setInterpolator(interpolator); final GravityArcMotion pathMotion = new GravityArcMotion(); transition.setPathMotion(pathMotion); getWindow().setSharedElementEnterTransition(transition); getWindow().setSharedElementReturnTransition(transition); getWindow().setSharedElementsUseOverlay(false); Slide slide = new Slide(Gravity.TOP); slide.setInterpolator(new LinearOutSlowInInterpolator()); slide.addTarget(appBar); slide.setDuration(225); slide.setStartDelay(100); getWindow().setEnterTransition(slide); Slide slideOut = (Slide) slide.clone(); slideOut.setInterpolator(new FastOutLinearInInterpolator()); slideOut.setStartDelay(0); getWindow().setReturnTransition(slideOut); }
@Override protected Transition createTransition() { TransitionSet transition = new TransitionSet(); transition.addTransition(new ChangeBounds()).addTransition(new ChangeImageTransform()); return transition; }
private void init() { setOrdering(ORDERING_TOGETHER); this.addTransition(new ChangeBounds()) .addTransition(new ChangeTransform()) .addTransition(new ChangeImageTransform()); }