|
|
@ -152,7 +152,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
|
|
|
|
|
|
|
public class ViewHolder extends RecyclerView.ViewHolder implements
|
|
|
|
public class ViewHolder extends RecyclerView.ViewHolder implements
|
|
|
|
View.OnClickListener, BottomNavigationView.OnNavigationItemSelectedListener {
|
|
|
|
View.OnClickListener, BottomNavigationView.OnNavigationItemSelectedListener {
|
|
|
|
private int position;
|
|
|
|
|
|
|
|
private View itemView;
|
|
|
|
private View itemView;
|
|
|
|
private TextView tvDay;
|
|
|
|
private TextView tvDay;
|
|
|
|
private View vwColor;
|
|
|
|
private View vwColor;
|
|
|
@ -422,9 +421,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("WrongConstant")
|
|
|
|
@SuppressLint("WrongConstant")
|
|
|
|
private void bindTo(int pos, final TupleMessageEx message) {
|
|
|
|
private void bindTo(int position, final TupleMessageEx message) {
|
|
|
|
position = pos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final DB db = DB.getInstance(context);
|
|
|
|
final DB db = DB.getInstance(context);
|
|
|
|
final boolean show_expanded = properties.getValue("expanded", message.id);
|
|
|
|
final boolean show_expanded = properties.getValue("expanded", message.id);
|
|
|
|
boolean show_addresses = !properties.getValue("addresses", message.id);
|
|
|
|
boolean show_addresses = !properties.getValue("addresses", message.id);
|
|
|
@ -499,7 +496,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
new SimpleTask<ContactInfo>() {
|
|
|
|
new SimpleTask<ContactInfo>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
args.putInt("position", position);
|
|
|
|
|
|
|
|
ivAvatar.setVisibility(avatars ? View.INVISIBLE : View.GONE);
|
|
|
|
ivAvatar.setVisibility(avatars ? View.INVISIBLE : View.GONE);
|
|
|
|
tvFrom.setText(MessageHelper.formatAddresses(addresses, !compact, false));
|
|
|
|
tvFrom.setText(MessageHelper.formatAddresses(addresses, !compact, false));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -512,7 +508,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onExecuted(Bundle args, ContactInfo info) {
|
|
|
|
protected void onExecuted(Bundle args, ContactInfo info) {
|
|
|
|
if (args.getInt("position") == position)
|
|
|
|
long id = args.getLong("id");
|
|
|
|
|
|
|
|
TupleMessageEx amessage = getMessage();
|
|
|
|
|
|
|
|
if (amessage == null || !amessage.equals(id))
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
showContactInfo(info, message);
|
|
|
|
showContactInfo(info, message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -772,20 +772,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
|
|
|
|
|
|
|
// Setup action
|
|
|
|
// Setup action
|
|
|
|
Bundle sargs = new Bundle();
|
|
|
|
Bundle sargs = new Bundle();
|
|
|
|
|
|
|
|
sargs.putLong("id", message.id);
|
|
|
|
sargs.putLong("account", message.account);
|
|
|
|
sargs.putLong("account", message.account);
|
|
|
|
|
|
|
|
|
|
|
|
new SimpleTask<List<EntityFolder>>() {
|
|
|
|
new SimpleTask<List<EntityFolder>>() {
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
|
|
|
|
args.putInt("position", position);
|
|
|
|
|
|
|
|
bnvActions.setHasTransientState(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onPostExecute(Bundle args) {
|
|
|
|
|
|
|
|
bnvActions.setHasTransientState(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected List<EntityFolder> onExecute(Context context, Bundle args) {
|
|
|
|
protected List<EntityFolder> onExecute(Context context, Bundle args) {
|
|
|
|
long account = args.getLong("account");
|
|
|
|
long account = args.getLong("account");
|
|
|
@ -794,7 +784,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onExecuted(Bundle args, List<EntityFolder> folders) {
|
|
|
|
protected void onExecuted(Bundle args, List<EntityFolder> folders) {
|
|
|
|
if (args.getInt("position") != position)
|
|
|
|
long id = args.getLong("id");
|
|
|
|
|
|
|
|
TupleMessageEx amessage = getMessage();
|
|
|
|
|
|
|
|
if (amessage == null || !amessage.id.equals(id))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
boolean hasJunk = false;
|
|
|
|
boolean hasJunk = false;
|
|
|
@ -878,13 +870,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
private TupleMessageEx getMessage() {
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
int pos = getAdapterPosition();
|
|
|
|
int pos = getAdapterPosition();
|
|
|
|
if (pos == RecyclerView.NO_POSITION)
|
|
|
|
if (pos == RecyclerView.NO_POSITION)
|
|
|
|
return;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
TupleMessageEx message = differ.getItem(pos);
|
|
|
|
return differ.getItem(pos);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
TupleMessageEx message = getMessage();
|
|
|
|
if (message == null)
|
|
|
|
if (message == null)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
@ -898,7 +894,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
onAddContact(message);
|
|
|
|
onAddContact(message);
|
|
|
|
else if (viewType == ViewType.THREAD) {
|
|
|
|
else if (viewType == ViewType.THREAD) {
|
|
|
|
if (view.getId() == R.id.ivExpanderAddress)
|
|
|
|
if (view.getId() == R.id.ivExpanderAddress)
|
|
|
|
onToggleAddresses(pos, message);
|
|
|
|
onToggleAddresses(message);
|
|
|
|
else if (view.getId() == R.id.btnDownloadAttachments)
|
|
|
|
else if (view.getId() == R.id.btnDownloadAttachments)
|
|
|
|
onDownloadAttachments(message);
|
|
|
|
onDownloadAttachments(message);
|
|
|
|
else if (view.getId() == R.id.btnSaveAttachments)
|
|
|
|
else if (view.getId() == R.id.btnSaveAttachments)
|
|
|
@ -910,7 +906,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
else if (view.getId() == R.id.ibImages)
|
|
|
|
else if (view.getId() == R.id.ibImages)
|
|
|
|
onShowImages(message);
|
|
|
|
onShowImages(message);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
onToggleMessage(pos, message);
|
|
|
|
onToggleMessage(message);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (EntityFolder.DRAFTS.equals(message.folderType))
|
|
|
|
if (EntityFolder.DRAFTS.equals(message.folderType))
|
|
|
|
context.startActivity(
|
|
|
|
context.startActivity(
|
|
|
@ -1083,7 +1079,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onToggleMessage(int pos, TupleMessageEx message) {
|
|
|
|
private void onToggleMessage(TupleMessageEx message) {
|
|
|
|
if (EntityFolder.DRAFTS.equals(message.folderType))
|
|
|
|
if (EntityFolder.DRAFTS.equals(message.folderType))
|
|
|
|
context.startActivity(
|
|
|
|
context.startActivity(
|
|
|
|
new Intent(context, ActivityCompose.class)
|
|
|
|
new Intent(context, ActivityCompose.class)
|
|
|
@ -1097,6 +1093,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
properties.setValue("images", message.id, false);
|
|
|
|
properties.setValue("images", message.id, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int pos = getAdapterPosition();
|
|
|
|
notifyItemChanged(pos);
|
|
|
|
notifyItemChanged(pos);
|
|
|
|
|
|
|
|
|
|
|
|
if (expanded)
|
|
|
|
if (expanded)
|
|
|
@ -1104,10 +1101,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onToggleAddresses(int pos, TupleMessageEx message) {
|
|
|
|
private void onToggleAddresses(TupleMessageEx message) {
|
|
|
|
boolean addresses = !properties.getValue("addresses", message.id);
|
|
|
|
boolean addresses = !properties.getValue("addresses", message.id);
|
|
|
|
properties.setValue("addresses", message.id, addresses);
|
|
|
|
properties.setValue("addresses", message.id, addresses);
|
|
|
|
notifyItemChanged(pos);
|
|
|
|
notifyItemChanged(getAdapterPosition());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onDownloadAttachments(final TupleMessageEx message) {
|
|
|
|
private void onDownloadAttachments(final TupleMessageEx message) {
|
|
|
@ -1236,11 +1233,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
private SimpleTask<SpannableStringBuilder> bodyTask = new SimpleTask<SpannableStringBuilder>() {
|
|
|
|
private SimpleTask<SpannableStringBuilder> bodyTask = new SimpleTask<SpannableStringBuilder>() {
|
|
|
|
private String body = null;
|
|
|
|
private String body = null;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
|
|
|
|
args.putInt("position", position);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected SpannableStringBuilder onExecute(Context context, final Bundle args) {
|
|
|
|
protected SpannableStringBuilder onExecute(Context context, final Bundle args) {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
@ -1278,7 +1270,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
|
|
|
|
TupleMessageEx message = (TupleMessageEx) args.getSerializable("message");
|
|
|
|
properties.setBody(message.id, body);
|
|
|
|
properties.setBody(message.id, body);
|
|
|
|
|
|
|
|
|
|
|
|
if (args.getInt("position") != position)
|
|
|
|
TupleMessageEx amessage = getMessage();
|
|
|
|
|
|
|
|
if (amessage == null || !amessage.id.equals(message.id))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
boolean has_quotes = args.getBoolean("has_quotes");
|
|
|
|
boolean has_quotes = args.getBoolean("has_quotes");
|
|
|
|