show contact jid in call screen

Daniel Gultsch created

closes #4071

Change summary

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 19 ++
src/main/res/layout/activity_rtp_session.xml                    | 14 ++
2 files changed, 27 insertions(+), 6 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java 🔗

@@ -400,7 +400,7 @@ public class RtpSessionActivity extends XmppActivity
             }
         } else if (asList(ACTION_MAKE_VIDEO_CALL, ACTION_MAKE_VOICE_CALL).contains(action)) {
             proposeJingleRtpSession(account, with, actionToMedia(action));
-            binding.with.setText(account.getRoster().getContact(with).getDisplayName());
+            setWith(account.getRoster().getContact(with));
         } else {
             throw new IllegalStateException("received onNewIntent without sessionId");
         }
@@ -424,7 +424,7 @@ public class RtpSessionActivity extends XmppActivity
             }
         } else if (asList(ACTION_MAKE_VIDEO_CALL, ACTION_MAKE_VOICE_CALL).contains(action)) {
             proposeJingleRtpSession(account, with, actionToMedia(action));
-            binding.with.setText(account.getRoster().getContact(with).getDisplayName());
+            setWith(account.getRoster().getContact(with));
         } else if (Intent.ACTION_VIEW.equals(action)) {
             final String extraLastState = intent.getStringExtra(EXTRA_LAST_REPORTED_STATE);
             final RtpEndUserState state =
@@ -437,7 +437,7 @@ public class RtpSessionActivity extends XmppActivity
                 updateProfilePicture(state);
                 invalidateOptionsMenu();
             }
-            binding.with.setText(account.getRoster().getContact(with).getDisplayName());
+            setWith(account.getRoster().getContact(with));
             if (xmppConnectionService
                     .getJingleConnectionManager()
                     .fireJingleRtpConnectionStateUpdates()) {
@@ -454,6 +454,15 @@ public class RtpSessionActivity extends XmppActivity
         }
     }
 
+    private void setWidth() {
+        setWith(getWith());
+    }
+
+    private void setWith(final Contact contact) {
+        binding.with.setText(contact.getDisplayName());
+        binding.withJid.setText(contact.getJid().asBareJid().toEscapedString());
+    }
+
     private void proposeJingleRtpSession(
             final Account account, final Jid with, final Set<Media> media) {
         checkMicrophoneAvailabilityAsync();
@@ -657,7 +666,7 @@ public class RtpSessionActivity extends XmppActivity
                 requireRtpConnection().getState())) {
             putScreenInCallMode();
         }
-        binding.with.setText(getWith().getDisplayName());
+        setWidth();
         updateVideoViews(currentState);
         updateStateDisplay(currentState, media);
         updateVerifiedShield(verified && STATES_SHOWING_SWITCH_TO_CHAT.contains(currentState));
@@ -684,7 +693,7 @@ public class RtpSessionActivity extends XmppActivity
         updateCallDuration();
         updateVerifiedShield(false);
         invalidateOptionsMenu();
-        binding.with.setText(account.getRoster().getContact(with).getDisplayName());
+        setWith(account.getRoster().getContact(with));
     }
 
     private void reInitializeActivityWithRunningRtpSession(

src/main/res/layout/activity_rtp_session.xml 🔗

@@ -55,10 +55,22 @@
                 android:layout_marginLeft="16dp"
                 android:layout_marginTop="0dp"
                 android:layout_marginRight="16dp"
-                android:layout_marginBottom="32dp"
+                android:layout_marginBottom="8dp"
                 android:textAppearance="@style/TextAppearance.Conversations.Display2"
                 android:textColor="@color/white"
                 tools:text="Juliet Capulet" />
+            <TextView
+                android:id="@+id/with_jid"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/status"
+                android:layout_marginLeft="16dp"
+                android:layout_marginRight="16dp"
+                android:layout_marginBottom="32dp"
+                android:textAppearance="@style/TextAppearance.Conversations.Body1"
+                android:textColor="@color/white"
+                tools:text="jcapulet@example.com" />
+
 
         </com.google.android.material.appbar.AppBarLayout>