|
|
@ -1154,8 +1154,54 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
a.add(attachment);
|
|
|
|
a.add(attachment);
|
|
|
|
|
|
|
|
|
|
|
|
if (attachment.available && "text/calendar".equals(attachment.type)) {
|
|
|
|
if (attachment.available && "text/calendar".equals(attachment.type)) {
|
|
|
|
// https://tools.ietf.org/html/rfc5546
|
|
|
|
|
|
|
|
calendar = true;
|
|
|
|
calendar = true;
|
|
|
|
|
|
|
|
bindCalendar(message, attachment);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
adapterAttachment.set(a);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!calendar) {
|
|
|
|
|
|
|
|
tvCalendarSummary.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
tvCalendarStart.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
tvCalendarEnd.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
tvAttendees.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
pbCalendarWait.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
grpCalendar.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
grpCalendarResponse.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbInline.setOnCheckedChangeListener(null);
|
|
|
|
|
|
|
|
cbInline.setChecked(show_inline);
|
|
|
|
|
|
|
|
cbInline.setVisibility(has_inline ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
ibDecrypt.setVisibility(is_encrypted ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
btnDownloadAttachments.setVisibility(download && suitable ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
btnSaveAttachments.setVisibility(save ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
tvNoInternetAttachments.setVisibility(downloading && !suitable ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbInline.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
|
|
|
|
properties.setValue("inline", message.id, isChecked);
|
|
|
|
|
|
|
|
cowner.restart();
|
|
|
|
|
|
|
|
DB.getInstance(context).attachment().liveAttachments(message.id).observe(cowner, new Observer<List<EntityAttachment>>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onChanged(@Nullable List<EntityAttachment> attachments) {
|
|
|
|
|
|
|
|
bindAttachments(message, attachments);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<EntityAttachment> images = new ArrayList<>();
|
|
|
|
|
|
|
|
for (EntityAttachment attachment : attachments)
|
|
|
|
|
|
|
|
if (!attachment.isInline() && attachment.isImage())
|
|
|
|
|
|
|
|
images.add(attachment);
|
|
|
|
|
|
|
|
adapterImage.set(images);
|
|
|
|
|
|
|
|
grpImages.setVisibility(images.size() > 0 ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void bindCalendar(final TupleMessageEx message, EntityAttachment attachment) {
|
|
|
|
|
|
|
|
// https://tools.ietf.org/html/rfc5546
|
|
|
|
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putLong("id", message.id);
|
|
|
|
args.putLong("id", message.id);
|
|
|
@ -1250,48 +1296,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.execute(context, owner, args, "message:calendar");
|
|
|
|
}.execute(context, owner, args, "message:calendar");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
adapterAttachment.set(a);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!calendar) {
|
|
|
|
|
|
|
|
tvCalendarSummary.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
tvCalendarStart.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
tvCalendarEnd.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
tvAttendees.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
pbCalendarWait.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
grpCalendar.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
grpCalendarResponse.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbInline.setOnCheckedChangeListener(null);
|
|
|
|
|
|
|
|
cbInline.setChecked(show_inline);
|
|
|
|
|
|
|
|
cbInline.setVisibility(has_inline ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
ibDecrypt.setVisibility(is_encrypted ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
btnDownloadAttachments.setVisibility(download && suitable ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
btnSaveAttachments.setVisibility(save ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
tvNoInternetAttachments.setVisibility(downloading && !suitable ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbInline.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
|
|
|
|
|
properties.setValue("inline", message.id, isChecked);
|
|
|
|
|
|
|
|
cowner.restart();
|
|
|
|
|
|
|
|
DB.getInstance(context).attachment().liveAttachments(message.id).observe(cowner, new Observer<List<EntityAttachment>>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onChanged(@Nullable List<EntityAttachment> attachments) {
|
|
|
|
|
|
|
|
bindAttachments(message, attachments);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<EntityAttachment> images = new ArrayList<>();
|
|
|
|
|
|
|
|
for (EntityAttachment attachment : attachments)
|
|
|
|
|
|
|
|
if (!attachment.isInline() && attachment.isImage())
|
|
|
|
|
|
|
|
images.add(attachment);
|
|
|
|
|
|
|
|
adapterImage.set(images);
|
|
|
|
|
|
|
|
grpImages.setVisibility(images.size() > 0 ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void onActionCalendar(TupleMessageEx message, int action) {
|
|
|
|
private void onActionCalendar(TupleMessageEx message, int action) {
|
|
|
|
if (!Helper.isPro(context)) {
|
|
|
|
if (!Helper.isPro(context)) {
|
|
|
|