use of com.google.samples.apps.topeka.widget.TransitionListenerAdapter in project android-topeka by googlesamples.
the class SignInFragment method performSignInWithTransition.
private void performSignInWithTransition(View v) {
final Activity activity = getActivity();
if (v == null || ApiLevelHelper.isLowerThan(Build.VERSION_CODES.LOLLIPOP)) {
// Don't run a transition if the passed view is null
CategorySelectionActivity.start(activity, mPlayer);
activity.finish();
return;
}
if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) {
activity.getWindow().getSharedElementExitTransition().addListener(new TransitionListenerAdapter() {
@Override
public void onTransitionEnd(Transition transition) {
activity.finish();
}
});
final Pair[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, true, new Pair<>(v, activity.getString(R.string.transition_avatar)));
@SuppressWarnings("unchecked") ActivityOptionsCompat activityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs);
CategorySelectionActivity.start(activity, mPlayer, activityOptions);
}
}
Aggregations