List of usage examples for android.support.v4.app ActivityOptionsCompat makeSceneTransitionAnimation
public static ActivityOptionsCompat makeSceneTransitionAnimation(Activity activity, Pair<View, String>... pairArr)
From source file:Main.java
@SafeVarargs public static void transition(@NonNull final Activity activity, @NonNull final Intent intent, @NonNull final Pair<View, String>... pairs) { final ActivityOptionsCompat activityOptionsCompat = ActivityOptionsCompat .makeSceneTransitionAnimation(activity, pairs); ActivityCompat.startActivity(activity, intent, activityOptionsCompat.toBundle()); }
From source file:Main.java
private static Bundle getOptionsBundle(final Activity activity, final View[] sharedElements) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int len = sharedElements.length; @SuppressWarnings("unchecked") Pair<View, String>[] pairs = new Pair[len]; for (int i = 0; i < len; i++) { pairs[i] = Pair.create(sharedElements[i], sharedElements[i].getTransitionName()); }/*w ww. ja va 2s.c om*/ return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs).toBundle(); } return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, null, null).toBundle(); }
From source file:Main.java
private static Bundle getOptionsBundle(final Activity activity, final View[] sharedElements) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return null; if (sharedElements == null) return null; int len = sharedElements.length; if (len <= 0) return null; @SuppressWarnings("unchecked") Pair<View, String>[] pairs = new Pair[len]; for (int i = 0; i < len; i++) { pairs[i] = Pair.create(sharedElements[i], sharedElements[i].getTransitionName()); }/* w w w. ja v a 2 s . c o m*/ return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs).toBundle(); }
From source file:com.cpacm.moemusic.utils.TransitionHelper.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static void startSharedElementActivity(Activity activity, Intent intent, Pair<View, String>[] pairs) { ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat .makeSceneTransitionAnimation(activity, pairs); activity.startActivity(intent, transitionActivityOptions.toBundle()); }
From source file:butter.droid.activities.StreamLoadingActivity.java
public static Intent startActivity(Activity activity, StreamInfo info, Pair<View, String>... elements) { Intent i = new Intent(activity, StreamLoadingActivity.class); i.putExtra(EXTRA_INFO, info);/*from w w w .j av a2 s. c o m*/ ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, elements); ActivityCompat.startActivity(activity, i, options.toBundle()); return i; }
From source file:butter.droid.tv.activities.TVStreamLoadingActivity.java
public static Intent startActivity(Activity activity, StreamInfo info, Pair<View, String>... elements) { Intent i = new Intent(activity, TVStreamLoadingActivity.class); i.putExtra(EXTRA_STREAM_INFO, info); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, elements); ActivityCompat.startActivity(activity, i, options.toBundle()); return i;//from w w w . j a v a 2 s .c o m }
From source file:pct.droid.tv.activities.PTVStreamLoadingActivity.java
public static Intent startActivity(Activity activity, StreamInfo info, Pair<View, String>... elements) { Intent i = new Intent(activity, PTVStreamLoadingActivity.class); i.putExtra(EXTRA_STREAM_INFO, info); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, elements); ActivityCompat.startActivity(activity, i, options.toBundle()); return i;//from www.j av a2 s. c o m }
From source file:by.gdgminsk.animationguide.util.AnimUtils.java
@SuppressWarnings("unchecked") public static ActivityOptionsCompat makeSharedViewOptions(Activity activity, View... views) { List<Pair<View, String>> sharedPairs = new ArrayList<>(); for (View view : views) { sharedPairs.add(new Pair<>(view, ViewCompat.getTransitionName(view))); }/*w ww . j a va 2 s.co m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // always add status bar and navigation bar to shared element transition to play shared views animation // without UI glitch described here https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb View decor = activity.getWindow().getDecorView(); View statusBar = decor.findViewById(android.R.id.statusBarBackground); if (statusBar != null) { sharedPairs.add(new Pair<>(statusBar, ViewCompat.getTransitionName(statusBar))); } View navBar = decor.findViewById(android.R.id.navigationBarBackground); if (navBar != null) { sharedPairs.add(new Pair<>(navBar, ViewCompat.getTransitionName(navBar))); } } return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedPairs.toArray(new Pair[sharedPairs.size()])); }
From source file:info.tongrenlu.MainActivity.java
@Override public void onFragmentInteraction(final Fragment target, Bundle data, Pair<View, String>[] sharedElements) { if (target instanceof MusicListFragment) { // get the element that receives the click event Intent intent = new Intent(this.getApplicationContext(), MusicDetailActivity.class); intent.putExtras(data);//from w w w.j a v a2 s. co m ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, sharedElements); // start the new activity ActivityCompat.startActivity(this, intent, options.toBundle()); } }
From source file:com.andremion.louvre.preview.PreviewActivity.java
public static void startActivity(@NonNull Activity activity, int requestCode, @NonNull View imageView, @NonNull View checkView, @IntRange(from = 0) long bucketId, @IntRange(from = 0) int position, LinkedHashMap<Long, Uri> selection, int maxSelection, String... mediaTypeFilter) { Intent intent = new Intent(activity, PreviewActivity.class); intent.putExtra(EXTRA_BUCKET_ID, bucketId); intent.putExtra(EXTRA_POSITION, position); intent.putExtra(EXTRA_SELECTION, selection); intent.putExtra(EXTRA_MAX_SELECTION, maxSelection); intent.putExtra(EXTRA_MEDIA_TYPE_FILTER, mediaTypeFilter); Pair[] sharedElements = concatToSystemSharedElements(activity, Pair.create(imageView, ViewCompat.getTransitionName(imageView)), Pair.create(checkView, ViewCompat.getTransitionName(checkView))); //noinspection unchecked ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements);/*from w ww .j ava2 s . c om*/ ActivityCompat.startActivityForResult(activity, intent, requestCode, options.toBundle()); }