use of android.transition.Transition in project ListenerMusicPlayer by hefuyicoder.
the class NavigationUtil method navigateToPlaylistDetail.
@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, long playlistID, String playlistName, long firstAlbumID, Pair<View, String> transitionViews) {
FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
Fragment fragment;
if (isLollipop() && transitionViews != null) {
Transition changeImage = TransitionInflater.from(context).inflateTransition(R.transition.image_transform);
transaction.addSharedElement(transitionViews.first, transitionViews.second);
fragment = PlaylistDetailFragment.newInstance(playlistID, playlistName, firstAlbumID, true, transitionViews.second);
fragment.setSharedElementEnterTransition(changeImage);
fragment.setSharedElementReturnTransition(changeImage);
} else {
transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out);
fragment = PlaylistDetailFragment.newInstance(playlistID, playlistName, firstAlbumID, false, transitionViews.second);
}
transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container));
transaction.add(R.id.fragment_container, fragment);
transaction.addToBackStack(null).commit();
}
use of android.transition.Transition in project iosched by google.
the class SessionDetailFragment method onAttach.
@Override
public void onAttach(final Activity activity) {
super.onAttach(activity);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
final Transition sharedElementEnterTransition = activity.getWindow().getSharedElementEnterTransition();
if (sharedElementEnterTransition != null) {
mHasEnterTransition = true;
sharedElementEnterTransition.addListener(new UIUtils.TransitionListenerAdapter() {
@Override
public void onTransitionStart(final Transition transition) {
enterTransitionStarted();
}
@Override
public void onTransitionEnd(final Transition transition) {
enterTransitionFinished();
}
});
}
final Transition sharedElementReturnTransition = activity.getWindow().getSharedElementReturnTransition();
if (sharedElementReturnTransition != null) {
sharedElementReturnTransition.addListener(new UIUtils.TransitionListenerAdapter() {
@Override
public void onTransitionStart(final Transition transition) {
returnTransitionStarted();
}
});
}
}
}
use of android.transition.Transition in project Material-Animations by lgvalle.
the class RevealActivity method revealRed.
private void revealRed() {
final ViewGroup.LayoutParams originalParams = btnRed.getLayoutParams();
Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
transition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
animateRevealColor(bgViewGroup, R.color.sample_red);
body.setText(R.string.reveal_body3);
body.setTextColor(ContextCompat.getColor(RevealActivity.this, R.color.theme_red_background));
btnRed.setLayoutParams(originalParams);
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
TransitionManager.beginDelayedTransition(bgViewGroup, transition);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
btnRed.setLayoutParams(layoutParams);
}
use of android.transition.Transition in project Material-Animations by lgvalle.
the class RevealActivity method setupExitAnimations.
private void setupExitAnimations() {
Fade returnTransition = new Fade();
getWindow().setReturnTransition(returnTransition);
returnTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
returnTransition.setStartDelay(getResources().getInteger(R.integer.anim_duration_medium));
returnTransition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
transition.removeListener(this);
animateButtonsOut();
animateRevealHide(bgViewGroup);
}
@Override
public void onTransitionEnd(Transition transition) {
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
}
use of android.transition.Transition in project Material-Animations by lgvalle.
the class TransitionActivity3 method setupWindowAnimations.
private void setupWindowAnimations() {
Transition transition;
if (type == TYPE_PROGRAMMATICALLY) {
transition = buildEnterTransition();
} else {
transition = TransitionInflater.from(this).inflateTransition(R.transition.slide_from_bottom);
}
getWindow().setEnterTransition(transition);
}
Aggregations