mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 12:08:34 +00:00
Show raise hand on each particpiant.
This commit is contained in:
committed by
Clark Chen
parent
c837840e04
commit
4a102d44cb
@@ -6,6 +6,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -36,6 +37,7 @@ import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.util.AvatarUtil;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.webrtc.RendererCommon;
|
||||
import org.whispersystems.signalservice.api.util.Preconditions;
|
||||
@@ -57,6 +59,7 @@ public class CallParticipantView extends ConstraintLayout {
|
||||
|
||||
private RecipientId recipientId;
|
||||
private boolean infoMode;
|
||||
private boolean raiseHandAllowed;
|
||||
private Runnable missingMediaKeysUpdater;
|
||||
|
||||
private SelfPipMode selfPipMode = SelfPipMode.NOT_SELF_PIP;
|
||||
@@ -76,6 +79,8 @@ public class CallParticipantView extends ConstraintLayout {
|
||||
private AppCompatImageView infoIcon;
|
||||
private View switchCameraIconFrame;
|
||||
private View switchCameraIcon;
|
||||
private ImageView raiseHandIcon;
|
||||
private TextView nameLabel;
|
||||
|
||||
public CallParticipantView(@NonNull Context context) {
|
||||
super(context);
|
||||
@@ -108,6 +113,8 @@ public class CallParticipantView extends ConstraintLayout {
|
||||
pipBadge = findViewById(R.id.call_participant_item_pip_badge);
|
||||
switchCameraIconFrame = findViewById(R.id.call_participant_switch_camera);
|
||||
switchCameraIcon = findViewById(R.id.call_participant_switch_camera_icon);
|
||||
raiseHandIcon = findViewById(R.id.call_participant_raise_hand_icon);
|
||||
nameLabel = findViewById(R.id.call_participant_name_label);
|
||||
|
||||
avatar.setFallbackPhotoProvider(FALLBACK_PHOTO_PROVIDER);
|
||||
useLargeAvatar();
|
||||
@@ -172,6 +179,15 @@ public class CallParticipantView extends ConstraintLayout {
|
||||
|
||||
audioIndicator.setVisibility(View.VISIBLE);
|
||||
audioIndicator.bind(participant.isMicrophoneEnabled(), participant.getAudioLevel());
|
||||
final String shortRecipientDisplayName = participant.getShortRecipientDisplayName(getContext());
|
||||
if (FeatureFlags.groupCallRaiseHand() && raiseHandAllowed && participant.isHandRaised()) {
|
||||
raiseHandIcon.setVisibility(View.VISIBLE);
|
||||
nameLabel.setVisibility(View.VISIBLE);
|
||||
nameLabel.setText(shortRecipientDisplayName);
|
||||
} else {
|
||||
raiseHandIcon.setVisibility(View.GONE);
|
||||
nameLabel.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (participantChanged || !Objects.equals(contactPhoto, participant.getRecipient().getContactPhoto())) {
|
||||
@@ -219,6 +235,10 @@ public class CallParticipantView extends ConstraintLayout {
|
||||
pipBadge.setVisibility(shouldRenderInPip ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public void setRaiseHandAllowed(boolean raiseHandAllowed) {
|
||||
this.raiseHandAllowed = raiseHandAllowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust UI elements for the various self PIP positions. If called after a {@link TransitionManager#beginDelayedTransition(ViewGroup, Transition)},
|
||||
* the changes to the UI elements will animate.
|
||||
|
||||
@@ -28,6 +28,7 @@ public class CallParticipantsLayout extends FlexboxLayout {
|
||||
|
||||
private static final int MULTIPLE_PARTICIPANT_SPACING = ViewUtil.dpToPx(3);
|
||||
private static final int CORNER_RADIUS = ViewUtil.dpToPx(10);
|
||||
private static final int RAISE_HAND_MINIMUM_COUNT = 2;
|
||||
|
||||
private List<CallParticipant> callParticipants = Collections.emptyList();
|
||||
private CallParticipant focusedParticipant = null;
|
||||
@@ -145,6 +146,8 @@ public class CallParticipantsLayout extends FlexboxLayout {
|
||||
callParticipantView.useLargeAvatar();
|
||||
}
|
||||
|
||||
callParticipantView.setRaiseHandAllowed(count >= RAISE_HAND_MINIMUM_COUNT);
|
||||
|
||||
layoutStrategy.setChildLayoutParams(view, index, getChildCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ class WebRtcCallParticipantsPagerAdapter extends ListAdapter<WebRtcCallParticipa
|
||||
CallParticipant participant = page.getCallParticipants().get(0);
|
||||
callParticipantView.setCallParticipant(participant);
|
||||
callParticipantView.setRenderInPip(page.isRenderInPip());
|
||||
callParticipantView.setRaiseHandAllowed(false);
|
||||
if (participant.isScreenSharing()) {
|
||||
callParticipantView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
|
||||
} else {
|
||||
|
||||
@@ -159,4 +159,34 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/call_participant_raise_hand_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/circle_tintable"
|
||||
android:backgroundTint="@color/signal_light_colorSurface"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/symbol_raise_hand_24"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/call_participant_name_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textAppearance="@style/TextAppearance.Signal.Body2"
|
||||
android:textColor="@color/signal_light_colorOnPrimary"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/call_participant_raise_hand_icon"
|
||||
app:layout_constraintStart_toEndOf="@id/call_participant_raise_hand_icon"
|
||||
app:layout_constraintTop_toTopOf="@id/call_participant_raise_hand_icon"
|
||||
tools:text="Alice"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</org.thoughtcrime.securesms.components.webrtc.CallParticipantView>
|
||||
|
||||
Reference in New Issue
Block a user