Background
Lollipop introduces a new way to transition between activities (links here, here, here and here) .
The problem
They said on one of the videos (here) that I can choose exactly how each view will transition, but I can't find how to do it. The only thing I've found is how to set it for all views, except for the "hero" view (which you choose how to transition it to the new activity and back).
For example, let's take the Google Now app, which has this screen:
when you click on the editText, the bottom cards have the "explode" effect, but everything darkens and the imageView behind the editText fade out.
The editText is probably the "hero" view, which transitions between the activities, and because it's on the same location on the screen, this probably doesn't have any visual effect for the user.
What I've tried
I've tried to mimic what Google now did, but as I've written, the imageView also has the "explode" effect, so it goes to the bottom, behind the listView, which is a weird effect (since it gets cropped while animating). I'd prefer it to either animate to a different direction, or just fade out.
Here's a sample code of the transition I'm using:
final Intent intent = new Intent(activity, SearchActivity.class);
ViewCompat.setTransitionName(viewToTransitionFromAndTo, VIEW_TO_TRANSITION_TO);
final ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
viewToTransitionFromAndTo, VIEW_TO_TRANSITION_TO);
ActivityCompat.startActivityForResult(activity, intent, requestCode, options.toBundle());
in the theme of the activity that starts the other activity, I have this:
<style name="AppTheme.transition" parent="@style/AppTheme">
<!-- transition support -->
<item name="android:windowContentTransitions" tools:targetApi="21">true</item>
<item name="android:windowActivityTransitions" tools:targetApi="21">true</item>
<item name="android:windowEnterTransition" tools:targetApi="21">@transition/explode</item>
<item name="android:windowExitTransition" tools:targetApi="21">@transition/explode</item>
<item name="android:windowSharedElementEnterTransition" tools:targetApi="21">@transition/move_image</item>
<item name="android:windowSharedElementExitTransition" tools:targetApi="21">@transition/move_image</item>
<item name="android:windowAllowReturnTransitionOverlap" tools:targetApi="21">true</item>
<item name="android:windowAllowEnterTransitionOverlap" tools:targetApi="21">false</item>
</style>
and the transition files are:
explode.xml
<?xml version="1.0" encoding="utf-8"?>
<explode />
move_image.xml
<?xml version="1.0" encoding="utf-8"?>
<transitionSet>
<changeBounds />
<changeImageTransform />
</transitionSet>
The question
How can I choose what each view will do upon transition, instead of just saying everything to have the same effect (except for the "hero" view) ?
For example, is it possible to choose "explode" transition for all views except for the "hero" view , and a view that will have a different transition (fade out/in, for example) ?
Please show an example of how to do it. You can use the code I've written above if needed.