Morph transitions from FAB to dialog, and Button to dialog
See the sample app. Typical usage:
MorphTransform.addExtras(intent, color, dialogCornerRadius);
ActivityOptions options =
ActivityOptions.makeSceneTransitionAnimation(MainActivity.this, button,
getString(R.string.morph_transition));
startActivity(intent, options.toBundle());
in the first activity, then:
MorphTransform.setup(this, container, color, dialogCornerRadius));
in the next activity. Be sure that you override onBackPressed()
and call ActivityCompat.finishAfterTransition(DialogActivity.this);
In addition, be sure that your activities themes have the attribute:
<item name="android:windowContentTransitions">true</item>
- Add the JitPack repository to your root build.gradle:
repositories {
maven { url "https://jitpack.io" }
}
- Add the dependency to your sub build.gradle:
dependencies {
implementation 'com.github.mirshahbazi:MorphTransitions:d4edc0726f'
}
Copyright MAM