show account details when clicking avatar picture in self chat

This commit is contained in:
Daniel Gultsch 2018-01-27 21:34:32 +01:00
parent 8f9640a9e1
commit c7bdc343ec
1 changed files with 34 additions and 36 deletions

View File

@ -562,54 +562,52 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
messagesView.setOnScrollListener(mOnScrollListener); messagesView.setOnScrollListener(mOnScrollListener);
messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL); messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
messageListAdapter = new MessageAdapter((ConversationActivity) getActivity(), this.messageList); messageListAdapter = new MessageAdapter((ConversationActivity) getActivity(), this.messageList);
messageListAdapter.setOnContactPictureClicked(new OnContactPictureClicked() { messageListAdapter.setOnContactPictureClicked(message -> {
final boolean received = message.getStatus() <= Message.STATUS_RECEIVED;
@Override if (received) {
public void onContactPictureClicked(Message message) { if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
if (message.getStatus() <= Message.STATUS_RECEIVED) { Jid user = message.getCounterpart();
if (message.getConversation().getMode() == Conversation.MODE_MULTI) { if (user != null && !user.isBareJid()) {
Jid user = message.getCounterpart(); if (!message.getConversation().getMucOptions().isUserInRoom(user)) {
if (user != null && !user.isBareJid()) { Toast.makeText(activity, activity.getString(R.string.user_has_left_conference, user.getResourcepart()), Toast.LENGTH_SHORT).show();
if (!message.getConversation().getMucOptions().isUserInRoom(user)) {
Toast.makeText(activity, activity.getString(R.string.user_has_left_conference, user.getResourcepart()), Toast.LENGTH_SHORT).show();
}
highlightInConference(user.getResourcepart());
}
} else {
if (!message.getContact().isSelf()) {
String fingerprint;
if (message.getEncryption() == Message.ENCRYPTION_PGP
|| message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
fingerprint = "pgp";
} else {
fingerprint = message.getFingerprint();
}
activity.switchToContactDetails(message.getContact(), fingerprint);
} }
highlightInConference(user.getResourcepart());
} }
return;
} else { } else {
Account account = message.getConversation().getAccount(); if (!message.getContact().isSelf()) {
Intent intent;
if (activity.manuallyChangePresence()) {
intent = new Intent(activity, SetPresenceActivity.class);
intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT, account.getJid().toBareJid().toString());
} else {
intent = new Intent(activity, EditAccountActivity.class);
intent.putExtra("jid", account.getJid().toBareJid().toString());
String fingerprint; String fingerprint;
if (message.getEncryption() == Message.ENCRYPTION_PGP if (message.getEncryption() == Message.ENCRYPTION_PGP
|| message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
fingerprint = "pgp"; fingerprint = "pgp";
} else if (message.getEncryption() == Message.ENCRYPTION_OTR) {
fingerprint = "otr";
} else { } else {
fingerprint = message.getFingerprint(); fingerprint = message.getFingerprint();
} }
intent.putExtra("fingerprint", fingerprint); activity.switchToContactDetails(message.getContact(), fingerprint);
return;
} }
startActivity(intent);
} }
} }
Account account = message.getConversation().getAccount();
Intent intent;
if (activity.manuallyChangePresence() && !received) {
intent = new Intent(activity, SetPresenceActivity.class);
intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT, account.getJid().toBareJid().toString());
} else {
intent = new Intent(activity, EditAccountActivity.class);
intent.putExtra("jid", account.getJid().toBareJid().toString());
String fingerprint;
if (message.getEncryption() == Message.ENCRYPTION_PGP
|| message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
fingerprint = "pgp";
} else if (message.getEncryption() == Message.ENCRYPTION_OTR) {
fingerprint = "otr";
} else {
fingerprint = message.getFingerprint();
}
intent.putExtra("fingerprint", fingerprint);
}
startActivity(intent);
}); });
messageListAdapter.setOnContactPictureLongClicked(message -> { messageListAdapter.setOnContactPictureLongClicked(message -> {
if (message.getStatus() <= Message.STATUS_RECEIVED) { if (message.getStatus() <= Message.STATUS_RECEIVED) {
@ -632,7 +630,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
activity.showQrCode(); activity.showQrCode();
} }
}); });
messageListAdapter.setOnQuoteListener(text -> quoteText(text)); messageListAdapter.setOnQuoteListener(this::quoteText);
messagesView.setAdapter(messageListAdapter); messagesView.setAdapter(messageListAdapter);
registerForContextMenu(messagesView); registerForContextMenu(messagesView);