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

View file

@ -562,11 +562,9 @@ 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.getStatus() <= Message.STATUS_RECEIVED) {
if (message.getConversation().getMode() == Conversation.MODE_MULTI) { if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
Jid user = message.getCounterpart(); Jid user = message.getCounterpart();
if (user != null && !user.isBareJid()) { if (user != null && !user.isBareJid()) {
@ -575,6 +573,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
} }
highlightInConference(user.getResourcepart()); highlightInConference(user.getResourcepart());
} }
return;
} else { } else {
if (!message.getContact().isSelf()) { if (!message.getContact().isSelf()) {
String fingerprint; String fingerprint;
@ -585,12 +584,13 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
fingerprint = message.getFingerprint(); fingerprint = message.getFingerprint();
} }
activity.switchToContactDetails(message.getContact(), fingerprint); activity.switchToContactDetails(message.getContact(), fingerprint);
return;
}
} }
} }
} else {
Account account = message.getConversation().getAccount(); Account account = message.getConversation().getAccount();
Intent intent; Intent intent;
if (activity.manuallyChangePresence()) { if (activity.manuallyChangePresence() && !received) {
intent = new Intent(activity, SetPresenceActivity.class); intent = new Intent(activity, SetPresenceActivity.class);
intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT, account.getJid().toBareJid().toString()); intent.putExtra(SetPresenceActivity.EXTRA_ACCOUNT, account.getJid().toBareJid().toString());
} else { } else {
@ -608,8 +608,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
intent.putExtra("fingerprint", fingerprint); intent.putExtra("fingerprint", fingerprint);
} }
startActivity(intent); 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);