List of usage examples for android.transition TransitionInflater from
public static TransitionInflater from(Context context)
From source file:org.mozilla.focus.fragment.FirstrunFragment.java
@Override public void onAttach(Context context) { super.onAttach(context); final Transition transition = TransitionInflater.from(context) .inflateTransition(R.transition.firstrun_exit); setExitTransition(transition);/*from w w w.j a va 2 s. com*/ }
From source file:com.bluros.music.utils.NavigationUtils.java
@TargetApi(21) public static void navigateToAlbum(Activity context, long albumID, Pair<View, String> transitionViews) { FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager() .beginTransaction();//w w w . j av a2 s. c o m Fragment fragment; if (MusicUtils.isLollipop() && transitionViews != null && PreferencesUtility.getInstance(context).getAnimations()) { Transition changeImage = TransitionInflater.from(context) .inflateTransition(R.transition.image_transform); transaction.addSharedElement(transitionViews.first, transitionViews.second); fragment = AlbumDetailFragment.newInstance(albumID, true, transitionViews.second); fragment.setSharedElementEnterTransition(changeImage); } else { transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out); fragment = AlbumDetailFragment.newInstance(albumID, false, null); } transaction.hide(((AppCompatActivity) context).getSupportFragmentManager() .findFragmentById(R.id.fragment_container)); transaction.add(R.id.fragment_container, fragment); transaction.addToBackStack(null).commit(); }
From source file:com.hippo.ehviewer.ui.scene.EnterGalleryDetailTransaction.java
@Override public boolean onTransition(Context context, FragmentTransaction transaction, Fragment exit, Fragment enter) { if (mThumb == null || !(enter instanceof GalleryDetailScene)) { return false; }// www .j av a2 s . co m if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { exit.setSharedElementReturnTransition( TransitionInflater.from(context).inflateTransition(R.transition.trans_move)); exit.setExitTransition(TransitionInflater.from(context).inflateTransition(android.R.transition.fade)); enter.setSharedElementEnterTransition( TransitionInflater.from(context).inflateTransition(R.transition.trans_move)); enter.setEnterTransition(TransitionInflater.from(context).inflateTransition(android.R.transition.fade)); transaction.addSharedElement(mThumb, mThumb.getTransitionName()); } return true; }
From source file:com.techmighty.baseplayer.utils.NavigationUtils.java
@TargetApi(21) public static void navigateToAlbum(Activity context, long albumID, Pair<View, String> transitionViews) { FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager() .beginTransaction();// w w w.ja va2 s . c om Fragment fragment; if (BasePlayerUtils.isLollipop() && transitionViews != null && PreferencesUtility.getInstance(context).getAnimations()) { Transition changeImage = TransitionInflater.from(context) .inflateTransition(R.transition.image_transform); transaction.addSharedElement(transitionViews.first, transitionViews.second); fragment = AlbumDetailFragment.newInstance(albumID, true, transitionViews.second); fragment.setSharedElementEnterTransition(changeImage); } else { transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out); fragment = AlbumDetailFragment.newInstance(albumID, false, null); } transaction.hide(((AppCompatActivity) context).getSupportFragmentManager() .findFragmentById(R.id.fragment_container)); transaction.add(R.id.fragment_container, fragment); transaction.addToBackStack(null).commit(); }
From source file:com.devalladolid.musictoday.utils.NavigationUtils.java
@TargetApi(21) public static void navigateToAlbum(Activity context, long albumID, Pair<View, String> transitionViews) { FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager() .beginTransaction();/*from w w w . j a v a2 s . c om*/ Fragment fragment; if (TimberUtils.isLollipop() && transitionViews != null && PreferencesUtility.getInstance(context).getAnimations()) { Transition changeImage = TransitionInflater.from(context) .inflateTransition(R.transition.image_transform); transaction.addSharedElement(transitionViews.first, transitionViews.second); fragment = AlbumDetailFragment.newInstance(albumID, true, transitionViews.second); fragment.setSharedElementEnterTransition(changeImage); } else { transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out); fragment = AlbumDetailFragment.newInstance(albumID, false, null); } transaction.hide(((AppCompatActivity) context).getSupportFragmentManager() .findFragmentById(R.id.fragment_container)); transaction.add(R.id.fragment_container, fragment); transaction.addToBackStack(null).commit(); }
From source file:org.xbmc.kore.utils.SharedElementTransition.java
/** * Sets up the transition for the exiting fragment * @param fragment//from w w w. ja v a 2 s .com */ @TargetApi(21) public void setupExitTransition(Context context, Fragment fragment) { Transition fade = TransitionInflater.from(context).inflateTransition(android.R.transition.fade); fragment.setExitTransition(fade); fragment.setReenterTransition(fade); fragment.setExitSharedElementCallback(new SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { // Clearing must be done in the reentering fragment // as this is called last. Otherwise, the app will crash during transition setup. Not sure, but might // be a v4 support package bug. if (clearSharedElements) { names.clear(); sharedElements.clear(); clearSharedElements = false; } } }); }
From source file:com.andryr.musicplayer.utils.NavigationUtils.java
@SuppressLint("NewApi") public static void showFragment(FragmentActivity activity, Fragment firstFragment, Fragment secondFragment, @Nullable Pair<View, String>... transitionViews) { boolean lollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; if (lollipop) { firstFragment.setSharedElementReturnTransition( TransitionInflater.from(activity).inflateTransition(R.transition.change_image_transform)); secondFragment.setSharedElementEnterTransition( TransitionInflater.from(activity).inflateTransition(R.transition.change_image_transform)); }/* ww w .j a va 2 s .c om*/ FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction() .replace(R.id.container, secondFragment).addToBackStack(null); if (lollipop && transitionViews != null) { for (Pair<View, String> tr : transitionViews) { ft.addSharedElement(tr.first, tr.second); } } ft.commit(); }
From source file:org.xbmc.kore.ui.FileActivity.java
@TargetApi(21) @Override//from w ww .ja va2s . c o m protected void onCreate(Bundle savedInstanceState) { // Request transitions on lollipop if (Utils.isLollipopOrLater()) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_generic_media); // Set up the drawer. navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); if (savedInstanceState == null) { FileListFragment fileListFragment = new FileListFragment(); // Setup animations if (Utils.isLollipopOrLater()) { fileListFragment.setExitTransition(null); fileListFragment.setReenterTransition( TransitionInflater.from(this).inflateTransition(android.R.transition.fade)); } getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fileListFragment).commit(); } setupActionBar(getString(R.string.file_browser)); }
From source file:com.asy.animations.ui.fragment.HeroesMainActivity.java
public void goToHeroeDetail(Heroe heroe, HeroesAdapter.Holder holder) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); heroeDetailFragment = HeroeDetailFragment.newInstance(heroe); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // Inflate transitions to apply Transition changeTransform = TransitionInflater.from(this) .inflateTransition(R.transition.change_image_transform); Transition explodeTransform = TransitionInflater.from(this) .inflateTransition(android.R.transition.explode); // // Setup exit transition on first fragment heroesListFragment.setSharedElementReturnTransition(changeTransform); heroesListFragment.setExitTransition(explodeTransform); // Setup enter transition on second fragment heroeDetailFragment.setSharedElementEnterTransition(changeTransform); heroeDetailFragment.setEnterTransition(explodeTransform); transaction.addSharedElement(holder.getIvAvatar(), getString(R.string.transition_avatar)); }//from w ww . ja v a2s . co m transaction.addToBackStack(null); transaction.replace(R.id.main_container, heroeDetailFragment); transaction.commit(); }
From source file:io.vit.vitio.Fragments.CampusMapFragment.java
private void setTransitions() { if (Build.VERSION.SDK_INT >= 21) { setExitTransition(/*w w w .j av a2 s. c om*/ TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.explode)); setReenterTransition( TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.fade)); } }