Search in sources :

Example 11 with ConstraintSet

use of androidx.constraintlayout.widget.ConstraintSet in project Signal-Android by signalapp.

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 12 with ConstraintSet

use of androidx.constraintlayout.widget.ConstraintSet in project Signal-Android by signalapp.

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 13 with ConstraintSet

use of androidx.constraintlayout.widget.ConstraintSet in project Signal-Android by signalapp.

the class ContactSelectionListFragment method setChipGroupVisibility.

private void setChipGroupVisibility(int visibility) {
    if (!safeArguments().getBoolean(DISPLAY_CHIPS, requireActivity().getIntent().getBooleanExtra(DISPLAY_CHIPS, true))) {
        return;
    }
    AutoTransition transition = new AutoTransition();
    transition.setDuration(CHIP_GROUP_REVEAL_DURATION_MS);
    transition.excludeChildren(recyclerView, true);
    transition.excludeTarget(recyclerView, true);
    TransitionManager.beginDelayedTransition(constraintLayout, transition);
    ConstraintSet constraintSet = new ConstraintSet();
    constraintSet.clone(constraintLayout);
    constraintSet.setVisibility(R.id.chipGroupScrollContainer, visibility);
    constraintSet.applyTo(constraintLayout);
}
Also used : AutoTransition(androidx.transition.AutoTransition) ConstraintSet(androidx.constraintlayout.widget.ConstraintSet)

Example 14 with ConstraintSet

use of androidx.constraintlayout.widget.ConstraintSet in project Signal-Android by WhisperSystems.

the class ConversationReactionOverlay method setupSelectedEmoji.

private void setupSelectedEmoji() {
    final List<String> emojis = SignalStore.emojiValues().getReactions();
    final String oldEmoji = getOldEmoji(messageRecord);
    if (oldEmoji == null) {
        selectedView.setVisibility(View.GONE);
    }
    boolean foundSelected = false;
    for (int i = 0; i < emojiViews.length; i++) {
        final EmojiImageView view = emojiViews[i];
        view.setScaleX(1.0f);
        view.setScaleY(1.0f);
        view.setTranslationY(0);
        boolean isAtCustomIndex = i == customEmojiIndex;
        boolean isNotAtCustomIndexAndOldEmojiMatches = !isAtCustomIndex && oldEmoji != null && emojis.get(i).equals(EmojiUtil.getCanonicalRepresentation(oldEmoji));
        boolean isAtCustomIndexAndOldEmojiExists = isAtCustomIndex && oldEmoji != null;
        if (!foundSelected && (isNotAtCustomIndexAndOldEmojiMatches || isAtCustomIndexAndOldEmojiExists)) {
            foundSelected = true;
            selectedView.setVisibility(View.VISIBLE);
            ConstraintSet constraintSet = new ConstraintSet();
            constraintSet.clone(foregroundView);
            constraintSet.clear(selectedView.getId(), ConstraintSet.LEFT);
            constraintSet.clear(selectedView.getId(), ConstraintSet.RIGHT);
            constraintSet.connect(selectedView.getId(), ConstraintSet.LEFT, view.getId(), ConstraintSet.LEFT);
            constraintSet.connect(selectedView.getId(), ConstraintSet.RIGHT, view.getId(), ConstraintSet.RIGHT);
            constraintSet.applyTo(foregroundView);
            if (isAtCustomIndex) {
                view.setImageEmoji(oldEmoji);
                view.setTag(oldEmoji);
            } else {
                view.setImageEmoji(SignalStore.emojiValues().getPreferredVariation(emojis.get(i)));
            }
        } else if (isAtCustomIndex) {
            view.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_any_emoji_32));
            view.setTag(null);
        } else {
            view.setImageEmoji(SignalStore.emojiValues().getPreferredVariation(emojis.get(i)));
        }
    }
}
Also used : ConstraintSet(androidx.constraintlayout.widget.ConstraintSet) EmojiImageView(org.thoughtcrime.securesms.components.emoji.EmojiImageView)

Example 15 with ConstraintSet

use of androidx.constraintlayout.widget.ConstraintSet in project Signal-Android by WhisperSystems.

the class ConversationItemFooter method showPlaybackSpeedToggle.

private void showPlaybackSpeedToggle() {
    if (hasShrunkDate) {
        return;
    }
    hasShrunkDate = true;
    playbackSpeedToggleTextView.animate().alpha(1f).scaleX(1f).scaleY(1f).setDuration(150L).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            playbackSpeedToggleTextView.setClickable(true);
        }
    });
    if (isOutgoing) {
        dateView.setMaxWidth(ViewUtil.dpToPx(28));
    } else {
        ConstraintSet constraintSet = new ConstraintSet();
        constraintSet.clone(this);
        constraintSet.constrainMaxWidth(R.id.date_and_expiry_wrapper, ViewUtil.dpToPx(40));
        constraintSet.applyTo(this);
    }
}
Also used : Animator(android.animation.Animator) ConstraintSet(androidx.constraintlayout.widget.ConstraintSet) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Aggregations

ConstraintSet (androidx.constraintlayout.widget.ConstraintSet)19 AutoTransition (androidx.transition.AutoTransition)10 Transition (androidx.transition.Transition)8 ImageView (android.widget.ImageView)7 TextView (android.widget.TextView)7 View (android.view.View)6 RecyclerView (androidx.recyclerview.widget.RecyclerView)6 AvatarImageView (org.thoughtcrime.securesms.components.AvatarImageView)6 Animator (android.animation.Animator)4 AnimationCompleteListener (org.thoughtcrime.securesms.animation.AnimationCompleteListener)4 ConstraintLayout (androidx.constraintlayout.widget.ConstraintLayout)3 Context (android.content.Context)2 ColorMatrix (android.graphics.ColorMatrix)2 ColorMatrixColorFilter (android.graphics.ColorMatrixColorFilter)2 Point (android.graphics.Point)2 Rect (android.graphics.Rect)2 AttributeSet (android.util.AttributeSet)2 ViewGroup (android.view.ViewGroup)2 Animation (android.view.animation.Animation)2 FrameLayout (android.widget.FrameLayout)2