Only show call button when we've got a conversation recipient.

This commit is contained in:
Moxie Marlinspike 2012-08-07 19:03:28 -07:00
parent 5fb7ae7ecf
commit f4de6c8d84
3 changed files with 22 additions and 13 deletions

View File

@ -1,11 +1,6 @@
<?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:title="Call"
android:id="@+id/menu_call"
android:icon="@drawable/ic_menu_call"
android:showAsAction="ifRoom" />
<item android:title="Add attachment" <item android:title="Add attachment"
android:id="@+id/menu_add_attachment" android:id="@+id/menu_add_attachment"
android:icon="@drawable/ic_menu_attach" /> android:icon="@drawable/ic_menu_attach" />

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="Call"
android:id="@+id/menu_call"
android:icon="@drawable/ic_menu_call"
android:showAsAction="ifRoom" />
</menu>

View File

@ -197,6 +197,10 @@ public class ConversationActivity extends SherlockFragmentActivity
inflater.inflate(R.menu.conversation_insecure, menu); inflater.inflate(R.menu.conversation_insecure, menu);
} }
if (isSingleConversation()) {
inflater.inflate(R.menu.conversation_callable, menu);
}
inflater.inflate(R.menu.conversation, menu); inflater.inflate(R.menu.conversation, menu);
super.onPrepareOptionsMenu(menu); super.onPrepareOptionsMenu(menu);
return true; return true;
@ -206,14 +210,14 @@ public class ConversationActivity extends SherlockFragmentActivity
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item); super.onOptionsItemSelected(item);
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.menu_call: handleDial(recipients.getPrimaryRecipient()); 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_delete_thread: handleDeleteThread(); return true;
case R.id.menu_add_attachment: handleAddAttachment(); 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_start_secure_session: handleStartSecureSession(); return true;
case R.id.menu_abort_session: handleAbortSecureSession(); 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_recipient: handleVerifyRecipient(); return true;
case R.id.menu_verify_session: handleVerifySession(); return true; case R.id.menu_verify_session: handleVerifySession(); return true;
case android.R.id.home: finish(); return true; case android.R.id.home: finish(); return true;
} }
return false; return false;