mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Show TS group titles properly, hide MMS options
This commit is contained in:
parent
54b087c458
commit
877ed8f59c
@ -6,17 +6,4 @@
|
||||
android:icon="?menu_group_icon"
|
||||
android:showAsAction="ifRoom" />
|
||||
|
||||
<item android:title="@string/conversation_group_options__delivery"
|
||||
android:id="@+id/menu_group_delivery"
|
||||
android:icon="?menu_split_icon"
|
||||
android:showAsAction="ifRoom" >
|
||||
|
||||
<menu>
|
||||
<group android:id="@+id/distribution_group"
|
||||
android:checkableBehavior="single">
|
||||
<item android:id="@+id/menu_distribution_conversation" android:title="@string/conversation_group_options__conversation" android:checked="true" />
|
||||
<item android:id="@+id/menu_distribution_broadcast" android:title="@string/conversation_group_options__broadcast" />
|
||||
</group>
|
||||
</menu>
|
||||
</item>
|
||||
</menu>
|
||||
|
17
res/menu/conversation_mms_group_options.xml
Normal file
17
res/menu/conversation_mms_group_options.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:title="@string/conversation_group_options__delivery"
|
||||
android:id="@+id/menu_group_delivery"
|
||||
android:icon="?menu_split_icon"
|
||||
android:showAsAction="ifRoom" >
|
||||
|
||||
<menu>
|
||||
<group android:id="@+id/distribution_group"
|
||||
android:checkableBehavior="single">
|
||||
<item android:id="@+id/menu_distribution_conversation" android:title="@string/conversation_group_options__conversation" android:checked="true" />
|
||||
<item android:id="@+id/menu_distribution_broadcast" android:title="@string/conversation_group_options__broadcast" />
|
||||
</group>
|
||||
</menu>
|
||||
</item>
|
||||
</menu>
|
@ -67,7 +67,8 @@
|
||||
<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>
|
||||
<string name="ConversationActivity_d_recipients_in_group">%d members</string>
|
||||
<string name="ConversationActivity_d_recipients_in_group_singular">1 member</string>
|
||||
<string name="ConversationActivity_saving_draft">Saving draft...</string>
|
||||
<string name="ConversationActivity_invalid_recipient">Invalid recipient!</string>
|
||||
<string name="ConversationActivity_calls_not_supported">Calls Not Supported</string>
|
||||
|
@ -108,6 +108,7 @@ import ws.com.google.android.mms.MmsException;
|
||||
public class ConversationActivity extends PassphraseRequiredSherlockFragmentActivity
|
||||
implements ConversationFragment.ConversationFragmentListener
|
||||
{
|
||||
private static final String TAG = "ConversationActivity";
|
||||
|
||||
public static final String RECIPIENTS_EXTRA = "recipients";
|
||||
public static final String THREAD_ID_EXTRA = "thread_id";
|
||||
@ -232,8 +233,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
MenuInflater inflater = this.getSupportMenuInflater();
|
||||
menu.clear();
|
||||
|
||||
if (isSingleConversation() && isEncryptedConversation)
|
||||
{
|
||||
if (isSingleConversation() && isEncryptedConversation) {
|
||||
if (isAuthenticatedConversation) {
|
||||
inflater.inflate(R.menu.conversation_secure_identity, menu);
|
||||
} else {
|
||||
@ -248,13 +248,15 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
} else if (isGroupConversation()) {
|
||||
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);
|
||||
} else {
|
||||
menu.findItem(R.id.menu_distribution_conversation).setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inflater.inflate(R.menu.conversation, menu);
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
@ -282,7 +284,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
if (isEncryptedConversation) {
|
||||
android.view.MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.conversation_button_context, menu);
|
||||
@ -412,7 +414,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
Uri.parse("tel:" + recipient.getNumber()));
|
||||
startActivity(dialIntent);
|
||||
} catch (ActivityNotFoundException anfe) {
|
||||
Log.w("ConversationActivity", anfe);
|
||||
Log.w(TAG, anfe);
|
||||
Util.showAlertDialog(this,
|
||||
getString(R.string.ConversationActivity_calls_not_supported),
|
||||
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();
|
||||
}
|
||||
} 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);
|
||||
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());
|
||||
} else {
|
||||
title = getString(R.string.ConversationActivity_compose_message);
|
||||
@ -680,12 +690,12 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
try {
|
||||
attachmentManager.setImage(imageUri);
|
||||
} catch (IOException e) {
|
||||
Log.w("ConversationActivity", e);
|
||||
Log.w(TAG, e);
|
||||
attachmentManager.clear();
|
||||
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} catch (BitmapDecodingException e) {
|
||||
Log.w("ConversationActivity", e);
|
||||
Log.w(TAG, e);
|
||||
attachmentManager.clear();
|
||||
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
|
||||
Toast.LENGTH_LONG).show();
|
||||
@ -823,12 +833,16 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
(!getRecipients().isSingleRecipient() || getRecipients().isGroupRecipient());
|
||||
}
|
||||
|
||||
private boolean isPushGroupConversation() {
|
||||
return getRecipients().isGroupRecipient();
|
||||
}
|
||||
|
||||
private Recipients getRecipients() {
|
||||
try {
|
||||
if (isExistingConversation()) return this.recipients;
|
||||
else return recipientsPanel.getRecipients();
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@ -907,7 +921,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
message = new OutgoingTextMessage(recipients, body);
|
||||
}
|
||||
|
||||
Log.w("ConversationActivity", "Sending message...");
|
||||
Log.w(TAG, "Sending message...");
|
||||
allocatedThreadId = MessageSender.send(ConversationActivity.this, masterSecret,
|
||||
message, threadId);
|
||||
}
|
||||
@ -916,13 +930,13 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
|
||||
Toast.makeText(ConversationActivity.this,
|
||||
R.string.ConversationActivity_recipient_is_not_a_valid_sms_or_email_address_exclamation,
|
||||
Toast.LENGTH_LONG).show();
|
||||
Log.w("ConversationActivity", ex);
|
||||
Log.w(TAG, ex);
|
||||
} catch (InvalidMessageException ex) {
|
||||
Toast.makeText(ConversationActivity.this, R.string.ConversationActivity_message_is_empty_exclamation,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
Log.w("ConversationActivity", ex);
|
||||
Log.w(TAG, ex);
|
||||
} catch (MmsException e) {
|
||||
Log.w("ComposeMessageActivity", e);
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user