Java Code Examples for android.view.Window#setSharedElementEnterTransition()

The following examples show how to use android.view.Window#setSharedElementEnterTransition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutoSharedElementCallback.java    From native-navigation with MIT License 6 votes vote down vote up
@TargetApi(TARGET_API) @Override
public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements,
    List<View> sharedElementSnapshots) {

  Transition enterTransition =
      sharedElementEnterTransition == null ? getDefaultSharedElementEnterTransition() :
          sharedElementEnterTransition;
  Transition returnTransition =
      sharedElementReturnTransition == null ? getDefaultSharedElementReturnTransition() :
          sharedElementReturnTransition;

  crossFadePartialMatchImageViews(sharedElementNames, sharedElements, sharedElementSnapshots,
      (int) returnTransition.getDuration());

  Window window = activity.getWindow();
  window.setSharedElementEnterTransition(enterTransition);
  window.setSharedElementReturnTransition(returnTransition);
  boolean entering = !endCalledSinceOnMap;
  window.setTransitionBackgroundFadeDuration(
      entering ? enterBackgroundFadeDuration : returnBackgroundFadeDuration);
}
 
Example 2
Source File: DetailsFragment.java    From mosby with Apache License 2.0 6 votes vote down vote up
@TargetApi(21) private void initTransitions() {

    Window window = getActivity().getWindow();
    window.setEnterTransition(
        new ExplodeFadeEnterTransition(senderNameView, senderMailView, separatorLine));
    window.setExitTransition(new ExcludedExplodeTransition());
    window.setReenterTransition(new ExcludedExplodeTransition());
    window.setReturnTransition(new ExcludedExplodeTransition());

    TransitionSet textSizeSet = new TransitionSet();
    textSizeSet.addTransition(
        TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.move));
    TextSizeTransition textSizeTransition = new TextSizeTransition();
    textSizeTransition.addTarget(R.id.subject);
    textSizeTransition.addTarget(getString(R.string.shared_mail_subject));

    textSizeSet.addTransition(textSizeTransition);
    textSizeSet.setOrdering(TransitionSet.ORDERING_TOGETHER);

    window.setSharedElementEnterTransition(textSizeSet);
    getActivity().setEnterSharedElementCallback(
        new TextSizeEnterSharedElementCallback(getActivity()));
  }
 
Example 3
Source File: ContactDetailActivity.java    From CrazyDaily with Apache License 2.0 5 votes vote down vote up
private void initTransition() {
    Window window = getWindow();
    TransitionSet set = new TransitionSet();

    AutoTransition autoTransition = new AutoTransition();
    autoTransition.excludeTarget(R.id.ic_head, true);
    autoTransition.addTarget(R.id.tx_name);
    autoTransition.addTarget(R.id.ic_location);
    autoTransition.addTarget(R.id.tx_location);
    autoTransition.setDuration(600);
    autoTransition.setInterpolator(new DecelerateInterpolator());
    set.addTransition(autoTransition);

    BezierTransition bezierTransition = new BezierTransition();
    bezierTransition.addTarget(R.id.ic_head);
    bezierTransition.excludeTarget(R.id.tx_name, true);
    bezierTransition.excludeTarget(R.id.ic_location, true);
    bezierTransition.excludeTarget(R.id.tx_location, true);
    bezierTransition.setDuration(600);
    bezierTransition.setInterpolator(new DecelerateInterpolator());
    set.addTransition(bezierTransition);

    CircularRevealTransition transition = new CircularRevealTransition();
    transition.excludeTarget(android.R.id.statusBarBackground, true);
    window.setEnterTransition(transition);
    window.setReenterTransition(transition);
    window.setReturnTransition(transition);
    window.setExitTransition(transition);

    window.setSharedElementEnterTransition(set);
    window.setSharedElementReturnTransition(set);

}