I'm using the makeSceneTransitionAnimation API call from the Shared Element lib to share a image in the header of a collapsing toolbar to a detail view activity. Ignore the FAB's looking out of place, I plan on sliding them out part of an animation if I can get this to look better.
It looks horrendous: https://youtu.be/Js91TAvwrV0
Heres the code:
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void LollipopTransition(View v) throws IOException {
Log.d("The Jones Theory", "LollipopTransition...");
ImageView imgFavorite = (ImageView) findViewById(R.id.header);
final View nestedContent = findViewById(R.id.nested_content);
hideView(nestedContent);
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(PostSelectedActivity.this, imgFavorite, "photo_hero").toBundle());
}
getWindow().getEnterTransition().addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
getWindow().getEnterTransition().removeListener(this);
// load the full version, crossfading from the thumbnail image
Ion.with(photoView)
.crossfade(true)
.deepZoom()
.load(PostImage);
}