use of android.transition.Transition in project Material-Animations by lgvalle.
the class TransitionActivity2 method setupWindowAnimations.
private void setupWindowAnimations() {
Transition transition;
if (type == TYPE_PROGRAMMATICALLY) {
transition = buildEnterTransition();
} else {
transition = TransitionInflater.from(this).inflateTransition(R.transition.explode);
}
getWindow().setEnterTransition(transition);
}
use of android.transition.Transition in project UltimateAndroid by cymcsg.
the class DetailActivity3 method setupEnterAnimations.
private void setupEnterAnimations() {
Transition enterTransition = getWindow().getSharedElementEnterTransition();
enterTransition.addListener(new Transition.TransitionListener() {
@Override
public void onTransitionStart(Transition transition) {
}
@Override
public void onTransitionEnd(Transition transition) {
animateRevealShow(bgViewGroup);
}
@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 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);
}
}
use of android.transition.Transition in project native-navigation by airbnb.
the class AutoSharedElementCallback method onSharedElementStart.
@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);
}
use of android.transition.Transition in project platform_frameworks_base by android.
the class PopupWindow method dismiss.
/**
* Disposes of the popup window. This method can be invoked only after
* {@link #showAsDropDown(android.view.View)} has been executed. Failing
* that, calling this method will have no effect.
*
* @see #showAsDropDown(android.view.View)
*/
public void dismiss() {
if (!isShowing() || mIsTransitioningToDismiss) {
return;
}
final PopupDecorView decorView = mDecorView;
final View contentView = mContentView;
final ViewGroup contentHolder;
final ViewParent contentParent = contentView.getParent();
if (contentParent instanceof ViewGroup) {
contentHolder = ((ViewGroup) contentParent);
} else {
contentHolder = null;
}
// Ensure any ongoing or pending transitions are canceled.
decorView.cancelTransitions();
mIsShowing = false;
mIsTransitioningToDismiss = true;
// This method may be called as part of window detachment, in which
// case the anchor view (and its root) will still return true from
// isAttachedToWindow() during execution of this method; however, we
// can expect the OnAttachStateChangeListener to have been called prior
// to executing this method, so we can rely on that instead.
final Transition exitTransition = mExitTransition;
if (mIsAnchorRootAttached && exitTransition != null && decorView.isLaidOut()) {
// The decor view is non-interactive and non-IME-focusable during exit transitions.
final LayoutParams p = (LayoutParams) decorView.getLayoutParams();
p.flags |= LayoutParams.FLAG_NOT_TOUCHABLE;
p.flags |= LayoutParams.FLAG_NOT_FOCUSABLE;
p.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
mWindowManager.updateViewLayout(decorView, p);
// Once we start dismissing the decor view, all state (including
// the anchor root) needs to be moved to the decor view since we
// may open another popup while it's busy exiting.
final View anchorRoot = mAnchorRoot != null ? mAnchorRoot.get() : null;
final Rect epicenter = getTransitionEpicenter();
exitTransition.setEpicenterCallback(new EpicenterCallback() {
@Override
public Rect onGetEpicenter(Transition transition) {
return epicenter;
}
});
decorView.startExitTransition(exitTransition, anchorRoot, new TransitionListenerAdapter() {
@Override
public void onTransitionEnd(Transition transition) {
dismissImmediate(decorView, contentHolder, contentView);
}
});
} else {
dismissImmediate(decorView, contentHolder, contentView);
}
// Clears the anchor view.
detachFromAnchor();
if (mOnDismissListener != null) {
mOnDismissListener.onDismiss();
}
}
Aggregations