Search in sources :

Example 1 with Transition

use of androidx.transition.Transition in project Signal-Android by WhisperSystems.

the class WebRtcCallView method fadeControls.

private void fadeControls(int visibility) {
    controlsVisible = visibility == VISIBLE;
    Transition transition = new AutoTransition().setOrdering(TransitionSet.ORDERING_TOGETHER).setDuration(TRANSITION_DURATION_MILLIS);
    TransitionManager.endTransitions(parent);
    if (controlsListener != null) {
        if (controlsVisible) {
            controlsListener.showSystemUI();
        } else {
            controlsListener.hideSystemUI();
        }
    }
    TransitionManager.beginDelayedTransition(parent, transition);
    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(parent);
    for (View view : controlsToFade()) {
        constraintSet.setVisibility(view.getId(), visibility);
    }
    adjustParticipantsRecycler(constraintSet);
    constraintSet.applyTo(parent);
    layoutParticipants();
}
Also used : AutoTransition(androidx.transition.AutoTransition) Transition(androidx.transition.Transition) AutoTransition(androidx.transition.AutoTransition) ConstraintSet(androidx.constraintlayout.widget.ConstraintSet) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) AvatarImageView(org.thoughtcrime.securesms.components.AvatarImageView)

Example 2 with Transition

use of androidx.transition.Transition in project Signal-Android by WhisperSystems.

the class WebRtcCallView method layoutParticipants.

private void layoutParticipants() {
    Transition transition = new AutoTransition().setDuration(TRANSITION_DURATION_MILLIS);
    TransitionManager.beginDelayedTransition(participantsParent, transition);
    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(participantsParent);
    constraintSet.setMargin(R.id.call_screen_participants_pager, ConstraintSet.BOTTOM, ViewUtil.dpToPx(withControlsHeight(pagerBottomMarginDp)));
    constraintSet.applyTo(participantsParent);
}
Also used : AutoTransition(androidx.transition.AutoTransition) Transition(androidx.transition.Transition) AutoTransition(androidx.transition.AutoTransition) ConstraintSet(androidx.constraintlayout.widget.ConstraintSet)

Example 3 with Transition

use of androidx.transition.Transition in project Signal-Android by WhisperSystems.

the class WebRtcCallView method fadeInNewUiState.

private void fadeInNewUiState(boolean useSmallMargins, boolean showSmallHeader) {
    Transition transition = new AutoTransition().setDuration(TRANSITION_DURATION_MILLIS);
    TransitionManager.beginDelayedTransition(parent, transition);
    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(parent);
    for (View view : SetUtil.difference(allTimeVisibleViews, visibleViewSet)) {
        constraintSet.setVisibility(view.getId(), ConstraintSet.GONE);
    }
    for (View view : visibleViewSet) {
        constraintSet.setVisibility(view.getId(), ConstraintSet.VISIBLE);
        if (adjustableMarginsSet.contains(view)) {
            constraintSet.setMargin(view.getId(), ConstraintSet.END, ViewUtil.dpToPx(useSmallMargins ? SMALL_ONGOING_CALL_BUTTON_MARGIN_DP : LARGE_ONGOING_CALL_BUTTON_MARGIN_DP));
        }
    }
    adjustParticipantsRecycler(constraintSet);
    constraintSet.applyTo(parent);
    if (showSmallHeader) {
        smallHeaderConstraints.setVisibility(incomingRingStatus.getId(), visibleViewSet.contains(incomingRingStatus) ? View.VISIBLE : View.GONE);
        smallHeaderConstraints.applyTo(toolbar);
    } else {
        largeHeaderConstraints.setVisibility(incomingRingStatus.getId(), visibleViewSet.contains(incomingRingStatus) ? View.VISIBLE : View.GONE);
        largeHeaderConstraints.applyTo(toolbar);
    }
}
Also used : AutoTransition(androidx.transition.AutoTransition) Transition(androidx.transition.Transition) AutoTransition(androidx.transition.AutoTransition) ConstraintSet(androidx.constraintlayout.widget.ConstraintSet) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) AvatarImageView(org.thoughtcrime.securesms.components.AvatarImageView)

Example 4 with Transition

use of androidx.transition.Transition in project Transitions-Everywhere by andkulikov.

the class ExplodeAndEpicenterExample method letsExplodeIt.

private void letsExplodeIt(View clickedView) {
    // save rect of view in screen coordinated
    final Rect viewRect = new Rect();
    clickedView.getGlobalVisibleRect(viewRect);
    final Explode explode = new Explode();
    explode.setEpicenterCallback(new Transition.EpicenterCallback() {

        @Override
        public Rect onGetEpicenter(Transition transition) {
            return viewRect;
        }
    });
    explode.excludeTarget(clickedView, true);
    TransitionSet set = new TransitionSet().addTransition(explode).addTransition(new Fade().addTarget(clickedView)).addListener(new TransitionListenerAdapter() {

        @Override
        public void onTransitionEnd(Transition transition) {
            transition.removeListener(this);
            getActivity().onBackPressed();
        }
    });
    TransitionManager.beginDelayedTransition(mRecyclerView, set);
    // remove all views from Recycler View
    mRecyclerView.setAdapter(null);
}
Also used : Explode(androidx.transition.Explode) Rect(android.graphics.Rect) TransitionSet(androidx.transition.TransitionSet) Transition(androidx.transition.Transition) TransitionListenerAdapter(androidx.transition.TransitionListenerAdapter) Fade(androidx.transition.Fade)

Example 5 with Transition

use of androidx.transition.Transition in project Transitions-Everywhere by andkulikov.

the class Scale method createAnimation.

@Nullable
private Animator createAnimation(@NonNull final View view, float startScale, float endScale, @Nullable TransitionValues values) {
    final float initialScaleX = view.getScaleX();
    final float initialScaleY = view.getScaleY();
    float startScaleX = initialScaleX * startScale;
    float endScaleX = initialScaleX * endScale;
    float startScaleY = initialScaleY * startScale;
    float endScaleY = initialScaleY * endScale;
    if (values != null) {
        Float savedScaleX = (Float) values.values.get(PROPNAME_SCALE_X);
        Float savedScaleY = (Float) values.values.get(PROPNAME_SCALE_Y);
        // continue animation from the interrupted state
        if (savedScaleX != null && savedScaleX != initialScaleX) {
            startScaleX = savedScaleX;
        }
        if (savedScaleY != null && savedScaleY != initialScaleY) {
            startScaleY = savedScaleY;
        }
    }
    view.setScaleX(startScaleX);
    view.setScaleY(startScaleY);
    Animator animator = TransitionUtils.mergeAnimators(ObjectAnimator.ofFloat(view, View.SCALE_X, startScaleX, endScaleX), ObjectAnimator.ofFloat(view, View.SCALE_Y, startScaleY, endScaleY));
    addListener(new TransitionListenerAdapter() {

        @Override
        public void onTransitionEnd(@NonNull Transition transition) {
            view.setScaleX(initialScaleX);
            view.setScaleY(initialScaleY);
            transition.removeListener(this);
        }
    });
    return animator;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) Transition(androidx.transition.Transition) TransitionListenerAdapter(androidx.transition.TransitionListenerAdapter) Nullable(androidx.annotation.Nullable)

Aggregations

Transition (androidx.transition.Transition)12 View (android.view.View)7 AutoTransition (androidx.transition.AutoTransition)7 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 ConstraintSet (androidx.constraintlayout.widget.ConstraintSet)6 RecyclerView (androidx.recyclerview.widget.RecyclerView)5 AvatarImageView (org.thoughtcrime.securesms.components.AvatarImageView)4 Animator (android.animation.Animator)3 Nullable (androidx.annotation.Nullable)3 TransitionListenerAdapter (androidx.transition.TransitionListenerAdapter)3 ValueAnimator (android.animation.ValueAnimator)2 Fade (androidx.transition.Fade)2 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 AnimatorSet (android.animation.AnimatorSet)1 ArgbEvaluator (android.animation.ArgbEvaluator)1 ObjectAnimator (android.animation.ObjectAnimator)1 Rect (android.graphics.Rect)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1