How can I add a motion between those two activities ?
Left : RecyclerView ______________________ Right : DetailActivity
Those images and styles are from the material design guidelines https://codelabs.developers.google.com/codelabs/material-design-style/#0
These guidelines helped me a lot : https://github.com/codepath/android_guides/wiki/Shared-Element-Activity-Transition#1-enable-window-content-transitions
This is the code from my Handler
public void onCardClick(View view, Module module) {
final Context context = view.getContext();
final Intent intent = new Intent(context, DetailActivity.class);
intent.putExtra(DetailActivity.MODULE, module);
View image = view.findViewById(R.id.card_image);
View description = view.findViewById(R.id.card_description);
Pair<View, String> p1 = Pair.create(image, "image");
Pair<View, String> p2 = Pair.create(description, "description");
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(mActivity, p1, p2);
context.startActivity(intent, options.toBundle());
}
I have also added transitionName in both of my activities
<ImageView
android:id="@+id/card_image"
android:transitionName="image" />
<TextView
android:id="@+id/card_description"
android:transitionName="description" />