Improve UI for group SMS ConversationActivity

1) Change title to indicate it's a group message, and specify
the number of recipients.

2) Add an ActionBar icon to display a list of the recipients.
master
Moxie Marlinspike 2012-10-21 14:34:09 -07:00
parent 05ce6d6cac
commit 1bd260b981
6 changed files with 47 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="@string/convesation_group_options__recipients_list"
android:id="@+id/menu_group_recipients"
android:icon="@drawable/ic_groups_holo_dark"
android:showAsAction="ifRoom" />
</menu>

View File

@ -79,6 +79,9 @@
<string name="ConversationActivity_recipient_is_not_a_valid_sms_or_email_address_exclamation">Recipient is not a valid SMS or email address!</string>
<string name="ConversationActivity_message_is_empty_exclamation">Message is empty!</string>
<string name="ConversationActivity_forward_message_prefix">FWD</string>
<string name="ConversationActivity_group_conversation_recipients">Group Conversation Recipients</string>
<string name="ConversationActivity_group_conversation">Group Conversation</string>
<string name="ConversationActivity_d_recipients_in_group">%d recipients in group</string>
<!-- ConversationFragment -->
<string name="ConversationFragment_message_details">Message details</string>
@ -404,6 +407,9 @@
<string name="conversation__menu_delete_thread">Delete thread</string>
<string name="conversation__menu_compare">Compare</string>
<!-- conversation_group_options -->
<string name="convesation_group_options__recipients_list">Recipients list</string>
<!-- key_scanning -->
<string name="key_scanning__menu_compare">Compare</string>
<string name="key_scanning__menu_get_scanned_to_compare">Get scanned to compare</string>
@ -422,9 +428,10 @@
<!-- verify_keys -->
<string name="verify_keys__menu_verified">Verified</string>
<!-- EOF -->
<!-- Misc. piggybacking -->
<string name="PlayStoreListing">TextSecure is a security enhanced text messaging application that serves as a full replacement for the default text messaging application. Messages to other TextSecure users are encrypted over the air, and all text messages are stored in an encrypted database on the device. If your phone is lost or stolen, your messages will be safe, and communication with other TextSecure users can\'t be monitored over the air.</string>
<!-- EOF -->
</resources>

View File

@ -73,6 +73,8 @@ import org.thoughtcrime.securesms.util.MemoryCleaner;
import ws.com.google.android.mms.MmsException;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
/**
* Activity for displaying a message thread, as well as
@ -199,6 +201,8 @@ public class ConversationActivity extends SherlockFragmentActivity
if (isSingleConversation()) {
inflater.inflate(R.menu.conversation_callable, menu);
} else if (isGroupConversation()) {
inflater.inflate(R.menu.conversation_group_options, menu);
}
inflater.inflate(R.menu.conversation, menu);
@ -217,6 +221,7 @@ public class ConversationActivity extends SherlockFragmentActivity
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 R.id.menu_group_recipients: handleDisplayGroupRecipients(); return true;
case android.R.id.home: finish(); return true;
}
@ -305,6 +310,22 @@ public class ConversationActivity extends SherlockFragmentActivity
startActivity(dialIntent);
}
private void handleDisplayGroupRecipients() {
List<String> recipientStrings = new LinkedList<String>();
for (Recipient recipient : getRecipients().getRecipientsList()) {
recipientStrings.add(recipient.getName());
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.ConversationActivity_group_conversation_recipients);
builder.setIcon(R.drawable.ic_groups_holo_dark);
builder.setCancelable(true);
builder.setItems(recipientStrings.toArray(new String[]{}), null);
builder.setPositiveButton(android.R.string.ok, null);
builder.show();
}
private void handleDeleteThread() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.ConversationActivity_delete_thread_confirmation);
@ -356,6 +377,10 @@ public class ConversationActivity extends SherlockFragmentActivity
} else {
subtitle = getRecipients().getPrimaryRecipient().getNumber();
}
} else if (isGroupConversation()) {
title = getString(R.string.ConversationActivity_group_conversation);
subtitle = String.format(getString(R.string.ConversationActivity_d_recipients_in_group),
getRecipients().getRecipientsList().size());
} else {
title = getString(R.string.ConversationActivity_compose_message);
subtitle = "";
@ -526,6 +551,10 @@ public class ConversationActivity extends SherlockFragmentActivity
return getRecipients() != null && getRecipients().isSingleRecipient();
}
private boolean isGroupConversation() {
return getRecipients() != null && !getRecipients().isSingleRecipient();
}
private boolean isAuthenticatedSession() {
return AuthenticityCalculator.isAuthenticated(this,
getRecipients().getPrimaryRecipient(),