show contact jid in call screen

closes #4071
This commit is contained in:
Daniel Gultsch 2022-03-07 12:43:55 +01:00
parent f95ed284b5
commit 2f07fccfce
2 changed files with 27 additions and 6 deletions

View file

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

View file

@ -55,10 +55,22 @@
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginTop="0dp" android:layout_marginTop="0dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="32dp" android:layout_marginBottom="8dp"
android:textAppearance="@style/TextAppearance.Conversations.Display2" android:textAppearance="@style/TextAppearance.Conversations.Display2"
android:textColor="@color/white" android:textColor="@color/white"
tools:text="Juliet Capulet" /> 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> </com.google.android.material.appbar.AppBarLayout>