Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Created August 1, 2017 12:44
Show Gist options
  • Save EmmanuelGuther/1128f0e5aa8f1716053a39a923846e96 to your computer and use it in GitHub Desktop.
Save EmmanuelGuther/1128f0e5aa8f1716053a39a923846e96 to your computer and use it in GitHub Desktop.
ANDROID - Go to activity with transition
private void goToActivity(View view, Activity fromActivity,
final Class<? extends Activity> toActivity) {
Intent i = new Intent(fromActivity, toActivity);
Bundle bundle;
if (Build.VERSION.SDK_INT >= 23) {
bundle = ActivityOptions.makeClipRevealAnimation(view, 0, 0, view.getWidth(),
view.getHeight()).toBundle();
} else {
bundle = ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.getWidth(),
view.getHeight()).toBundle();
}
// Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
// bitmap.eraseColor(Color.parseColor("#757575"));
// bundle = ActivityOptions.makeThumbnailScaleUpAnimation(view, bitmap, 0, 0).toBundle();
startActivity(i, bundle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment