Skip to content

Instantly share code, notes, and snippets.

@Kvest
Last active October 24, 2016 18:45
Show Gist options
  • Save Kvest/2aff267225536081f02c8693a22aaeb5 to your computer and use it in GitHub Desktop.
Save Kvest/2aff267225536081f02c8693a22aaeb5 to your computer and use it in GitHub Desktop.
setEnterSharedElementCallback(new SharedElementCallback() {
@Override
public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
Intent intent = getIntent();
for (int i = 0; i < sharedElementNames.size(); i++) {
String name = sharedElementNames.get(i);
if (intent.hasExtra(name)) {
sharedElements.get(i).setTag(R.id.tag_transition_extra_properties, intent.getBundleExtra(name));
}
}
}
@Override
public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);
//clear all tags - without tags transition will use view's custom state
for (View view : sharedElements) {
view.setTag(R.id.tag_transition_extra_properties, null);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment