Show progress bar on local participant when not connected

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-09-16 00:15:56 +02:00
parent a76e519219
commit 2f44e6fd19
3 changed files with 26 additions and 2 deletions

View file

@ -2008,6 +2008,17 @@ public class CallActivity extends CallBaseActivity {
updateSelfVideoViewPosition();
}
private void updateSelfVideoViewConnected(boolean connected) {
// FIXME In voice only calls there is no video view, so the progress bar would appear floating in the middle of
// nowhere. However, a way to signal that the local participant is not connected to the HPB is still need in
// that case.
if (!connected && !isVoiceOnlyCall) {
binding.selfVideoViewProgressBar.setVisibility(View.VISIBLE);
} else {
binding.selfVideoViewProgressBar.setVisibility(View.GONE);
}
}
private void updateSelfVideoViewPosition() {
Log.d(TAG, "updateSelfVideoViewPosition");
if (!isInPipMode) {
@ -2051,13 +2062,17 @@ public class CallActivity extends CallBaseActivity {
if (peerConnectionEvent.getPeerConnectionEventType() ==
PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED) {
if (participantDisplayItems.get(sessionId) != null) {
if (webSocketClient != null && webSocketClient.getSessionId() == sessionId) {
updateSelfVideoViewConnected(true);
} else if (participantDisplayItems.get(sessionId) != null) {
participantDisplayItems.get(sessionId).setConnected(true);
participantsAdapter.notifyDataSetChanged();
}
} else if (peerConnectionEvent.getPeerConnectionEventType() ==
PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED) {
if (participantDisplayItems.get(sessionId) != null) {
if (webSocketClient != null && webSocketClient.getSessionId() == sessionId) {
updateSelfVideoViewConnected(false);
} else if (participantDisplayItems.get(sessionId) != null) {
participantDisplayItems.get(sessionId).setConnected(false);
participantsAdapter.notifyDataSetChanged();
}

View file

@ -77,6 +77,14 @@
android:layout_marginBottom="20dp"
app:placeholderImage="@drawable/ic_switch_video_white_24px"
app:roundAsCircle="true" />
<ProgressBar
android:id="@+id/selfVideoViewProgressBar"
style="?android:attr/progressBarStyle"
android:layout_width="@dimen/call_self_participant_progress_bar_size"
android:layout_height="@dimen/call_self_participant_progress_bar_size"
android:layout_gravity="center"
android:visibility="gone" />
</FrameLayout>
<LinearLayout

View file

@ -67,6 +67,7 @@
<dimen name="call_grid_item_min_height">180dp</dimen>
<dimen name="call_controls_height">110dp</dimen>
<dimen name="call_participant_progress_bar_size">48dp</dimen>
<dimen name="call_self_participant_progress_bar_size">48dp</dimen>
<dimen name="zero">0dp</dimen>
<dimen name="online_status_item_height">52dp</dimen>