|
|
@ -191,6 +191,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
|
|
|
|
|
|
|
private boolean date;
|
|
|
|
private boolean date;
|
|
|
|
private boolean threading;
|
|
|
|
private boolean threading;
|
|
|
|
|
|
|
|
private boolean bubble;
|
|
|
|
|
|
|
|
private boolean avatars;
|
|
|
|
private boolean name_email;
|
|
|
|
private boolean name_email;
|
|
|
|
private boolean distinguish_contacts;
|
|
|
|
private boolean distinguish_contacts;
|
|
|
|
private boolean subject_top;
|
|
|
|
private boolean subject_top;
|
|
|
@ -248,8 +250,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
View.OnTouchListener,
|
|
|
|
View.OnTouchListener,
|
|
|
|
View.OnLayoutChangeListener,
|
|
|
|
View.OnLayoutChangeListener,
|
|
|
|
BottomNavigationView.OnNavigationItemSelectedListener {
|
|
|
|
BottomNavigationView.OnNavigationItemSelectedListener {
|
|
|
|
|
|
|
|
private ImageView ivAvatarStart;
|
|
|
|
private ViewCardOptional card;
|
|
|
|
private ViewCardOptional card;
|
|
|
|
private View view;
|
|
|
|
private View view;
|
|
|
|
|
|
|
|
private ImageView ivAvatarEnd;
|
|
|
|
|
|
|
|
|
|
|
|
private View vwColor;
|
|
|
|
private View vwColor;
|
|
|
|
private ImageButton ibExpander;
|
|
|
|
private ImageButton ibExpander;
|
|
|
@ -364,8 +368,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
ViewHolder(final View itemView) {
|
|
|
|
ViewHolder(final View itemView) {
|
|
|
|
super(itemView);
|
|
|
|
super(itemView);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ivAvatarStart = itemView.findViewById(R.id.ivAvatarStart);
|
|
|
|
card = itemView.findViewById(R.id.card);
|
|
|
|
card = itemView.findViewById(R.id.card);
|
|
|
|
view = itemView.findViewById(R.id.clItem);
|
|
|
|
view = itemView.findViewById(R.id.clItem);
|
|
|
|
|
|
|
|
ivAvatarEnd = itemView.findViewById(R.id.ivAvatarEnd);
|
|
|
|
|
|
|
|
|
|
|
|
vwColor = itemView.findViewById(R.id.vwColor);
|
|
|
|
vwColor = itemView.findViewById(R.id.vwColor);
|
|
|
|
ibExpander = itemView.findViewById(R.id.ibExpander);
|
|
|
|
ibExpander = itemView.findViewById(R.id.ibExpander);
|
|
|
@ -624,6 +630,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void clear() {
|
|
|
|
private void clear() {
|
|
|
|
|
|
|
|
ivAvatarStart.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
ivAvatarEnd.setVisibility(View.GONE);
|
|
|
|
vwColor.setVisibility(View.GONE);
|
|
|
|
vwColor.setVisibility(View.GONE);
|
|
|
|
ibExpander.setVisibility(View.GONE);
|
|
|
|
ibExpander.setVisibility(View.GONE);
|
|
|
|
ibFlagged.setVisibility(View.GONE);
|
|
|
|
ibFlagged.setVisibility(View.GONE);
|
|
|
@ -659,15 +667,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
boolean inbox = EntityFolder.INBOX.equals(message.folderType);
|
|
|
|
boolean inbox = EntityFolder.INBOX.equals(message.folderType);
|
|
|
|
boolean outbox = EntityFolder.OUTBOX.equals(message.folderType);
|
|
|
|
boolean outbox = EntityFolder.OUTBOX.equals(message.folderType);
|
|
|
|
|
|
|
|
|
|
|
|
boolean outgoing = false;
|
|
|
|
boolean outgoing = isOutgoing(message);
|
|
|
|
if (viewType != ViewType.THREAD)
|
|
|
|
if (viewType == ViewType.THREAD) {
|
|
|
|
if (EntityFolder.isOutgoing(message.folderType))
|
|
|
|
ivAvatarStart.setVisibility(outgoing && bubble ? View.INVISIBLE : View.GONE);
|
|
|
|
outgoing = true;
|
|
|
|
ivAvatarEnd.setVisibility(outgoing || !bubble ? View.GONE : View.INVISIBLE);
|
|
|
|
else if (!EntityFolder.ARCHIVE.equals(message.folderType) &&
|
|
|
|
ivAvatar.setVisibility(bubble || !avatars ? View.GONE : View.INVISIBLE);
|
|
|
|
message.identityEmail != null &&
|
|
|
|
outgoing = false;
|
|
|
|
message.from != null && message.from.length == 1 &&
|
|
|
|
} else {
|
|
|
|
message.identityEmail.equals(((InternetAddress) message.from[0]).getAddress()))
|
|
|
|
ivAvatarStart.setVisibility(View.GONE);
|
|
|
|
outgoing = true;
|
|
|
|
ivAvatarEnd.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
ivAvatar.setVisibility(avatars ? View.INVISIBLE : View.GONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Text size
|
|
|
|
// Text size
|
|
|
|
if (textSize != 0) {
|
|
|
|
if (textSize != 0) {
|
|
|
@ -861,13 +871,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
aargs.putSerializable("addresses", addresses);
|
|
|
|
aargs.putSerializable("addresses", addresses);
|
|
|
|
|
|
|
|
|
|
|
|
new SimpleTask<ContactInfo>() {
|
|
|
|
new SimpleTask<ContactInfo>() {
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
|
|
|
|
//Address[] addresses = (Address[]) args.getSerializable("addresses");
|
|
|
|
|
|
|
|
ivAvatar.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
//tvFrom.setText(MessageHelper.formatAddresses(addresses, name_email, false));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected ContactInfo onExecute(Context context, Bundle args) {
|
|
|
|
protected ContactInfo onExecute(Context context, Bundle args) {
|
|
|
|
long account = args.getLong("account");
|
|
|
|
long account = args.getLong("account");
|
|
|
@ -997,15 +1000,30 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void bindContactInfo(ContactInfo info, TupleMessageEx message) {
|
|
|
|
private void bindContactInfo(ContactInfo info, TupleMessageEx message) {
|
|
|
|
|
|
|
|
if (bubble && viewType == ViewType.THREAD) {
|
|
|
|
|
|
|
|
boolean outgoing = isOutgoing(message);
|
|
|
|
|
|
|
|
if (outgoing) {
|
|
|
|
|
|
|
|
if (info.hasPhoto())
|
|
|
|
|
|
|
|
ivAvatarStart.setImageBitmap(info.getPhotoBitmap());
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
ivAvatarStart.setImageResource(R.drawable.baseline_person_24);
|
|
|
|
|
|
|
|
ivAvatarStart.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (info.hasPhoto())
|
|
|
|
|
|
|
|
ivAvatarEnd.setImageBitmap(info.getPhotoBitmap());
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
ivAvatarEnd.setImageResource(R.drawable.baseline_person_24);
|
|
|
|
|
|
|
|
ivAvatarEnd.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if (info.hasPhoto()) {
|
|
|
|
if (info.hasPhoto()) {
|
|
|
|
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
|
|
|
ivAvatar.setImageBitmap(info.getPhotoBitmap());
|
|
|
|
ivAvatar.setVisibility(View.VISIBLE);
|
|
|
|
ivAvatar.setVisibility(View.VISIBLE);
|
|
|
|
} else
|
|
|
|
}
|
|
|
|
ivAvatar.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (distinguish_contacts && info.isKnown())
|
|
|
|
if (distinguish_contacts && info.isKnown())
|
|
|
|
tvFrom.setPaintFlags(tvFrom.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
|
|
|
tvFrom.setPaintFlags(tvFrom.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
|
|
|
//tvFrom.setText(info.getDisplayName(name_email));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void bindExpanded(final TupleMessageEx message, final boolean scroll) {
|
|
|
|
private void bindExpanded(final TupleMessageEx message, final boolean scroll) {
|
|
|
@ -1918,6 +1936,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
}.execute(context, owner, args, "message:participation");
|
|
|
|
}.execute(context, owner, args, "message:participation");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isOutgoing(TupleMessageEx message) {
|
|
|
|
|
|
|
|
if (EntityFolder.isOutgoing(message.folderType))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else if ((viewType == ViewType.THREAD || !EntityFolder.ARCHIVE.equals(message.folderType)) &&
|
|
|
|
|
|
|
|
message.identityEmail != null &&
|
|
|
|
|
|
|
|
message.from != null && message.from.length == 1 &&
|
|
|
|
|
|
|
|
message.identityEmail.equals(((InternetAddress) message.from[0]).getAddress()))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private TupleMessageEx getMessage() {
|
|
|
|
private TupleMessageEx getMessage() {
|
|
|
|
int pos = getAdapterPosition();
|
|
|
|
int pos = getAdapterPosition();
|
|
|
|
if (pos == RecyclerView.NO_POSITION)
|
|
|
|
if (pos == RecyclerView.NO_POSITION)
|
|
|
@ -3529,8 +3558,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
this.contacts = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
|
|
|
|
this.contacts = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
|
|
|
|
this.textSize = Helper.getTextSize(context, zoom);
|
|
|
|
this.textSize = Helper.getTextSize(context, zoom);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean contacts = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
|
|
|
|
|
|
|
|
boolean avatars = prefs.getBoolean("avatars", true);
|
|
|
|
|
|
|
|
boolean generated = prefs.getBoolean("generated_icons", true);
|
|
|
|
|
|
|
|
|
|
|
|
this.date = prefs.getBoolean("date", true);
|
|
|
|
this.date = prefs.getBoolean("date", true);
|
|
|
|
this.threading = prefs.getBoolean("threading", true);
|
|
|
|
this.threading = prefs.getBoolean("threading", true);
|
|
|
|
|
|
|
|
this.bubble = prefs.getBoolean("bubble", false);
|
|
|
|
|
|
|
|
this.avatars = (contacts && avatars) || generated;
|
|
|
|
this.name_email = prefs.getBoolean("name_email", false);
|
|
|
|
this.name_email = prefs.getBoolean("name_email", false);
|
|
|
|
this.distinguish_contacts = prefs.getBoolean("distinguish_contacts", false);
|
|
|
|
this.distinguish_contacts = prefs.getBoolean("distinguish_contacts", false);
|
|
|
|
this.subject_top = prefs.getBoolean("subject_top", false);
|
|
|
|
this.subject_top = prefs.getBoolean("subject_top", false);
|
|
|
|