Search in sources :

Example 1 with Recipient

use of org.thoughtcrime.securesms.recipients.Recipient in project Signal-Android by WhisperSystems.

the class MessageDetailsRecipientAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(context).inflate(R.layout.message_recipient_list_item, parent, false);
    }
    Recipient recipient = recipients.getRecipientsList().get(position);
    ((MessageRecipientListItem) convertView).set(masterSecret, record, recipient, isPushGroup);
    return convertView;
}
Also used : Recipient(org.thoughtcrime.securesms.recipients.Recipient)

Example 2 with Recipient

use of org.thoughtcrime.securesms.recipients.Recipient in project Signal-Android by WhisperSystems.

the class GroupCreateActivity method onActivityResult.

@Override
public void onActivityResult(int reqCode, int resultCode, final Intent data) {
    super.onActivityResult(reqCode, resultCode, data);
    Uri outputFile = Uri.fromFile(new File(getCacheDir(), "cropped"));
    if (data == null || resultCode != Activity.RESULT_OK)
        return;
    switch(reqCode) {
        case PICK_CONTACT:
            List<String> selected = data.getStringArrayListExtra("contacts");
            for (String contact : selected) {
                final Recipient recipient = RecipientFactory.getRecipientsFromString(this, contact, false).getPrimaryRecipient();
                if (recipient != null)
                    addSelectedContacts(recipient);
            }
            break;
        case Crop.REQUEST_PICK:
            new Crop(data.getData()).output(outputFile).asSquare().start(this);
            break;
        case Crop.REQUEST_CROP:
            Glide.with(this).load(Crop.getOutput(data)).asBitmap().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).centerCrop().override(AVATAR_SIZE, AVATAR_SIZE).into(new SimpleTarget<Bitmap>() {

                @Override
                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                    setAvatar(Crop.getOutput(data), resource);
                }
            });
    }
}
Also used : Crop(com.soundcloud.android.crop.Crop) Bitmap(android.graphics.Bitmap) Recipient(org.thoughtcrime.securesms.recipients.Recipient) Uri(android.net.Uri) File(java.io.File)

Example 3 with Recipient

use of org.thoughtcrime.securesms.recipients.Recipient in project Signal-Android by WhisperSystems.

the class VerifyIdentityActivity method onCreate.

@Override
protected void onCreate(Bundle state, @NonNull MasterSecret masterSecret) {
    try {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setTitle(R.string.AndroidManifest__verify_safety_number);
        Recipient recipient = RecipientFactory.getRecipientForId(this, getIntent().getLongExtra(RECIPIENT_ID, -1), true);
        recipient.addListener(this);
        setActionBarNotificationBarColor(recipient.getColor());
        Bundle extras = new Bundle();
        extras.putParcelable(VerifyDisplayFragment.REMOTE_IDENTITY, getIntent().getParcelableExtra(RECIPIENT_IDENTITY));
        extras.putString(VerifyDisplayFragment.REMOTE_NUMBER, Util.canonicalizeNumber(this, recipient.getNumber()));
        extras.putParcelable(VerifyDisplayFragment.LOCAL_IDENTITY, new IdentityKeyParcelable(IdentityKeyUtil.getIdentityKey(this)));
        extras.putString(VerifyDisplayFragment.LOCAL_NUMBER, TextSecurePreferences.getLocalNumber(this));
        scanFragment.setScanListener(this);
        displayFragment.setClickListener(this);
        initFragment(android.R.id.content, displayFragment, masterSecret, dynamicLanguage.getCurrentLocale(), extras);
    } catch (InvalidNumberException e) {
        Log.w(TAG, e);
        finish();
    }
}
Also used : IdentityKeyParcelable(org.thoughtcrime.securesms.crypto.IdentityKeyParcelable) Bundle(android.os.Bundle) InvalidNumberException(org.whispersystems.signalservice.api.util.InvalidNumberException) Recipient(org.thoughtcrime.securesms.recipients.Recipient)

Example 4 with Recipient

use of org.thoughtcrime.securesms.recipients.Recipient in project Signal-Android by WhisperSystems.

the class PushRecipientsPanel method addRecipients.

public void addRecipients(Recipients recipients) {
    List<Recipient> recipientList = recipients.getRecipientsList();
    Iterator<Recipient> iterator = recipientList.iterator();
    while (iterator.hasNext()) {
        Recipient recipient = iterator.next();
        addRecipient(recipient.getName(), recipient.getNumber());
    }
}
Also used : Recipient(org.thoughtcrime.securesms.recipients.Recipient)

Example 5 with Recipient

use of org.thoughtcrime.securesms.recipients.Recipient in project Signal-Android by WhisperSystems.

the class RecipientsEditor method populate.

public void populate(Recipients list) {
    SpannableStringBuilder sb = new SpannableStringBuilder();
    for (Recipient c : list.getRecipientsList()) {
        if (sb.length() != 0) {
            sb.append(", ");
        }
        sb.append(contactToToken(c));
    }
    setText(sb);
}
Also used : Recipient(org.thoughtcrime.securesms.recipients.Recipient) SpannableStringBuilder(android.text.SpannableStringBuilder)

Aggregations

Recipient (org.thoughtcrime.securesms.recipients.Recipient)26 View (android.view.View)5 Recipients (org.thoughtcrime.securesms.recipients.Recipients)5 InvalidNumberException (org.whispersystems.signalservice.api.util.InvalidNumberException)5 RecipientFormattingException (org.thoughtcrime.securesms.recipients.RecipientFormattingException)3 Intent (android.content.Intent)2 AdapterView (android.widget.AdapterView)2 TextView (android.widget.TextView)2 File (java.io.File)2 RecipientsAdapter (org.thoughtcrime.securesms.contacts.RecipientsAdapter)2 IdentityKey (org.whispersystems.libsignal.IdentityKey)2 SignalProtocolAddress (org.whispersystems.libsignal.SignalProtocolAddress)2 Bitmap (android.graphics.Bitmap)1 Uri (android.net.Uri)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 Nullable (android.support.annotation.Nullable)1 UiThread (android.support.annotation.UiThread)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1