diff --git a/app/src/main/java/eu/faircode/email/FragmentEx.java b/app/src/main/java/eu/faircode/email/FragmentEx.java index 8cfd5812..8ac89e10 100644 --- a/app/src/main/java/eu/faircode/email/FragmentEx.java +++ b/app/src/main/java/eu/faircode/email/FragmentEx.java @@ -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 diff --git a/app/src/main/java/eu/faircode/email/FragmentMessage.java b/app/src/main/java/eu/faircode/email/FragmentMessage.java index 452fc9ed..2887875a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessage.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessage.java @@ -307,6 +307,8 @@ public class FragmentMessage extends FragmentEx { // Observe message db.message().liveMessage(id).observe(getViewLifecycleOwner(), new Observer() { + 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));