List of usage examples for android.transition TransitionInflater from
public static TransitionInflater from(Context context)
From source file:org.sufficientlysecure.keychain.ui.ViewKeyFragment.java
private void showLinkedId(final int position) { final LinkedIdViewFragment frag; try {//from ww w. ja v a 2s . c o m frag = mLinkedIdsAdapter.getLinkedIdFragment(mDataUri, position, mFingerprint); } catch (IOException e) { Log.e(Constants.TAG, "IOException", e); return; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Transition trans = TransitionInflater.from(getActivity()) .inflateTransition(R.transition.linked_id_card_trans); // setSharedElementReturnTransition(trans); setExitTransition(new Fade()); frag.setSharedElementEnterTransition(trans); } getFragmentManager().beginTransaction().add(R.id.view_key_fragment, frag).hide(frag).commit(); frag.setOnIdentityLoadedListener(new OnIdentityLoadedListener() { @Override public void onIdentityLoaded() { new Handler().post(new Runnable() { @Override public void run() { getFragmentManager().beginTransaction().show(frag) .addSharedElement(mLinkedIdsCard, "card_linked_ids").remove(ViewKeyFragment.this) .addToBackStack("linked_id").commit(); } }); } }); }
From source file:org.xbmc.kore.ui.PVRActivity.java
/** * Callback from list fragment when the channel guide should be displayed. * Setup action bar and repolace list fragment * @param channelId Channel selected/*from ww w. j ava2 s. c o m*/ * @param channelTitle Title */ @TargetApi(21) public void onChannelGuideSelected(int channelId, String channelTitle) { selectedChannelId = channelId; selectedChannelTitle = channelTitle; // Replace list fragment PVRChannelEPGListFragment pvrEPGFragment = PVRChannelEPGListFragment.newInstance(channelId); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); // Set up transitions if (Utils.isLollipopOrLater()) { pvrEPGFragment.setEnterTransition( TransitionInflater.from(this).inflateTransition(R.transition.media_details)); pvrEPGFragment.setReturnTransition(null); } else { fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0, R.anim.fragment_list_popenter, 0); } fragTrans.replace(R.id.fragment_container, pvrEPGFragment).addToBackStack(null).commit(); setupActionBar(selectedChannelGroupTitle, selectedChannelTitle); }
From source file:com.syncedsynapse.kore2.ui.TVShowsActivity.java
/** * Callback from tvshow episodes list when a episode is selected * @param tvshowId Show id of the episode, should be the same as {@link #selectedTVShowId} * @param episodeId Episode id/* ww w .ja va 2s .co m*/ */ @TargetApi(21) public void onEpisodeSelected(int tvshowId, int episodeId) { selectedEpisodeId = episodeId; // Replace list fragment TVShowEpisodeDetailsFragment fragment = TVShowEpisodeDetailsFragment.newInstance(tvshowId, episodeId); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); // Set up transitions if (Utils.isLollipopOrLater()) { fragment.setEnterTransition( TransitionInflater.from(this).inflateTransition(R.transition.media_details)); fragment.setReturnTransition(null); } else { fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0, R.anim.fragment_list_popenter, 0); } fragTrans.replace(R.id.fragment_container, fragment).addToBackStack(null).commit(); setupActionBar(selectedTVShowTitle); }
From source file:org.xbmc.kore.ui.MoviesActivity.java
/** * Callback from movielist fragment when a movie is selected. * Switch fragment in portrait/*from ww w .java 2 s .c o m*/ * @param vh ViewHolder holding movie info of item clicked */ @TargetApi(21) public void onMovieSelected(MovieListFragment.ViewHolder vh) { selectedMovieTitle = vh.movieTitle; selectedMovieId = vh.movieId; // Set up transitions if (Utils.isLollipopOrLater()) { final MovieDetailsFragment movieDetailsFragment = MovieDetailsFragment.newInstance(vh); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); android.support.v4.app.SharedElementCallback seCallback = new android.support.v4.app.SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { //On returning onMapSharedElements for the exiting fragment is called before the onMapSharedElements // for the reentering fragment. We use this to determine if we are returning and if // we should clear the shared element lists. Note that, clearing must be done in the reentering fragment // as this is called last. Otherwise it the app will crash during transition setup. Not sure, but might // be a v4 support package bug. if (movieDetailsFragment.isVisible()) { View sharedView = movieDetailsFragment.getSharedElement(); if (sharedView == null) { // shared element not visible clearSharedElements = true; } } } }; movieDetailsFragment.setEnterSharedElementCallback(seCallback); movieDetailsFragment.setEnterTransition( TransitionInflater.from(this).inflateTransition(R.transition.media_details)); movieDetailsFragment.setReturnTransition(null); Transition changeImageTransition = TransitionInflater.from(this) .inflateTransition(R.transition.change_image); movieDetailsFragment.setSharedElementReturnTransition(changeImageTransition); movieDetailsFragment.setSharedElementEnterTransition(changeImageTransition); fragTrans.replace(R.id.fragment_container, movieDetailsFragment).addToBackStack(null) .addSharedElement(vh.artView, vh.artView.getTransitionName()).commit(); } else { MovieDetailsFragment movieDetailsFragment = MovieDetailsFragment.newInstance(vh); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0, R.anim.fragment_list_popenter, 0); fragTrans.replace(R.id.fragment_container, movieDetailsFragment).addToBackStack(null).commit(); } setupActionBar(selectedMovieTitle); }
From source file:org.xbmc.kore.ui.AddonsActivity.java
/** * Callback from list fragment when a addon is selected. * Switch fragment in portrait//w w w .j a va 2s . c om * @param vh */ @TargetApi(21) public void onAddonSelected(AddonListFragment.ViewHolder vh) { selectedAddonId = vh.addonId; selectedAddonTitle = vh.addonName; // Replace list fragment final SharedElementFragment addonDetailsFragment = vh.browsable ? AddonOverviewFragment.newInstance(vh) : AddonDetailsFragment.newInstance(vh); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); // Set up transitions if (Utils.isLollipopOrLater()) { android.support.v4.app.SharedElementCallback seCallback = new android.support.v4.app.SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { //On returning onMapSharedElements for the exiting fragment is called before the onMapSharedElements // for the reentering fragment. We use this to determine if we are returning and if // we should clear the shared element lists. Note that, clearing must be done in the reentering fragment // as this is called last. Otherwise it the app will crash during transition setup. Not sure, but might // be a v4 support package bug. if (addonDetailsFragment.isVisible()) { View sharedView = addonDetailsFragment.getSharedElement(); if (sharedView == null) { // shared element not visible clearSharedElements = true; } } } }; addonDetailsFragment.setEnterSharedElementCallback(seCallback); addonDetailsFragment.setEnterTransition( TransitionInflater.from(this).inflateTransition(R.transition.media_details)); addonDetailsFragment.setReturnTransition(null); Transition changeImageTransition = TransitionInflater.from(this) .inflateTransition(R.transition.change_image); addonDetailsFragment.setSharedElementReturnTransition(changeImageTransition); addonDetailsFragment.setSharedElementEnterTransition(changeImageTransition); fragTrans.addSharedElement(vh.artView, vh.artView.getTransitionName()); } else { fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0, R.anim.fragment_list_popenter, 0); } fragTrans.replace(R.id.fragment_container, addonDetailsFragment).addToBackStack(null).commit(); setupActionBar(selectedAddonTitle); }
From source file:com.ravi.apps.android.newsbytes.MainActivity.java
@Override public void onHeadlineSelected(News news, ImageView thumbnailView, String thumbnailTransition, TextView headlineView, String headlineTransition) { // Check if it's in two pane mode. if (mIsTwoPaneMode) { // Package the parcelable news data into the arguments bundle. Bundle arguments = new Bundle(); arguments.putParcelable(DetailsFragment.NEWS_DETAILS, news); // Create the details fragment object. DetailsFragment detailsFragment = new DetailsFragment(); // Shared element transition - check if device is running on lollipop or above // and if ALL of the required parameters for the shared element transition are available. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && thumbnailView != null && thumbnailTransition != null && headlineView != null && headlineTransition != null) { // Set the shared element transition. detailsFragment.setSharedElementEnterTransition( TransitionInflater.from(this).inflateTransition(R.transition.change_image_transform)); detailsFragment.setEnterTransition( TransitionInflater.from(this).inflateTransition(android.R.transition.fade)); // Add the transition names into the bundle. arguments.putString(HeadlinesAdapter.THUMBNAIL_TRANSITION_NAME, thumbnailTransition); arguments.putString(HeadlinesAdapter.HEADLINE_TRANSITION_NAME, headlineTransition); // Set arguments containing news details. detailsFragment.setArguments(arguments); // Set the transition names. ViewCompat.setTransitionName(thumbnailView, thumbnailTransition); ViewCompat.setTransitionName(headlineView, headlineTransition); // Add the fragment onto the container. getFragmentManager().beginTransaction() .replace(R.id.news_details_container, detailsFragment, DetailsFragment.DETAILS_FRAGMENT_TAG) .addSharedElement(thumbnailView, thumbnailTransition) .addSharedElement(headlineView, headlineTransition).commit(); } else { // For pre-lollipop devices. // Set arguments containing news details. detailsFragment.setArguments(arguments); // Add the fragment onto the container. getFragmentManager().beginTransaction() .setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out, android.R.animator.fade_in, android.R.animator.fade_out) .replace(R.id.news_details_container, detailsFragment, DetailsFragment.DETAILS_FRAGMENT_TAG) .commit();//from ww w . j a v a 2 s .c o m } } else { // Create intent to launch details activity. Intent intent = new Intent(this, DetailsActivity.class); // Add news details into extra. intent.putExtra(DetailsFragment.NEWS_DETAILS, news); // Shared element transition - check if device is running on lollipop or above // and if ALL of the required parameters for the shared element transition are available. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && thumbnailView != null && thumbnailTransition != null && headlineView != null && headlineTransition != null) { // Add the transition names into the intent extra. intent.putExtra(HeadlinesAdapter.THUMBNAIL_TRANSITION_NAME, thumbnailTransition); intent.putExtra(HeadlinesAdapter.HEADLINE_TRANSITION_NAME, headlineTransition); // Add the essential attributes of the shared element views into the intent extra. addThumbnailDetailsToIntent(thumbnailView, intent); addHeadlineDetailsToIntent(headlineView, intent); } // Start details activity. startActivity(intent); } }
From source file:spit.matrix2017.Activities.EventDetails.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void setupEnterAnimation() { Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.transition); transition.setDuration(300);//from w ww. ja v a 2 s . c om getWindow().setSharedElementEnterTransition(transition); transition.addListener(new Transition.TransitionListener() { @Override public void onTransitionStart(Transition transition) { } @Override public void onTransitionEnd(Transition transition) { fab.show(); } @Override public void onTransitionCancel(Transition transition) { } @Override public void onTransitionPause(Transition transition) { } @Override public void onTransitionResume(Transition transition) { } }); }
From source file:io.vit.vitio.Fragments.SubjectView.SubjectViewFragmentTrial.java
private void setTransitions() { if (Build.VERSION.SDK_INT >= 21) { setExitTransition(//ww w.ja v a 2s. c om TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.explode)); setReenterTransition( TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.fade)); /*((Transition)this.getEnterTransition()).addListener(new Transition.TransitionListener() { @Override public void onTransitionStart(Transition transition) { } @Override public void onTransitionEnd(Transition transition) { if(Build.VERSION.SDK_INT>=21){ Log.d("cir","cir"); schoolImage.setVisibility(View.INVISIBLE); circularRevealSchoolImage(); } else{ schoolImage.setVisibility(View.VISIBLE); } } @Override public void onTransitionCancel(Transition transition) { } @Override public void onTransitionPause(Transition transition) { } @Override public void onTransitionResume(Transition transition) { } });*/ } }
From source file:org.xbmc.kore.ui.TVShowsActivity.java
/** * Callback from tvshows list fragment when a show is selected. * Switch fragment in portrait//from w w w .j av a 2 s . c o m * @param vh */ @TargetApi(21) public void onTVShowSelected(TVShowListFragment.ViewHolder vh) { selectedTVShowId = vh.tvshowId; selectedTVShowTitle = vh.tvshowTitle; // Replace list fragment tvshowDetailsFragment = TVShowDetailsFragment.newInstance(vh); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); // Set up transitions if (Utils.isLollipopOrLater()) { android.support.v4.app.SharedElementCallback seCallback = new android.support.v4.app.SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { //On returning onMapSharedElements for the exiting fragment is called before the onMapSharedElements // for the reentering fragment. We use this to determine if we are returning and if // we should clear the shared element lists. Note that, clearing must be done in the reentering fragment // as this is called last. Otherwise it the app will crash during transition setup. Not sure, but might // be a v4 support package bug. if (tvshowDetailsFragment.isVisible()) { View sharedView = tvshowDetailsFragment.getSharedElement(); if (sharedView == null) { // shared element not visible clearSharedElements = true; } } } }; tvshowDetailsFragment.setEnterSharedElementCallback(seCallback); tvshowDetailsFragment.setEnterTransition( TransitionInflater.from(this).inflateTransition(R.transition.media_details)); tvshowDetailsFragment.setReturnTransition(null); Transition changeImageTransition = TransitionInflater.from(this) .inflateTransition(R.transition.change_image); tvshowDetailsFragment.setSharedElementReturnTransition(changeImageTransition); tvshowDetailsFragment.setSharedElementEnterTransition(changeImageTransition); fragTrans.addSharedElement(vh.artView, vh.artView.getTransitionName()); } else { fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0, R.anim.fragment_list_popenter, 0); } fragTrans.replace(R.id.fragment_container, tvshowDetailsFragment).addToBackStack(null).commit(); setupActionBar(selectedTVShowTitle); }
From source file:com.saulmm.cui.OrderDialogFragment.java
private void changeToConfirmScene() { final LayoutOrderConfirmationBinding confBinding = prepareConfirmationBinding(); final Scene scene = new Scene(binding.content, ((ViewGroup) confBinding.getRoot())); scene.setEnterAction(onEnterConfirmScene(confBinding)); final Transition transition = TransitionInflater.from(getContext()) .inflateTransition(R.transition.transition_confirmation_view); TransitionManager.go(scene, transition); }