Răsfoiți Sursa

Show progress bar on local participant when not connected

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Daniel Calviño Sánchez 2 ani în urmă
părinte
comite
2f44e6fd19

+ 17 - 2
app/src/main/java/com/nextcloud/talk/activities/CallActivity.java

@@ -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();
             }

+ 8 - 0
app/src/main/res/layout/call_activity.xml

@@ -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

+ 1 - 0
app/src/main/res/values/dimens.xml

@@ -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>