show jid only for incoming calls during ringing

This commit is contained in:
Daniel Gultsch 2022-03-10 18:40:30 +01:00
parent 99e4c3d2e0
commit 3c1550b208
2 changed files with 22 additions and 13 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));
setWith(account.getRoster().getContact(with)); setWith(account.getRoster().getContact(with), null);
} 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));
setWith(account.getRoster().getContact(with)); setWith(account.getRoster().getContact(with), null);
} 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
updateIncomingCallScreen(state); updateIncomingCallScreen(state);
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
setWith(account.getRoster().getContact(with)); setWith(account.getRoster().getContact(with), state);
if (xmppConnectionService if (xmppConnectionService
.getJingleConnectionManager() .getJingleConnectionManager()
.fireJingleRtpConnectionStateUpdates()) { .fireJingleRtpConnectionStateUpdates()) {
@ -454,13 +454,19 @@ public class RtpSessionActivity extends XmppActivity
} }
} }
private void setWidth() { private void setWidth(final RtpEndUserState state) {
setWith(getWith()); setWith(getWith(), state);
} }
private void setWith(final Contact contact) { private void setWith(final Contact contact, final RtpEndUserState state) {
binding.with.setText(contact.getDisplayName()); binding.with.setText(contact.getDisplayName());
binding.withJid.setText(contact.getJid().asBareJid().toEscapedString()); if (Arrays.asList(RtpEndUserState.INCOMING_CALL, RtpEndUserState.ACCEPTING_CALL)
.contains(state)) {
binding.withJid.setText(contact.getJid().asBareJid().toEscapedString());
binding.withJid.setVisibility(View.VISIBLE);
} else {
binding.withJid.setVisibility(View.GONE);
}
} }
private void proposeJingleRtpSession( private void proposeJingleRtpSession(
@ -666,7 +672,7 @@ public class RtpSessionActivity extends XmppActivity
requireRtpConnection().getState())) { requireRtpConnection().getState())) {
putScreenInCallMode(); putScreenInCallMode();
} }
setWidth(); setWidth(currentState);
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));
@ -685,7 +691,7 @@ public class RtpSessionActivity extends XmppActivity
finish(); finish();
return; return;
} }
RtpEndUserState state = terminatedRtpSession.state; final RtpEndUserState state = terminatedRtpSession.state;
resetIntent(account, with, terminatedRtpSession.state, terminatedRtpSession.media); resetIntent(account, with, terminatedRtpSession.state, terminatedRtpSession.media);
updateButtonConfiguration(state); updateButtonConfiguration(state);
updateStateDisplay(state); updateStateDisplay(state);
@ -693,7 +699,7 @@ public class RtpSessionActivity extends XmppActivity
updateCallDuration(); updateCallDuration();
updateVerifiedShield(false); updateVerifiedShield(false);
invalidateOptionsMenu(); invalidateOptionsMenu();
setWith(account.getRoster().getContact(with)); setWith(account.getRoster().getContact(with), state);
} }
private void reInitializeActivityWithRunningRtpSession( private void reInitializeActivityWithRunningRtpSession(

View file

@ -53,24 +53,27 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/status" android:layout_below="@id/status"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginTop="0dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
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 <TextView
android:visibility="visible"
android:id="@+id/with_jid" android:id="@+id/with_jid"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/status" android:layout_below="@id/status"
android:layout_marginTop="8dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="32dp"
android:textAppearance="@style/TextAppearance.Conversations.Body1" android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:textColor="@color/white" android:textColor="@color/white"
tools:text="jcapulet@example.com" /> tools:text="jcapulet@example.com" />
<View
android:layout_width="match_parent"
android:layout_height="32dp"/>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>