private void startTransition(){ lifeGridFragment = LifeGridFragment.newInstance(); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); if(Build.VERSION.SDK_INT >= 21) { TransitionSet gridTransition = new TransitionSet(); gridTransition.setDuration(600); gridTransition.addTransition(new ChangeBounds()); gridTransition.addTransition((new ChangeTransform())); lifeGridFragment.setSharedElementEnterTransition(gridTransition); } fragmentTransaction.addSharedElement(findViewById(R.id.intro_card_view), getString(R.string.card_view_transition_name)); fragmentTransaction.replace(R.id.container, lifeGridFragment); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); appBarLayout.setExpanded(false, true); }
@NonNull @Override protected Transition createTransition(@NonNull ViewGroup container, @NonNull View entering, @Nullable View leaving, boolean push) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return new TransitionSet() .setOrdering(ORDERING_TOGETHER) .addTransition(new Fade(Fade.OUT)) .addTransition(new Fade(Fade.IN)); } final TransitionSet transition = new TransitionSet() .addTransition(new ChangeBounds()) .addTransition(new ChangeClipBounds()) .addTransition(new ChangeTransform()); transition.setPathMotion(new ArcMotion()); return transition; }
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); } }
@Override @NonNull protected Transition getTransition(@NonNull ViewGroup container, View from, View to, boolean isPush) { TransitionSet transition = new TransitionSet() .setOrdering(TransitionSet.ORDERING_SEQUENTIAL) .addTransition(new Fade(Fade.OUT)) .addTransition(new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeClipBounds()).addTransition(new ChangeTransform())) .addTransition(new Fade(Fade.IN)); transition.setPathMotion(new ArcMotion()); return transition; }
public FragmentSharedElementTransition() { addTransition(new ChangeBounds()); addTransition(new Fade()); addTransition(new ChangeImageTransform()); addTransition(new ChangeTransform()); setInterpolator(new FastOutSlowInInterpolator()); }
public ImageTransition() { setOrdering(ORDERING_TOGETHER); addTransition(new ChangeBounds()); addTransition(new ChangeTransform()); addTransition(new ChangeImageTransform()); setPathMotion(new ArcMotion()); }
static public LinkStoryFragment getInstance(Story story, boolean isExpanded) { LinkStoryFragment f = new LinkStoryFragment(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { f.setSharedElementEnterTransition(new ChangeTransform()); } f.setSharedElementEnterTransition(new ChangeBounds()); } Bundle bundle = new Bundle(); bundle.putBoolean("isExpanded", isExpanded); bundle.putParcelable("story", Parcels.wrap(story)); f.setArguments(bundle); return f; }
static public FileStoryFragment getInstance(Story story, boolean isExpanded) { FileStoryFragment f = new FileStoryFragment(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { f.setSharedElementEnterTransition(new ChangeTransform()); } f.setSharedElementEnterTransition(new ChangeBounds()); } Bundle bundle = new Bundle(); bundle.putBoolean("isExpanded", isExpanded); bundle.putParcelable("story", Parcels.wrap(story)); f.setArguments(bundle); return f; }
static public TopicStoryFragment getInstance(Story story, boolean isExpanded) { TopicStoryFragment f = new TopicStoryFragment(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { f.setSharedElementEnterTransition(new ChangeTransform()); } f.setSharedElementEnterTransition(new ChangeBounds()); } Bundle bundle = new Bundle(); bundle.putBoolean("isExpanded", isExpanded); bundle.putParcelable("story", Parcels.wrap(story)); f.setArguments(bundle); return f; }
@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()); }
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); }
public static Object createScale() { return new ChangeTransform(); }
private void init() { setOrdering(ORDERING_TOGETHER); this.addTransition(new ChangeBounds()) .addTransition(new ChangeTransform()) .addTransition(new ChangeImageTransform()); }