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);
updateVerifiedShield(false);
updateStateDisplay(state);
updateProfilePicture(state);
updateIncomingCallScreen(state);
invalidateOptionsMenu();
}
setWith(account.getRoster().getContact(with));
@ -671,7 +671,7 @@ public class RtpSessionActivity extends XmppActivity
updateStateDisplay(currentState, media);
updateVerifiedShield(verified && STATES_SHOWING_SWITCH_TO_CHAT.contains(currentState));
updateButtonConfiguration(currentState, media);
updateProfilePicture(currentState);
updateIncomingCallScreen(currentState);
invalidateOptionsMenu();
return false;
}
@ -689,7 +689,7 @@ public class RtpSessionActivity extends XmppActivity
resetIntent(account, with, terminatedRtpSession.state, terminatedRtpSession.media);
updateButtonConfiguration(state);
updateStateDisplay(state);
updateProfilePicture(state);
updateIncomingCallScreen(state);
updateCallDuration();
updateVerifiedShield(false);
invalidateOptionsMenu();
@ -790,11 +790,11 @@ public class RtpSessionActivity extends XmppActivity
this.binding.verified.setVisibility(verified ? View.VISIBLE : View.GONE);
}
private void updateProfilePicture(final RtpEndUserState state) {
updateProfilePicture(state, null);
private void updateIncomingCallScreen(final RtpEndUserState state) {
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) {
final boolean show = getResources().getBoolean(R.bool.show_avatar_incoming_call);
if (show) {
@ -809,7 +809,14 @@ public class RtpSessionActivity extends XmppActivity
} else {
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 {
binding.usingAccount.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));
updateButtonConfiguration(state, media);
updateVideoViews(state);
updateProfilePicture(state, contact);
updateIncomingCallScreen(state, contact);
invalidateOptionsMenu();
});
if (END_CARD.contains(state)) {
@ -1314,7 +1321,7 @@ public class RtpSessionActivity extends XmppActivity
updateVerifiedShield(false);
updateStateDisplay(state);
updateButtonConfiguration(state);
updateProfilePicture(state);
updateIncomingCallScreen(state);
invalidateOptionsMenu();
});
resetIntent(account, with, state, actionToMedia(currentIntent.getAction()));

View file

@ -247,5 +247,15 @@
app:tint="?attr/icon_tint" />
</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>
</layout>