|
|
@ -108,6 +108,7 @@ import ws.com.google.android.mms.MmsException;
|
|
|
|
public class ConversationActivity extends PassphraseRequiredSherlockFragmentActivity
|
|
|
|
public class ConversationActivity extends PassphraseRequiredSherlockFragmentActivity
|
|
|
|
implements ConversationFragment.ConversationFragmentListener
|
|
|
|
implements ConversationFragment.ConversationFragmentListener
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private static final String TAG = "ConversationActivity";
|
|
|
|
|
|
|
|
|
|
|
|
public static final String RECIPIENTS_EXTRA = "recipients";
|
|
|
|
public static final String RECIPIENTS_EXTRA = "recipients";
|
|
|
|
public static final String THREAD_ID_EXTRA = "thread_id";
|
|
|
|
public static final String THREAD_ID_EXTRA = "thread_id";
|
|
|
@ -232,8 +233,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|
|
|
MenuInflater inflater = this.getSupportMenuInflater();
|
|
|
|
MenuInflater inflater = this.getSupportMenuInflater();
|
|
|
|
menu.clear();
|
|
|
|
menu.clear();
|
|
|
|
|
|
|
|
|
|
|
|
if (isSingleConversation() && isEncryptedConversation)
|
|
|
|
if (isSingleConversation() && isEncryptedConversation) {
|
|
|
|
{
|
|
|
|
|
|
|
|
if (isAuthenticatedConversation) {
|
|
|
|
if (isAuthenticatedConversation) {
|
|
|
|
inflater.inflate(R.menu.conversation_secure_identity, menu);
|
|
|
|
inflater.inflate(R.menu.conversation_secure_identity, menu);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -248,13 +248,15 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|
|
|
} else if (isGroupConversation()) {
|
|
|
|
} else if (isGroupConversation()) {
|
|
|
|
inflater.inflate(R.menu.conversation_group_options, menu);
|
|
|
|
inflater.inflate(R.menu.conversation_group_options, menu);
|
|
|
|
|
|
|
|
|
|
|
|
if (distributionType == ThreadDatabase.DistributionTypes.BROADCAST)
|
|
|
|
if (!isPushGroupConversation()) {
|
|
|
|
{
|
|
|
|
inflater.inflate(R.menu.conversation_mms_group_options, menu);
|
|
|
|
|
|
|
|
if (distributionType == ThreadDatabase.DistributionTypes.BROADCAST) {
|
|
|
|
menu.findItem(R.id.menu_distribution_broadcast).setChecked(true);
|
|
|
|
menu.findItem(R.id.menu_distribution_broadcast).setChecked(true);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
menu.findItem(R.id.menu_distribution_conversation).setChecked(true);
|
|
|
|
menu.findItem(R.id.menu_distribution_conversation).setChecked(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inflater.inflate(R.menu.conversation, menu);
|
|
|
|
inflater.inflate(R.menu.conversation, menu);
|
|
|
|
super.onPrepareOptionsMenu(menu);
|
|
|
|
super.onPrepareOptionsMenu(menu);
|
|
|
@ -412,7 +414,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|
|
|
Uri.parse("tel:" + recipient.getNumber()));
|
|
|
|
Uri.parse("tel:" + recipient.getNumber()));
|
|
|
|
startActivity(dialIntent);
|
|
|
|
startActivity(dialIntent);
|
|
|
|
} catch (ActivityNotFoundException anfe) {
|
|
|
|
} catch (ActivityNotFoundException anfe) {
|
|
|
|
Log.w("ConversationActivity", anfe);
|
|
|
|
Log.w(TAG, anfe);
|
|
|
|
Util.showAlertDialog(this,
|
|
|
|
Util.showAlertDialog(this,
|
|
|
|
getString(R.string.ConversationActivity_calls_not_supported),
|
|
|
|
getString(R.string.ConversationActivity_calls_not_supported),
|
|
|
|
getString(R.string.ConversationActivity_this_device_does_not_appear_to_support_dial_actions));
|
|
|
|
getString(R.string.ConversationActivity_this_device_does_not_appear_to_support_dial_actions));
|
|
|
@ -483,8 +485,16 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|
|
|
subtitle = getRecipients().getPrimaryRecipient().getNumber();
|
|
|
|
subtitle = getRecipients().getPrimaryRecipient().getNumber();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (isGroupConversation()) {
|
|
|
|
} else if (isGroupConversation()) {
|
|
|
|
|
|
|
|
if (isPushGroupConversation()) {
|
|
|
|
|
|
|
|
Log.i(TAG, "name: " + getRecipients().getPrimaryRecipient().getName() + ", number: " + getRecipients().getPrimaryRecipient().getNumber() + ", avatar?: " + (getRecipients().getPrimaryRecipient().getContactPhoto() != null));
|
|
|
|
|
|
|
|
title = getRecipients().getPrimaryRecipient().getName();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
title = getString(R.string.ConversationActivity_group_conversation);
|
|
|
|
title = getString(R.string.ConversationActivity_group_conversation);
|
|
|
|
subtitle = String.format(getString(R.string.ConversationActivity_d_recipients_in_group),
|
|
|
|
}
|
|
|
|
|
|
|
|
int size = getRecipients().getRecipientsList().size();
|
|
|
|
|
|
|
|
subtitle = (size == 1) ? getString(R.string.ConversationActivity_d_recipients_in_group_singular)
|
|
|
|
|
|
|
|
: String.format(getString(R.string.ConversationActivity_d_recipients_in_group),
|
|
|
|
getRecipients().getRecipientsList().size());
|
|
|
|
getRecipients().getRecipientsList().size());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
title = getString(R.string.ConversationActivity_compose_message);
|
|
|
|
title = getString(R.string.ConversationActivity_compose_message);
|
|
|
@ -680,12 +690,12 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
attachmentManager.setImage(imageUri);
|
|
|
|
attachmentManager.setImage(imageUri);
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
Log.w("ConversationActivity", e);
|
|
|
|
Log.w(TAG, e);
|
|
|
|
attachmentManager.clear();
|
|
|
|
attachmentManager.clear();
|
|
|
|
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
|
|
|
|
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
} catch (BitmapDecodingException e) {
|
|
|
|
} catch (BitmapDecodingException e) {
|
|
|
|
Log.w("ConversationActivity", e);
|
|
|
|
Log.w(TAG, e);
|
|
|
|
attachmentManager.clear();
|
|
|
|
attachmentManager.clear();
|
|
|
|
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
|
|
|
|
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
@ -823,12 +833,16 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|
|
|
(!getRecipients().isSingleRecipient() || getRecipients().isGroupRecipient());
|
|
|
|
(!getRecipients().isSingleRecipient() || getRecipients().isGroupRecipient());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isPushGroupConversation() {
|
|
|
|
|
|
|
|
return getRecipients().isGroupRecipient();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Recipients getRecipients() {
|
|
|
|
private Recipients getRecipients() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (isExistingConversation()) return this.recipients;
|
|
|
|
if (isExistingConversation()) return this.recipients;
|
|
|
|
else return recipientsPanel.getRecipients();
|
|
|
|
else return recipientsPanel.getRecipients();
|
|
|
|
} catch (RecipientFormattingException rfe) {
|
|
|
|
} catch (RecipientFormattingException rfe) {
|
|
|
|
Log.d("ConversationActivity", "Empty list of recipients retrieved from RecipientsPanel.");
|
|
|
|
Log.d(TAG, "Empty list of recipients retrieved from RecipientsPanel.");
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -907,7 +921,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|
|
|
message = new OutgoingTextMessage(recipients, body);
|
|
|
|
message = new OutgoingTextMessage(recipients, body);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Log.w("ConversationActivity", "Sending message...");
|
|
|
|
Log.w(TAG, "Sending message...");
|
|
|
|
allocatedThreadId = MessageSender.send(ConversationActivity.this, masterSecret,
|
|
|
|
allocatedThreadId = MessageSender.send(ConversationActivity.this, masterSecret,
|
|
|
|
message, threadId);
|
|
|
|
message, threadId);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -916,13 +930,13 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
|
|
|
Toast.makeText(ConversationActivity.this,
|
|
|
|
Toast.makeText(ConversationActivity.this,
|
|
|
|
R.string.ConversationActivity_recipient_is_not_a_valid_sms_or_email_address_exclamation,
|
|
|
|
R.string.ConversationActivity_recipient_is_not_a_valid_sms_or_email_address_exclamation,
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
Log.w("ConversationActivity", ex);
|
|
|
|
Log.w(TAG, ex);
|
|
|
|
} catch (InvalidMessageException ex) {
|
|
|
|
} catch (InvalidMessageException ex) {
|
|
|
|
Toast.makeText(ConversationActivity.this, R.string.ConversationActivity_message_is_empty_exclamation,
|
|
|
|
Toast.makeText(ConversationActivity.this, R.string.ConversationActivity_message_is_empty_exclamation,
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
Log.w("ConversationActivity", ex);
|
|
|
|
Log.w(TAG, ex);
|
|
|
|
} catch (MmsException e) {
|
|
|
|
} catch (MmsException e) {
|
|
|
|
Log.w("ComposeMessageActivity", e);
|
|
|
|
Log.w(TAG, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|