|
|
@ -21,7 +21,6 @@ import android.content.Intent;
|
|
|
|
import android.content.res.TypedArray;
|
|
|
|
import android.content.res.TypedArray;
|
|
|
|
import android.graphics.Typeface;
|
|
|
|
import android.graphics.Typeface;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Build;
|
|
|
|
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.provider.Contacts.Intents;
|
|
|
|
import android.provider.Contacts.Intents;
|
|
|
|
import android.provider.ContactsContract.QuickContact;
|
|
|
|
import android.provider.ContactsContract.QuickContact;
|
|
|
@ -35,7 +34,6 @@ import android.widget.ImageView;
|
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
|
|
|
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
|
|
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
|
|
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
|
|
|
import org.thoughtcrime.securesms.recipients.Recipients;
|
|
|
|
import org.thoughtcrime.securesms.recipients.Recipients;
|
|
|
@ -43,7 +41,8 @@ import org.thoughtcrime.securesms.util.DateUtils;
|
|
|
|
import org.thoughtcrime.securesms.util.Emoji;
|
|
|
|
import org.thoughtcrime.securesms.util.Emoji;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.concurrent.ThreadFactory;
|
|
|
|
|
|
|
|
|
|
|
|
import static org.thoughtcrime.securesms.util.SpanUtil.color;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* A view that displays the element in a list of multiple conversation threads.
|
|
|
|
* A view that displays the element in a list of multiple conversation threads.
|
|
|
@ -57,6 +56,9 @@ public class ConversationListItem extends RelativeLayout
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private final static String TAG = ConversationListItem.class.getSimpleName();
|
|
|
|
private final static String TAG = ConversationListItem.class.getSimpleName();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final static Typeface BOLD_TYPEFACE = Typeface.create("sans-serif", Typeface.BOLD);
|
|
|
|
|
|
|
|
private final static Typeface LIGHT_TYPEFACE = Typeface.create("sans-serif-light", Typeface.NORMAL);
|
|
|
|
|
|
|
|
|
|
|
|
private Context context;
|
|
|
|
private Context context;
|
|
|
|
private Set<Long> selectedThreads;
|
|
|
|
private Set<Long> selectedThreads;
|
|
|
|
private Recipients recipients;
|
|
|
|
private Recipients recipients;
|
|
|
@ -66,7 +68,6 @@ public class ConversationListItem extends RelativeLayout
|
|
|
|
private TextView dateView;
|
|
|
|
private TextView dateView;
|
|
|
|
private long count;
|
|
|
|
private long count;
|
|
|
|
private boolean read;
|
|
|
|
private boolean read;
|
|
|
|
|
|
|
|
|
|
|
|
private ImageView contactPhotoImage;
|
|
|
|
private ImageView contactPhotoImage;
|
|
|
|
|
|
|
|
|
|
|
|
private final Handler handler = new Handler();
|
|
|
|
private final Handler handler = new Handler();
|
|
|
@ -108,12 +109,16 @@ public class ConversationListItem extends RelativeLayout
|
|
|
|
Emoji.EMOJI_SMALL,
|
|
|
|
Emoji.EMOJI_SMALL,
|
|
|
|
new Emoji.InvalidatingPageLoadedListener(subjectView)),
|
|
|
|
new Emoji.InvalidatingPageLoadedListener(subjectView)),
|
|
|
|
TextView.BufferType.SPANNABLE);
|
|
|
|
TextView.BufferType.SPANNABLE);
|
|
|
|
|
|
|
|
this.subjectView.setTypeface(read ? LIGHT_TYPEFACE : BOLD_TYPEFACE);
|
|
|
|
|
|
|
|
|
|
|
|
if (thread.getDate() > 0)
|
|
|
|
if (thread.getDate() > 0) {
|
|
|
|
this.dateView.setText(DateUtils.getRelativeTimeSpanString(thread.getDate(),
|
|
|
|
CharSequence date = DateUtils.getRelativeTimeSpanString(thread.getDate(),
|
|
|
|
System.currentTimeMillis(),
|
|
|
|
System.currentTimeMillis(),
|
|
|
|
DateUtils.MINUTE_IN_MILLIS,
|
|
|
|
DateUtils.MINUTE_IN_MILLIS,
|
|
|
|
DateUtils.FORMAT_ABBREV_RELATIVE));
|
|
|
|
DateUtils.FORMAT_ABBREV_RELATIVE);
|
|
|
|
|
|
|
|
dateView.setText(read ? date : color(getResources().getColor(R.color.textsecure_primary), date));
|
|
|
|
|
|
|
|
dateView.setTypeface(read ? LIGHT_TYPEFACE : BOLD_TYPEFACE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setBackground(read, batchMode);
|
|
|
|
setBackground(read, batchMode);
|
|
|
|
setContactPhoto(this.recipients.getPrimaryRecipient());
|
|
|
|
setContactPhoto(this.recipients.getPrimaryRecipient());
|
|
|
|