diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-09-27 21:56:44 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-09-27 21:56:44 +0200 |
commit | 68adf4c7e9bf9ca68dd81305accd12b56de38b4c (patch) | |
tree | 5ca45d9e96ccb823a15554e4525cf73bdece97ed /src/main | |
parent | dc9a87b7ea2af1f751e84e73f053fee38d5237ac (diff) |
bring back private group messages for all muc and fix broken highlight in muc
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java | 15 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java | 15 |
2 files changed, 18 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index 070914bb8..1b406b887 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -470,9 +470,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers name = user.getName(); } menu.setHeaderTitle(name); - MenuItem sendPrivateMessage = menu.findItem(R.id.send_private_message); - MenuItem highlightInMuc = menu.findItem(R.id.highlight_in_muc); - highlightInMuc.setVisible(true); MucDetailsContextMenuHelper.configureMucDetailsContextMenu(this, menu, mConversation, user); } super.onCreateContextMenu(menu, v, menuInfo); @@ -695,12 +692,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers Collections.sort(users); for (final User user : users) { ContactBinding binding = DataBindingUtil.inflate(inflater, R.layout.contact, this.binding.mucMembers, false); - final Contact contact = user.getContact(); - final String name = user.getName(); this.setListItemBackgroundOnView(binding.getRoot()); - if (contact != null && contact.showInRoster()) { - binding.getRoot().setOnClickListener((OnClickListener) view -> switchToContactDetails(contact)); - } + binding.getRoot().setOnClickListener(view1 -> highlightInMuc(mConversation, user.getName())); registerForContextMenu(binding.getRoot()); binding.getRoot().setTag(user); if (mAdvancedMode && user.getPgpKeyId() != 0) { @@ -708,6 +701,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers binding.key.setOnClickListener(v -> viewPgpKey(user)); binding.key.setText(OpenPgpUtils.convertKeyIdToHex(user.getPgpKeyId())); } + Contact contact = user.getContact(); + String name = user.getName(); if (contact != null) { binding.contactDisplayName.setText(contact.getDisplayName()); binding.contactJid.setText((name != null ? name + " \u2022 " : "") + getStatus(user)); @@ -718,9 +713,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } loadAvatar(user, binding.contactPhoto); if (user.getRole() == MucOptions.Role.NONE) { - binding.contactDisplayName.setAlpha(INACTIVE_ALPHA); - binding.key.setAlpha(INACTIVE_ALPHA); binding.contactJid.setAlpha(INACTIVE_ALPHA); + binding.key.setAlpha(INACTIVE_ALPHA); + binding.contactDisplayName.setAlpha(INACTIVE_ALPHA); binding.contactPhoto.setAlpha(INACTIVE_ALPHA); } this.binding.mucMembers.addView(binding.getRoot()); diff --git a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java index dc338e02c..f4777e8f3 100644 --- a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java +++ b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java @@ -25,6 +25,8 @@ import rocks.xmpp.addr.Jid; public final class MucDetailsContextMenuHelper { public static void configureMucDetailsContextMenu(Activity activity, Menu menu, Conversation conversation, User user) { final boolean advancedMode = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("advanced_muc_mode", false); + final MucOptions mucOptions = conversation.getMucOptions(); + MenuItem sendPrivateMessage = menu.findItem(R.id.send_private_message); if (user != null && user.getRealJid() != null) { MenuItem showContactDetails = menu.findItem(R.id.action_contact_details); MenuItem startConversation = menu.findItem(R.id.start_conversation); @@ -35,6 +37,7 @@ public final class MucDetailsContextMenuHelper { MenuItem removeFromRoom = menu.findItem(R.id.remove_from_room); MenuItem banFromConference = menu.findItem(R.id.ban_from_conference); MenuItem invite = menu.findItem(R.id.invite); + MenuItem highlightInMuc = menu.findItem(R.id.highlight_in_muc); startConversation.setVisible(true); final Contact contact = user.getContact(); final User self = conversation.getMucOptions().getSelf(); @@ -44,6 +47,11 @@ public final class MucDetailsContextMenuHelper { if (activity instanceof ConferenceDetailsActivity && user.getRole() == MucOptions.Role.NONE) { invite.setVisible(true); } + if (activity instanceof ConversationsActivity) { + highlightInMuc.setVisible(false); + } else if (activity instanceof ConferenceDetailsActivity) { + highlightInMuc.setVisible(true); + } if (self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) && self.getAffiliation().outranks(user.getAffiliation())) { if (advancedMode) { @@ -66,9 +74,9 @@ public final class MucDetailsContextMenuHelper { removeAdminPrivileges.setVisible(true); } } + sendPrivateMessage.setVisible(true); + sendPrivateMessage.setEnabled(mucOptions.allowPm()); } else { - final MucOptions mucOptions = conversation.getMucOptions(); - MenuItem sendPrivateMessage = menu.findItem(R.id.send_private_message); sendPrivateMessage.setVisible(true); sendPrivateMessage.setEnabled(user != null && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR)); } @@ -122,6 +130,9 @@ public final class MucDetailsContextMenuHelper { case R.id.invite: activity.xmppConnectionService.directInvite(conversation, jid); return true; + case R.id.highlight_in_muc: + activity.highlightInMuc(conversation, user.getName()); + return true; default: return false; } |