I have a RecyclerView with CardViews , and when I click on CardView , I open a new action with a ViewPager containing the data of this card.
I want to achieve :
1) When I go from the list to the Activity object, I want CardView where the common item was CardView (a bit like a Gmail application).
2) When I return from the Activity list ( ViewPager ) to the list, I need a transition in which the current element goes to its place in the list (again, as in the Gmail application).
What i have done so far :
Here are some parts of my code:
Activity Details:
protected void onCreate (Bundle savedInstanceState) { .... viewPager = (ViewPager) findViewById(R.id.card_detail); mPagerAdapter = new DetailPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mPagerAdapter); viewPager.setCurrentItem(currentPosition);
RecyclerView adapter (where the "Drill with Transition" operation begins):
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(mActivity, card, "card_transition_name"); mContext.startActivity(i, options.toBundle());
I left the default transition, but itβs a bit strange: the transition is a combination of gradual and zooming, which is really messy ...
Can someone help me on how to achieve this?
Thanks!
source share