aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-27 22:12:18 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-27 22:12:18 +0100
commit3dfbf916c6c575a287ca663759f6d8c7e309e6af (patch)
tree4111bbb03f7571755732b2ca81816ba9d9f9b62e /src/main/java/de/pixart
parent127d920e748df607bcd971f09fe2423210ee6835 (diff)
show account details when clicking avatar picture in self chat
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java71
1 files changed, 34 insertions, 37 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index ad36be78a..e24f87d02 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -76,7 +76,6 @@ import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.ui.XmppActivity.OnPresenceSelected;
import de.pixart.messenger.ui.XmppActivity.OnValueEdited;
import de.pixart.messenger.ui.adapter.MessageAdapter;
-import de.pixart.messenger.ui.adapter.MessageAdapter.OnContactPictureClicked;
import de.pixart.messenger.ui.widget.EditMessage;
import de.pixart.messenger.utils.MessageUtils;
import de.pixart.messenger.utils.NickValidityChecker;
@@ -601,54 +600,52 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
messagesView.setOnScrollListener(mOnScrollListener);
messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
messageListAdapter = new MessageAdapter((ConversationActivity) getActivity(), this.messageList);
- messageListAdapter.setOnContactPictureClicked(new OnContactPictureClicked() {
-
- @Override
- public void onContactPictureClicked(Message message) {
- if (message.getStatus() <= Message.STATUS_RECEIVED) {
- if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
- Jid user = message.getCounterpart();
- if (user != null && !user.isBareJid()) {
- 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);
+ messageListAdapter.setOnContactPictureClicked(message -> {
+ final boolean received = message.getStatus() <= Message.STATUS_RECEIVED;
+ if (received) {
+ if (message.getConversation().getMode() == Conversation.MODE_MULTI) {
+ Jid user = message.getCounterpart();
+ if (user != null && !user.isBareJid()) {
+ 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());
}
+ return;
} else {
- Account account = message.getConversation().getAccount();
- 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());
+ if (!message.getContact().isSelf()) {
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);
+ 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 -> {
if (message.getStatus() <= Message.STATUS_RECEIVED) {
@@ -671,7 +668,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
activity.showQrCode();
}
});
- messageListAdapter.setOnQuoteListener(text -> quoteText(text));
+ messageListAdapter.setOnQuoteListener(this::quoteText);
messagesView.setAdapter(messageListAdapter);
registerForContextMenu(messagesView);