use of android.transition.Transition in project Conductor by bluelinelabs.
the class TransitionUtils method mergeTransitions.
@NonNull
public static TransitionSet mergeTransitions(int ordering, Transition... transitions) {
TransitionSet transitionSet = new TransitionSet();
for (Transition transition : transitions) {
if (transition != null) {
transitionSet.addTransition(transition);
}
}
transitionSet.setOrdering(ordering);
return transitionSet;
}
use of android.transition.Transition in project Conductor by bluelinelabs.
the class TransitionUtils method addTargets.
public static void addTargets(@Nullable Transition transition, @NonNull List<View> views) {
if (transition == null) {
return;
}
if (transition instanceof TransitionSet) {
TransitionSet set = (TransitionSet) transition;
int numTransitions = set.getTransitionCount();
for (int i = 0; i < numTransitions; i++) {
Transition child = set.getTransitionAt(i);
addTargets(child, views);
}
} else if (!hasSimpleTarget(transition)) {
List<View> targets = transition.getTargets();
if (isNullOrEmpty(targets)) {
int numViews = views.size();
for (int i = 0; i < numViews; i++) {
transition.addTarget(views.get(i));
}
}
}
}
use of android.transition.Transition in project ListenerMusicPlayer by hefuyicoder.
the class NavigationUtil method navigateToAlbum.
@TargetApi(21)
public static void navigateToAlbum(Activity context, long albumID, String albumName, 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 = AlbumDetailFragment.newInstance(albumID, albumName, 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 = AlbumDetailFragment.newInstance(albumID, albumName, false, null);
}
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 ListenerMusicPlayer by hefuyicoder.
the class NavigationUtil method navigateToArtist.
@TargetApi(21)
public static void navigateToArtist(Activity context, long artistID, String name, Pair<View, String> transitionViews) {
FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
Fragment fragment;
if (ListenerUtil.isLollipop() && transitionViews != null) {
Transition changeImage = TransitionInflater.from(context).inflateTransition(R.transition.image_transform);
transaction.addSharedElement(transitionViews.first, transitionViews.second);
fragment = ArtistDetailFragment.newInstance(artistID, name, 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 = ArtistDetailFragment.newInstance(artistID, name, false, null);
}
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 Material-Animations by lgvalle.
the class RevealActivity method setupEnterAnimations.
private void setupEnterAnimations() {
Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.changebounds_with_arcmotion);
getWindow().setSharedElementEnterTransition(transition);
transition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
// Removing listener here is very important because shared element transition is executed again backwards on exit. If we don't remove the listener this code will be triggered again.
transition.removeListener(this);
hideTarget();
animateRevealShow(toolbar);
animateButtonsIn();
}
@Override
public void onTransitionCancel(Transition transition) {
}
@Override
public void onTransitionPause(Transition transition) {
}
@Override
public void onTransitionResume(Transition transition) {
}
});
}
Aggregations