Add Group Call speaker view hint.

fork-5.53.8
Cody Henthorne 2020-12-07 10:46:36 -05:00 zatwierdzone przez GitHub
rodzic 9b81e7f71b
commit 595d5dddbe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
8 zmienionych plików z 91 dodań i 1 usunięć

Wyświetl plik

@ -283,6 +283,10 @@ public class WebRtcCallActivity extends AppCompatActivity implements SafetyNumbe
videoTooltip.dismiss();
videoTooltip = null;
}
} else if (event instanceof WebRtcCallViewModel.Event.ShowSpeakerViewHint) {
callScreen.showSpeakerViewHint();
} else if (event instanceof WebRtcCallViewModel.Event.HideSpeakerViewHint) {
callScreen.hideSpeakerViewHint();
} else {
throw new IllegalArgumentException("Unknown event: " + event);
}

Wyświetl plik

@ -8,6 +8,7 @@ import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.animation.Animation;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -47,6 +48,7 @@ import org.thoughtcrime.securesms.ringrtc.CameraState;
import org.thoughtcrime.securesms.util.BlurTransformation;
import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.ViewUtil;
import org.thoughtcrime.securesms.util.views.Stub;
import org.webrtc.RendererCommon;
import org.whispersystems.signalservice.api.messages.calls.HangupMessage;
@ -93,6 +95,7 @@ public class WebRtcCallView extends FrameLayout {
private Toolbar toolbar;
private MaterialButton startCall;
private TextView participantCount;
private Stub<FrameLayout> groupCallSpeakerHint;
private int pagerBottomMarginDp;
private boolean controlsVisible = true;
@ -148,6 +151,7 @@ public class WebRtcCallView extends FrameLayout {
callParticipantsRecycler = findViewById(R.id.call_screen_participants_recycler);
toolbar = findViewById(R.id.call_screen_toolbar);
startCall = findViewById(R.id.call_screen_start_call_start_call);
groupCallSpeakerHint = new Stub<>(findViewById(R.id.call_screen_group_call_speaker_hint));
View topGradient = findViewById(R.id.call_screen_header_gradient);
View decline = findViewById(R.id.call_screen_decline_call);
@ -503,6 +507,16 @@ public class WebRtcCallView extends FrameLayout {
return videoToggle;
}
public void showSpeakerViewHint() {
groupCallSpeakerHint.get();
}
public void hideSpeakerViewHint() {
if (groupCallSpeakerHint.resolved()) {
groupCallSpeakerHint.get().setVisibility(View.GONE);
}
}
private void animatePipToLargeRectangle() {
ResizeAnimation animation = new ResizeAnimation(smallLocalRenderFrame, ViewUtil.dpToPx(90), ViewUtil.dpToPx(160));
animation.setDuration(PIP_RESIZE_DURATION);

Wyświetl plik

@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.events.CallParticipantId;
import org.thoughtcrime.securesms.events.WebRtcViewModel;
import org.thoughtcrime.securesms.groups.LiveGroup;
import org.thoughtcrime.securesms.groups.ui.GroupMemberEntry;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.recipients.LiveRecipient;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId;
@ -122,6 +123,10 @@ public class WebRtcCallViewModel extends ViewModel {
public void setIsViewingFocusedParticipant(@NonNull CallParticipantsState.SelectedPage page) {
//noinspection ConstantConditions
participantsState.setValue(CallParticipantsState.update(participantsState.getValue(), page));
if (page == CallParticipantsState.SelectedPage.FOCUSED) {
SignalStore.tooltips().markGroupCallSpeakerViewSeen();
events.setValue(new Event.HideSpeakerViewHint());
}
}
public void onDismissedVideoTooltip() {
@ -179,6 +184,14 @@ public class WebRtcCallViewModel extends ViewModel {
canDisplayTooltipIfNeeded = false;
events.setValue(new Event.ShowVideoTooltip());
}
//noinspection ConstantConditions
if (!isInPipMode.getValue() &&
webRtcViewModel.getRemoteParticipants().size() > 1 &&
webRtcViewModel.getGroupState().isConnected() &&
!SignalStore.tooltips().hasSeenGroupCallSpeakerView()) {
events.setValue(new Event.ShowSpeakerViewHint());
}
}
private boolean containsPlaceholders(@NonNull List<CallParticipant> callParticipants) {
@ -312,6 +325,12 @@ public class WebRtcCallViewModel extends ViewModel {
public static class DismissVideoTooltip extends Event {
}
public static class ShowSpeakerViewHint extends Event {
}
public static class HideSpeakerViewHint extends Event {
}
public static class StartCall extends Event {
private final boolean isVideoCall;

Wyświetl plik

@ -4,7 +4,8 @@ import androidx.annotation.NonNull;
public class TooltipValues extends SignalStoreValues {
private static final String BLUR_HUD_ICON = "tooltip.blur_hud_icon";
private static final String BLUR_HUD_ICON = "tooltip.blur_hud_icon";
private static final String GROUP_CALL_SPEAKER_VIEW = "tooltip.group_call_speaker_view";
TooltipValues(@NonNull KeyValueStore store) {
super(store);
@ -21,4 +22,12 @@ public class TooltipValues extends SignalStoreValues {
public void markBlurHudIconTooltipSeen() {
putBoolean(BLUR_HUD_ICON, true);
}
public boolean hasSeenGroupCallSpeakerView() {
return getBoolean(GROUP_CALL_SPEAKER_VIEW, false);
}
public void markGroupCallSpeakerViewSeen() {
putBoolean(GROUP_CALL_SPEAKER_VIEW, true);
}
}

Wyświetl plik

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:fillColor="#FF000000"
android:pathData="M13.513,7.485l-1.061,1.061l-2.87,-2.871l-0.803,-1.125l0,8.45l-1.5,0l0,-8.45l-0.744,1.041l-2.994,2.958l-1.054,-1.067l5.545,-5.479l5.481,5.482z"/>
</vector>

Wyświetl plik

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp">
<androidx.appcompat.widget.AppCompatTextView
style="@style/TextAppearance.Signal.Body2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/call_participant_update_window_background"
android:gravity="center"
android:minHeight="48dp"
android:padding="12dp"
android:text="@string/WebRtcCallScreen_swipe_up_to_change_views"
app:drawableStartCompat="@drawable/ic_arrow_up_16"
android:drawablePadding="8dp"
android:textColor="@color/core_grey_05"
app:drawableTint="@color/core_grey_05" />
</FrameLayout>

Wyświetl plik

@ -316,6 +316,17 @@
</LinearLayout>
<ViewStub
android:id="@+id/call_screen_group_call_speaker_hint"
android:layout="@layout/group_call_speaker_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:inflatedId="@+id/call_screen_group_call_speaker_hint_view"
app:layout_constraintBottom_toTopOf="@+id/call_screen_footer_gradient_barrier"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/call_screen_footer_gradient_barrier"
android:layout_width="wrap_content"

Wyświetl plik

@ -1805,6 +1805,7 @@
<string name="WebRtcCallScreen_new_safety_number_title">New safety number</string>
<string name="WebRtcCallScreen_accept">Accept</string>
<string name="WebRtcCallScreen_end_call">End call</string>
<string name="WebRtcCallScreen_swipe_up_to_change_views">Swipe up to change views</string>
<!-- WebRtcCallScreen V2 -->
<string name="WebRtcCallScreen__decline">Decline</string>