session-android/src/org/thoughtcrime/securesms/MessageDetailsRecipientAdapter.java
Jake McGinty ac0a1c0bc1 Conflicts UI touch-ups:
1) Fix i18n and layout naming.
2) Error header for message details.
3) Add back button to message details.

// FREEBIE

Closes #2593
2015-02-27 12:26:35 -08:00

66 lines
2.0 KiB
Java

package org.thoughtcrime.securesms;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.model.MessageRecord;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.Recipients;
public class MessageDetailsRecipientAdapter extends BaseAdapter implements AbsListView.RecyclerListener {
private final Context context;
private final MasterSecret masterSecret;
private final MessageRecord record;
private final Recipients recipients;
private final boolean isPushGroup;
public MessageDetailsRecipientAdapter(Context context, MasterSecret masterSecret,
MessageRecord record, Recipients recipients,
boolean isPushGroup)
{
this.context = context;
this.masterSecret = masterSecret;
this.record = record;
this.recipients = recipients;
this.isPushGroup = isPushGroup;
}
@Override
public int getCount() {
return recipients.getRecipientsList().size();
}
@Override
public Object getItem(int position) {
return recipients.getRecipientsList().get(position);
}
@Override
public long getItemId(int position) {
return recipients.getRecipientsList().get(position).getRecipientId();
}
@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;
}
@Override
public void onMovedToScrapHeap(View view) {
((MessageRecipientListItem)view).unbind();
}
}