mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-24 16:00:02 +00:00
Support for per-recipient muting, blocking, and ringtones.
Fixes #757 Fixes #354 Fixes #222 Closes #1815 Closes #3378 // FREEBIE
This commit is contained in:
@@ -3,19 +3,24 @@ package org.thoughtcrime.securesms.components;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiTextView;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
|
||||
public class FromTextView extends EmojiTextView {
|
||||
|
||||
private static final String TAG = FromTextView.class.getSimpleName();
|
||||
|
||||
public FromTextView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -25,7 +30,7 @@ public class FromTextView extends EmojiTextView {
|
||||
}
|
||||
|
||||
public void setText(Recipient recipient) {
|
||||
setText(new Recipients(recipient));
|
||||
setText(RecipientFactory.getRecipientsFor(getContext(), recipient, true));
|
||||
}
|
||||
|
||||
public void setText(Recipients recipients) {
|
||||
@@ -63,6 +68,10 @@ public class FromTextView extends EmojiTextView {
|
||||
colors.recycle();
|
||||
|
||||
setText(builder);
|
||||
|
||||
if (recipients.isBlocked()) setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_block_grey600_18dp, 0, 0, 0);
|
||||
else if (recipients.isMuted()) setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_volume_off_grey600_18dp, 0, 0, 0);
|
||||
else setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public class PushRecipientsPanel extends RelativeLayout {
|
||||
try {
|
||||
recipients = getRecipients();
|
||||
} catch (RecipientFormattingException e) {
|
||||
recipients = new Recipients( new LinkedList<Recipient>() );
|
||||
recipients = RecipientFactory.getRecipientsFor(getContext(), new LinkedList<Recipient>(), true);
|
||||
}
|
||||
|
||||
recipientsText.setAdapter(new RecipientsAdapter(this.getContext()));
|
||||
|
||||
@@ -130,7 +130,7 @@ public class SingleRecipientPanel extends RelativeLayout {
|
||||
try {
|
||||
recipients = getRecipients();
|
||||
} catch (RecipientFormattingException e) {
|
||||
recipients = new Recipients( new LinkedList<Recipient>() );
|
||||
recipients = RecipientFactory.getRecipientsFor(getContext(), new LinkedList<Recipient>(), true);
|
||||
}
|
||||
|
||||
recipientsText.setAdapter(new RecipientsAdapter(this.getContext()));
|
||||
|
||||
Reference in New Issue
Block a user