show contact jid in call screen (Daniel Gultsch)

This commit is contained in:
12aw 2022-03-11 08:20:16 +01:00
parent 1b12555a17
commit a2b3e083b3
2 changed files with 25 additions and 6 deletions

View file

@ -359,7 +359,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
}
} 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");
}
@ -395,7 +395,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
}
} 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 = extraLastState == null ? null : RtpEndUserState.valueOf(extraLastState);
@ -407,7 +407,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
updateProfilePicture(state);
invalidateOptionsMenu();
}
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
setWith(account.getRoster().getContact(with));
if (xmppConnectionService.getJingleConnectionManager().fireJingleRtpConnectionStateUpdates()) {
return;
}
@ -418,6 +418,14 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
finish();
}
}
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) {
checkMicrophoneAvailability();
@ -600,7 +608,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
if (JingleRtpConnection.STATES_SHOWING_ONGOING_CALL.contains(requireRtpConnection().getState())) {
putScreenInCallMode();
}
binding.with.setText(getWith().getDisplayName());
setWidth();
updateVideoViews(currentState);
updateStateDisplay(currentState, media);
updateVerifiedShield(verified && STATES_SHOWING_SWITCH_TO_CHAT.contains(currentState));
@ -624,7 +632,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
updateCallDuration();
updateVerifiedShield(false);
invalidateOptionsMenu();
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
setWith(account.getRoster().getContact(with));
}
private void reInitializeActivityWithRunningRtpSession(final Account account, Jid with, String sessionId) {

View file

@ -55,10 +55,21 @@
android:layout_marginLeft="16dp"
android:layout_marginTop="0dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="32dp"
android:layout_marginBottom="8dp"
android:textColor="@color/white"
android:textSize="50sp"
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>