|
|
|
@ -315,9 +315,12 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
// Message gone (moved, deleted)
|
|
|
|
|
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
|
|
|
|
|
getFragmentManager().popBackStack();
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setSubtitle(Helper.localizeFolderName(getContext(), message.folderName));
|
|
|
|
|
|
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
|
tvFrom.setText(message.from == null ? null : MessageHelper.getFormattedAddresses(message.from, true));
|
|
|
|
|
tvTime.setText(message.sent == null ? null : df.format(new Date(message.sent)));
|
|
|
|
|
tvTo.setText(message.to == null ? null : MessageHelper.getFormattedAddresses(message.to, true));
|
|
|
|
@ -329,24 +332,12 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
tvCc.setText(message.cc == null ? null : MessageHelper.getFormattedAddresses(message.cc, true));
|
|
|
|
|
tvBcc.setText(message.bcc == null ? null : MessageHelper.getFormattedAddresses(message.bcc, true));
|
|
|
|
|
|
|
|
|
|
int typeface = (message.ui_seen ? Typeface.NORMAL : Typeface.BOLD);
|
|
|
|
|
tvFrom.setTypeface(null, typeface);
|
|
|
|
|
tvTime.setTypeface(null, typeface);
|
|
|
|
|
tvSubject.setTypeface(null, typeface);
|
|
|
|
|
tvCount.setTypeface(null, typeface);
|
|
|
|
|
|
|
|
|
|
int colorUnseen = Helper.resolveColor(getContext(), message.ui_seen
|
|
|
|
|
? android.R.attr.textColorSecondary : R.attr.colorUnread);
|
|
|
|
|
tvFrom.setTextColor(colorUnseen);
|
|
|
|
|
tvTime.setTextColor(colorUnseen);
|
|
|
|
|
|
|
|
|
|
tvError.setText(message.error);
|
|
|
|
|
|
|
|
|
|
MenuItem actionSeen = top_navigation.getMenu().findItem(R.id.action_seen);
|
|
|
|
|
actionSeen.setIcon(message.ui_seen
|
|
|
|
|
? R.drawable.baseline_visibility_off_24
|
|
|
|
|
: R.drawable.baseline_visibility_24);
|
|
|
|
|
actionSeen.setTitle(message.ui_seen ? R.string.title_unseen : R.string.title_seen);
|
|
|
|
|
} else {
|
|
|
|
|
free = savedInstanceState.getBoolean("free");
|
|
|
|
|
grpAddresses.setTag(savedInstanceState.getInt("addresses"));
|
|
|
|
|
rvAttachment.setTag(savedInstanceState.getInt("attachments"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putLong("id", message.id);
|
|
|
|
@ -362,10 +353,28 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
protected void onLoaded(Bundle args, Spanned body) {
|
|
|
|
|
tvBody.setText(body);
|
|
|
|
|
grpMessage.setVisibility(View.VISIBLE);
|
|
|
|
|
if (!free)
|
|
|
|
|
fab.setVisibility(View.VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
}.load(FragmentMessage.this, args);
|
|
|
|
|
|
|
|
|
|
int typeface = (message.ui_seen ? Typeface.NORMAL : Typeface.BOLD);
|
|
|
|
|
tvFrom.setTypeface(null, typeface);
|
|
|
|
|
tvTime.setTypeface(null, typeface);
|
|
|
|
|
tvSubject.setTypeface(null, typeface);
|
|
|
|
|
tvCount.setTypeface(null, typeface);
|
|
|
|
|
|
|
|
|
|
int colorUnseen = Helper.resolveColor(getContext(), message.ui_seen
|
|
|
|
|
? android.R.attr.textColorSecondary : R.attr.colorUnread);
|
|
|
|
|
tvFrom.setTextColor(colorUnseen);
|
|
|
|
|
tvTime.setTextColor(colorUnseen);
|
|
|
|
|
|
|
|
|
|
MenuItem actionSeen = top_navigation.getMenu().findItem(R.id.action_seen);
|
|
|
|
|
actionSeen.setIcon(message.ui_seen
|
|
|
|
|
? R.drawable.baseline_visibility_off_24
|
|
|
|
|
: R.drawable.baseline_visibility_24);
|
|
|
|
|
actionSeen.setTitle(message.ui_seen ? R.string.title_unseen : R.string.title_seen);
|
|
|
|
|
|
|
|
|
|
db.folder().liveFolders(message.account).removeObservers(getViewLifecycleOwner());
|
|
|
|
|
db.folder().liveFolders(message.account).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
|
|
|
|
|
@Override
|
|
|
|
@ -404,6 +413,7 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
top_navigation.getMenu().findItem(R.id.action_edit).setVisible(inTrash);
|
|
|
|
|
top_navigation.getMenu().findItem(R.id.action_forward).setVisible(!inOutbox);
|
|
|
|
|
top_navigation.getMenu().findItem(R.id.action_reply_all).setVisible(!inOutbox && message.cc != null);
|
|
|
|
|
if (!free)
|
|
|
|
|
top_navigation.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
bottom_navigation.getMenu().findItem(R.id.action_spam).setVisible(message.uid != null && !inOutbox && !inArchive && !inJunk && hasJunk);
|
|
|
|
@ -415,12 +425,6 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (savedInstanceState != null) {
|
|
|
|
|
free = savedInstanceState.getBoolean("free");
|
|
|
|
|
grpAddresses.setTag(savedInstanceState.getInt("addresses"));
|
|
|
|
|
rvAttachment.setTag(savedInstanceState.getInt("attachments"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pbWait.setVisibility(View.GONE);
|
|
|
|
|
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
|
|
|
if (free)
|
|
|
|
@ -428,7 +432,6 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
tvCount.setVisibility(!free && message.count > 1 ? View.VISIBLE : View.GONE);
|
|
|
|
|
tvError.setVisibility(free || message.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Observe attachments
|
|
|
|
|