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);
}
});
}
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("");
}
});
}
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("");
}
});
}
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());
}
}
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();
}
});
}
}
Aggregations