show 'using account …' in incoming call screen

This commit is contained in:
Daniel Gultsch 2022-03-07 13:10:57 +01:00
parent 2f07fccfce
commit ceceead505
2 changed files with 25 additions and 8 deletions

View file

@ -434,7 +434,7 @@ public class RtpSessionActivity extends XmppActivity
updateButtonConfiguration(state); updateButtonConfiguration(state);
updateVerifiedShield(false); updateVerifiedShield(false);
updateStateDisplay(state); updateStateDisplay(state);
updateProfilePicture(state); updateIncomingCallScreen(state);
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
setWith(account.getRoster().getContact(with)); setWith(account.getRoster().getContact(with));
@ -671,7 +671,7 @@ public class RtpSessionActivity extends XmppActivity
updateStateDisplay(currentState, media); updateStateDisplay(currentState, media);
updateVerifiedShield(verified && STATES_SHOWING_SWITCH_TO_CHAT.contains(currentState)); updateVerifiedShield(verified && STATES_SHOWING_SWITCH_TO_CHAT.contains(currentState));
updateButtonConfiguration(currentState, media); updateButtonConfiguration(currentState, media);
updateProfilePicture(currentState); updateIncomingCallScreen(currentState);
invalidateOptionsMenu(); invalidateOptionsMenu();
return false; return false;
} }
@ -689,7 +689,7 @@ public class RtpSessionActivity extends XmppActivity
resetIntent(account, with, terminatedRtpSession.state, terminatedRtpSession.media); resetIntent(account, with, terminatedRtpSession.state, terminatedRtpSession.media);
updateButtonConfiguration(state); updateButtonConfiguration(state);
updateStateDisplay(state); updateStateDisplay(state);
updateProfilePicture(state); updateIncomingCallScreen(state);
updateCallDuration(); updateCallDuration();
updateVerifiedShield(false); updateVerifiedShield(false);
invalidateOptionsMenu(); invalidateOptionsMenu();
@ -790,11 +790,11 @@ public class RtpSessionActivity extends XmppActivity
this.binding.verified.setVisibility(verified ? View.VISIBLE : View.GONE); this.binding.verified.setVisibility(verified ? View.VISIBLE : View.GONE);
} }
private void updateProfilePicture(final RtpEndUserState state) { private void updateIncomingCallScreen(final RtpEndUserState state) {
updateProfilePicture(state, null); updateIncomingCallScreen(state, null);
} }
private void updateProfilePicture(final RtpEndUserState state, final Contact contact) { private void updateIncomingCallScreen(final RtpEndUserState state, final Contact contact) {
if (state == RtpEndUserState.INCOMING_CALL || state == RtpEndUserState.ACCEPTING_CALL) { if (state == RtpEndUserState.INCOMING_CALL || state == RtpEndUserState.ACCEPTING_CALL) {
final boolean show = getResources().getBoolean(R.bool.show_avatar_incoming_call); final boolean show = getResources().getBoolean(R.bool.show_avatar_incoming_call);
if (show) { if (show) {
@ -809,7 +809,14 @@ public class RtpSessionActivity extends XmppActivity
} else { } else {
binding.contactPhoto.setVisibility(View.GONE); binding.contactPhoto.setVisibility(View.GONE);
} }
final Account account = contact == null ? getWith().getAccount() : contact.getAccount();
binding.usingAccount.setVisibility(View.VISIBLE);
binding.usingAccount.setText(
getString(
R.string.using_account,
account.getJid().asBareJid().toEscapedString()));
} else { } else {
binding.usingAccount.setVisibility(View.GONE);
binding.contactPhoto.setVisibility(View.GONE); binding.contactPhoto.setVisibility(View.GONE);
} }
} }
@ -1253,7 +1260,7 @@ public class RtpSessionActivity extends XmppActivity
verified && STATES_SHOWING_SWITCH_TO_CHAT.contains(state)); verified && STATES_SHOWING_SWITCH_TO_CHAT.contains(state));
updateButtonConfiguration(state, media); updateButtonConfiguration(state, media);
updateVideoViews(state); updateVideoViews(state);
updateProfilePicture(state, contact); updateIncomingCallScreen(state, contact);
invalidateOptionsMenu(); invalidateOptionsMenu();
}); });
if (END_CARD.contains(state)) { if (END_CARD.contains(state)) {
@ -1314,7 +1321,7 @@ public class RtpSessionActivity extends XmppActivity
updateVerifiedShield(false); updateVerifiedShield(false);
updateStateDisplay(state); updateStateDisplay(state);
updateButtonConfiguration(state); updateButtonConfiguration(state);
updateProfilePicture(state); updateIncomingCallScreen(state);
invalidateOptionsMenu(); invalidateOptionsMenu();
}); });
resetIntent(account, with, state, actionToMedia(currentIntent.getAction())); resetIntent(account, with, state, actionToMedia(currentIntent.getAction()));

View file

@ -247,5 +247,15 @@
app:tint="?attr/icon_tint" /> app:tint="?attr/icon_tint" />
</RelativeLayout> </RelativeLayout>
<TextView
android:id="@+id/using_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_margin="8dp"
android:text="@string/using_account"
android:textAppearance="@style/TextAppearance.Conversations.Caption"/>
</RelativeLayout> </RelativeLayout>
</layout> </layout>