Java Code Examples for android.transition.Transition#addListener()
The following examples show how to use
android.transition.Transition#addListener() .
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: ActivityOptions.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public HideWindowListener(Window window, ExitTransitionCoordinator exit) { mWindow = window; mExit = exit; mSharedElements = new ArrayList<>(exit.mSharedElements); Transition transition = mWindow.getExitTransition(); if (transition != null) { transition.addListener(this); mWaitingForTransition = true; } else { mWaitingForTransition = false; } View decorView = mWindow.getDecorView(); if (decorView != null) { if (decorView.getTag(com.android.internal.R.id.cross_task_transition) != null) { throw new IllegalStateException( "Cannot start a transition while one is running"); } decorView.setTagInternal(com.android.internal.R.id.cross_task_transition, exit); } }
Example 2
Source File: ExitTransitionCoordinator.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private Transition getSharedElementExitTransition() { Transition sharedElementTransition = null; if (!mSharedElements.isEmpty()) { sharedElementTransition = configureTransition(getSharedElementTransition(), false); } if (sharedElementTransition == null) { sharedElementTransitionComplete(); } else { sharedElementTransition.addListener(new ContinueTransitionListener() { @Override public void onTransitionEnd(Transition transition) { sharedElementTransitionComplete(); if (mIsHidden) { showViews(mSharedElements, true); } super.onTransitionEnd(transition); } }); mSharedElements.get(0).invalidate(); } return sharedElementTransition; }
Example 3
Source File: FragmentTransition.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Replace hide operations with visibility changes on the exiting views. Instead of making * the entire fragment's view GONE, make each exiting view INVISIBLE. At the end of the * transition, make the fragment's view GONE. */ private static void replaceHide(Transition exitTransition, Fragment exitingFragment, final ArrayList<View> exitingViews) { if (exitingFragment != null && exitTransition != null && exitingFragment.mAdded && exitingFragment.mHidden && exitingFragment.mHiddenChanged) { exitingFragment.setHideReplaced(true); final View fragmentView = exitingFragment.getView(); OneShotPreDrawListener.add(exitingFragment.mContainer, () -> { setViewVisibility(exitingViews, View.INVISIBLE); }); exitTransition.addListener(new TransitionListenerAdapter() { @Override public void onTransitionEnd(Transition transition) { transition.removeListener(this); fragmentView.setVisibility(View.GONE); setViewVisibility(exitingViews, View.VISIBLE); } }); } }
Example 4
Source File: FragmentTransition.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * After the transition has started, remove all targets that we added to the transitions * so that the transitions are left in a clean state. */ private static void scheduleRemoveTargets(final Transition overalTransition, final Transition enterTransition, final ArrayList<View> enteringViews, final Transition exitTransition, final ArrayList<View> exitingViews, final TransitionSet sharedElementTransition, final ArrayList<View> sharedElementsIn) { overalTransition.addListener(new TransitionListenerAdapter() { @Override public void onTransitionStart(Transition transition) { if (enterTransition != null) { replaceTargets(enterTransition, enteringViews, null); } if (exitTransition != null) { replaceTargets(exitTransition, exitingViews, null); } if (sharedElementTransition != null) { replaceTargets(sharedElementTransition, sharedElementsIn, null); } } }); }
Example 5
Source File: ExitTransitionCoordinator.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private Transition getExitTransition() { Transition viewsTransition = null; if (mTransitioningViews != null && !mTransitioningViews.isEmpty()) { viewsTransition = configureTransition(getViewsTransition(), true); removeExcludedViews(viewsTransition, mTransitioningViews); if (mTransitioningViews.isEmpty()) { viewsTransition = null; } } if (viewsTransition == null) { viewsTransitionComplete(); } else { final ArrayList<View> transitioningViews = mTransitioningViews; viewsTransition.addListener(new ContinueTransitionListener() { @Override public void onTransitionEnd(Transition transition) { viewsTransitionComplete(); if (mIsHidden && transitioningViews != null) { showViews(transitioningViews, true); setTransitioningViewsVisiblity(View.VISIBLE, true); } if (mSharedElementBundle != null) { delayCancel(); } super.onTransitionEnd(transition); } }); } return viewsTransition; }
Example 6
Source File: QueueActivity.java From PainlessMusicPlayer with Apache License 2.0 | 5 votes |
static void addEnterTransitionListener(@NonNull final QueueActivity activity) { final Transition enter = activity.getWindow().getSharedElementEnterTransition(); if (enter != null) { enter.addListener(new TransitionListenerAdapter() { @Override public void onTransitionEnd(final Transition transition) { activity.onEnterTransitionFinished(); } }); } }
Example 7
Source File: TransitionKitKat.java From Noyze with Apache License 2.0 | 5 votes |
@Override public void beginDelayedTransition(ViewGroup sceneRoot, Object transition) { if (transition instanceof Transition) { Transition trans = (Transition) transition; trans.addListener(AcceleratedTransitionListener.get()); TransitionManager.beginDelayedTransition(sceneRoot, trans); } }
Example 8
Source File: TransitionKitKat.java From Noyze with Apache License 2.0 | 5 votes |
@Override public void beginDelayedTransition(ViewGroup sceneRoot, Object transition) { if (transition instanceof Transition) { Transition trans = (Transition) transition; trans.addListener(AcceleratedTransitionListener.get()); TransitionManager.beginDelayedTransition(sceneRoot, trans); } }
Example 9
Source File: LoggingTransitionListener.java From glide-support with The Unlicense | 4 votes |
public static void listen(String name, Object transition) { if (transition != null) { Transition t = (Transition)transition; t.addListener(new LoggingTransitionListener(name)); } }