Search in sources :

Example 1 with RecipientModifiedListener

use of org.thoughtcrime.securesms.recipients.Recipient.RecipientModifiedListener 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

GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 Recipient (org.thoughtcrime.securesms.recipients.Recipient)1 RecipientModifiedListener (org.thoughtcrime.securesms.recipients.Recipient.RecipientModifiedListener)1