don't show 'show contact details' context menu item when contact isn not in roster

This commit is contained in:
Daniel Gultsch 2015-07-20 14:24:59 +02:00
parent 2d2da11bfa
commit 9c91b9036a
2 changed files with 33 additions and 28 deletions

View file

@ -283,7 +283,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
MenuItem removeFromRoom = menu.findItem(R.id.remove_from_room); MenuItem removeFromRoom = menu.findItem(R.id.remove_from_room);
MenuItem banFromConference = menu.findItem(R.id.ban_from_conference); MenuItem banFromConference = menu.findItem(R.id.ban_from_conference);
startConversation.setVisible(true); startConversation.setVisible(true);
if (contact != null) {
showContactDetails.setVisible(true); showContactDetails.setVisible(true);
}
if (self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) && if (self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) &&
self.getAffiliation().outranks(user.getAffiliation())) { self.getAffiliation().outranks(user.getAffiliation())) {
if (mAdvancedMode) { if (mAdvancedMode) {
@ -312,7 +314,10 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
public boolean onContextItemSelected(MenuItem item) { public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_contact_details: case R.id.action_contact_details:
switchToContactDetails(mSelectedUser.getContact()); Contact contact = mSelectedUser.getContact();
if (contact != null) {
switchToContactDetails(contact);
}
return true; return true;
case R.id.start_conversation: case R.id.start_conversation:
startConversation(mSelectedUser); startConversation(mSelectedUser);

View file

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_contact_details"
android:title="@string/action_contact_details"
android:visible="false" />
<item <item
android:id="@+id/start_conversation" android:id="@+id/start_conversation"
android:title="@string/start_conversation" android:title="@string/start_conversation"
android:visible="false"/> android:visible="false"/>
<item
android:id="@+id/action_contact_details"
android:title="@string/action_contact_details"
android:visible="false"/>
<item <item
android:id="@+id/give_membership" android:id="@+id/give_membership"
android:title="@string/grant_membership" android:title="@string/grant_membership"