mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 18:27:43 +00:00
Load body when needed only
This commit is contained in:
parent
6782351869
commit
f0c5f6fedd
1 changed files with 25 additions and 19 deletions
|
@ -338,6 +338,7 @@ public class FragmentMessage extends FragmentEx {
|
||||||
tvBcc.setText(message.bcc == null ? null : MessageHelper.getFormattedAddresses(message.bcc, true));
|
tvBcc.setText(message.bcc == null ? null : MessageHelper.getFormattedAddresses(message.bcc, true));
|
||||||
|
|
||||||
tvError.setText(message.error);
|
tvError.setText(message.error);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
free = savedInstanceState.getBoolean("free");
|
free = savedInstanceState.getBoolean("free");
|
||||||
if (free) {
|
if (free) {
|
||||||
|
@ -350,6 +351,8 @@ public class FragmentMessage extends FragmentEx {
|
||||||
|
|
||||||
getActivity().invalidateOptionsMenu();
|
getActivity().invalidateOptionsMenu();
|
||||||
|
|
||||||
|
if (tvBody.getTag() == null) {
|
||||||
|
// Spanned text needs to be loaded after recreation too
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putLong("id", message.id);
|
args.putLong("id", message.id);
|
||||||
|
|
||||||
|
@ -366,11 +369,13 @@ public class FragmentMessage extends FragmentEx {
|
||||||
protected void onLoaded(Bundle args, Spanned body) {
|
protected void onLoaded(Bundle args, Spanned body) {
|
||||||
tvSize.setText(Helper.humanReadableByteCount(args.getInt("size"), false));
|
tvSize.setText(Helper.humanReadableByteCount(args.getInt("size"), false));
|
||||||
tvBody.setText(body);
|
tvBody.setText(body);
|
||||||
|
tvBody.setTag(true);
|
||||||
grpMessage.setVisibility(View.VISIBLE);
|
grpMessage.setVisibility(View.VISIBLE);
|
||||||
fab.setVisibility(free ? View.GONE : View.VISIBLE);
|
fab.setVisibility(free ? View.GONE : View.VISIBLE);
|
||||||
pbBody.setVisibility(View.GONE);
|
pbBody.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}.load(FragmentMessage.this, args);
|
}.load(FragmentMessage.this, args);
|
||||||
|
}
|
||||||
|
|
||||||
int typeface = (message.ui_seen ? Typeface.NORMAL : Typeface.BOLD);
|
int typeface = (message.ui_seen ? Typeface.NORMAL : Typeface.BOLD);
|
||||||
tvFrom.setTypeface(null, typeface);
|
tvFrom.setTypeface(null, typeface);
|
||||||
|
@ -411,6 +416,7 @@ public class FragmentMessage extends FragmentEx {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Observe folders
|
||||||
db.folder().liveFolders(message.account).removeObservers(getViewLifecycleOwner());
|
db.folder().liveFolders(message.account).removeObservers(getViewLifecycleOwner());
|
||||||
db.folder().liveFolders(message.account).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
|
db.folder().liveFolders(message.account).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue