From f4de6c8d841c4b2fd780fca7e237b69550292f7f Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Tue, 7 Aug 2012 19:03:28 -0700 Subject: [PATCH] Only show call button when we've got a conversation recipient. --- res/menu/conversation.xml | 5 ----- res/menu/conversation_callable.xml | 10 ++++++++++ .../securesms/ConversationActivity.java | 20 +++++++++++-------- 3 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 res/menu/conversation_callable.xml diff --git a/res/menu/conversation.xml b/res/menu/conversation.xml index a206204bcf..b5e1e791ae 100644 --- a/res/menu/conversation.xml +++ b/res/menu/conversation.xml @@ -1,11 +1,6 @@ - - diff --git a/res/menu/conversation_callable.xml b/res/menu/conversation_callable.xml new file mode 100644 index 0000000000..e53363b71d --- /dev/null +++ b/res/menu/conversation_callable.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 276b1a419e..8619186392 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -197,6 +197,10 @@ public class ConversationActivity extends SherlockFragmentActivity inflater.inflate(R.menu.conversation_insecure, menu); } + if (isSingleConversation()) { + inflater.inflate(R.menu.conversation_callable, menu); + } + inflater.inflate(R.menu.conversation, menu); super.onPrepareOptionsMenu(menu); return true; @@ -206,14 +210,14 @@ public class ConversationActivity extends SherlockFragmentActivity public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { - case R.id.menu_call: handleDial(recipients.getPrimaryRecipient()); return true; - case R.id.menu_delete_thread: handleDeleteThread(); return true; - case R.id.menu_add_attachment: handleAddAttachment(); return true; - case R.id.menu_start_secure_session: handleStartSecureSession(); return true; - case R.id.menu_abort_session: handleAbortSecureSession(); return true; - case R.id.menu_verify_recipient: handleVerifyRecipient(); return true; - case R.id.menu_verify_session: handleVerifySession(); return true; - case android.R.id.home: finish(); return true; + case R.id.menu_call: handleDial(getRecipients().getPrimaryRecipient()); return true; + case R.id.menu_delete_thread: handleDeleteThread(); return true; + case R.id.menu_add_attachment: handleAddAttachment(); return true; + case R.id.menu_start_secure_session: handleStartSecureSession(); return true; + case R.id.menu_abort_session: handleAbortSecureSession(); return true; + case R.id.menu_verify_recipient: handleVerifyRecipient(); return true; + case R.id.menu_verify_session: handleVerifySession(); return true; + case android.R.id.home: finish(); return true; } return false;