Search in sources :

Example 16 with Recipient

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

the class WebRtcCallActivity method handleUntrustedIdentity.

private void handleUntrustedIdentity(@NonNull WebRtcViewModel event) {
    final IdentityKey theirIdentity = event.getIdentityKey();
    final Recipient recipient = event.getRecipient();
    callScreen.setUntrustedIdentity(recipient, theirIdentity);
    callScreen.setAcceptIdentityListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            IdentityDatabase identityDatabase = DatabaseFactory.getIdentityDatabase(WebRtcCallActivity.this);
            identityDatabase.saveIdentity(recipient.getRecipientId(), theirIdentity);
            Intent intent = new Intent(WebRtcCallActivity.this, WebRtcCallService.class);
            intent.putExtra(WebRtcCallService.EXTRA_REMOTE_NUMBER, recipient.getNumber());
            intent.setAction(WebRtcCallService.ACTION_OUTGOING_CALL);
            startService(intent);
        }
    });
    callScreen.setCancelIdentityButton(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            handleTerminate(recipient);
        }
    });
}
Also used : WebRtcCallService(org.thoughtcrime.securesms.service.WebRtcCallService) IdentityKey(org.whispersystems.libsignal.IdentityKey) IdentityDatabase(org.thoughtcrime.securesms.database.IdentityDatabase) Recipient(org.thoughtcrime.securesms.recipients.Recipient) Intent(android.content.Intent) View(android.view.View)

Example 17 with Recipient

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

the class PushRecipientsPanel method initRecipientsEditor.

private void initRecipientsEditor() {
    Recipients recipients;
    recipientsText = (RecipientsEditor) findViewById(R.id.recipients_text);
    try {
        recipients = getRecipients();
    } catch (RecipientFormattingException e) {
        recipients = RecipientFactory.getRecipientsFor(getContext(), new LinkedList<Recipient>(), true);
    }
    recipients.addListener(this);
    recipientsText.setAdapter(new RecipientsAdapter(this.getContext()));
    recipientsText.populate(recipients);
    recipientsText.setOnFocusChangeListener(new FocusChangedListener());
    recipientsText.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (panelChangeListener != null) {
                try {
                    panelChangeListener.onRecipientsPanelUpdate(getRecipients());
                } catch (RecipientFormattingException rfe) {
                    panelChangeListener.onRecipientsPanelUpdate(null);
                }
            }
            recipientsText.setText("");
        }
    });
}
Also used : Recipients(org.thoughtcrime.securesms.recipients.Recipients) Recipient(org.thoughtcrime.securesms.recipients.Recipient) View(android.view.View) AdapterView(android.widget.AdapterView) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) RecipientsAdapter(org.thoughtcrime.securesms.contacts.RecipientsAdapter) RecipientFormattingException(org.thoughtcrime.securesms.recipients.RecipientFormattingException)

Example 18 with Recipient

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

the class SingleRecipientPanel method initRecipientsEditor.

private void initRecipientsEditor() {
    Recipients recipients;
    recipientsText = (RecipientsEditor) findViewById(R.id.recipients_text);
    try {
        recipients = getRecipients();
    } catch (RecipientFormattingException e) {
        recipients = RecipientFactory.getRecipientsFor(getContext(), new LinkedList<Recipient>(), true);
    }
    recipients.addListener(this);
    recipientsText.setAdapter(new RecipientsAdapter(this.getContext()));
    recipientsText.populate(recipients);
    recipientsText.setOnFocusChangeListener(new FocusChangedListener());
    recipientsText.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            if (panelChangeListener != null) {
                try {
                    panelChangeListener.onRecipientsPanelUpdate(getRecipients());
                } catch (RecipientFormattingException rfe) {
                    panelChangeListener.onRecipientsPanelUpdate(null);
                }
            }
            recipientsText.setText("");
        }
    });
}
Also used : Recipients(org.thoughtcrime.securesms.recipients.Recipients) Recipient(org.thoughtcrime.securesms.recipients.Recipient) View(android.view.View) AdapterView(android.widget.AdapterView) AdapterView(android.widget.AdapterView) RecipientsAdapter(org.thoughtcrime.securesms.contacts.RecipientsAdapter) RecipientFormattingException(org.thoughtcrime.securesms.recipients.RecipientFormattingException)

Example 19 with Recipient

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

the class SingleRecipientPanel 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 20 with Recipient

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

the class MediaOverviewActivity method initializeResources.

private void initializeResources() {
    threadId = getIntent().getLongExtra(THREAD_ID_EXTRA, -1);
    noImages = (TextView) findViewById(R.id.no_images);
    gridView = (RecyclerView) findViewById(R.id.media_grid);
    gridManager = new GridLayoutManager(this, getResources().getInteger(R.integer.media_overview_cols));
    gridView.setLayoutManager(gridManager);
    gridView.setHasFixedSize(true);
    final long recipientId = getIntent().getLongExtra(RECIPIENT_EXTRA, -1);
    if (recipientId > -1) {
        recipient = RecipientFactory.getRecipientForId(this, recipientId, true);
    } else if (threadId > -1) {
        recipient = DatabaseFactory.getThreadDatabase(this).getRecipientsForThreadId(threadId).getPrimaryRecipient();
    } else {
        recipient = null;
    }
    if (recipient != null) {
        recipient.addListener(new RecipientModifiedListener() {

            @Override
            public void onModified(Recipient recipient) {
                initializeActionBar();
            }
        });
    }
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) RecipientModifiedListener(org.thoughtcrime.securesms.recipients.Recipient.RecipientModifiedListener) Recipient(org.thoughtcrime.securesms.recipients.Recipient)

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