Browse Source

Save subtitle

main
M66B 6 years ago
parent
commit
6782351869
2 changed files with 16 additions and 1 deletions
  1. +8
    -0
      app/src/main/java/eu/faircode/email/FragmentEx.java
  2. +8
    -1
      app/src/main/java/eu/faircode/email/FragmentMessage.java

+ 8
- 0
app/src/main/java/eu/faircode/email/FragmentEx.java View File

@ -52,10 +52,18 @@ public class FragmentEx extends Fragment {
finish = true;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("subtitle", subtitle);
}
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(Helper.TAG, "Create " + this);
super.onCreate(savedInstanceState);
if (savedInstanceState != null)
subtitle = savedInstanceState.getString("subtitle");
}
@Override


+ 8
- 1
app/src/main/java/eu/faircode/email/FragmentMessage.java View File

@ -307,6 +307,8 @@ public class FragmentMessage extends FragmentEx {
// Observe message
db.message().liveMessage(id).observe(getViewLifecycleOwner(), new Observer<TupleMessageEx>() {
private boolean once = false;
@Override
public void onChanged(@Nullable final TupleMessageEx message) {
if (message == null || (!(debug && BuildConfig.DEBUG) && message.ui_hide)) {
@ -316,9 +318,14 @@ public class FragmentMessage extends FragmentEx {
}
FragmentMessage.this.message = message;
setSubtitle(Helper.localizeFolderName(getContext(), message.folderName));
if (savedInstanceState == null) {
if (once)
return;
once = true;
setSubtitle(Helper.localizeFolderName(getContext(), message.folderName));
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));


Loading…
Cancel
Save