From d1af6fa853d486a11c934b0a738d28ef1b941c0b Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 27 Aug 2018 17:28:49 +0000 Subject: [PATCH] Fixed handling compose pause --- .../eu/faircode/email/FragmentCompose.java | 36 ++++++++++++------- .../java/eu/faircode/email/FragmentEx.java | 5 +-- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 475712208c..ee397f4092 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -352,19 +352,29 @@ public class FragmentCompose extends FragmentEx { super.onActivityCreated(savedInstanceState); if (savedInstanceState == null) { - Bundle args = new Bundle(); - args.putString("action", getArguments().getString("action")); - args.putLong("id", getArguments().getLong("id", -1)); - args.putLong("account", getArguments().getLong("account", -1)); - args.putLong("reference", getArguments().getLong("reference", -1)); - args.putLong("answer", getArguments().getLong("answer", -1)); - args.putString("to", getArguments().getString("to")); - args.putString("cc", getArguments().getString("cc")); - args.putString("bcc", getArguments().getString("bcc")); - args.putString("subject", getArguments().getString("subject")); - args.putString("body", getArguments().getString("body")); - args.putParcelableArrayList("attachments", getArguments().getParcelableArrayList("attachments")); - draftLoader.load(this, args); + if (working < 0) { + Bundle args = new Bundle(); + args.putString("action", getArguments().getString("action")); + args.putLong("id", getArguments().getLong("id", -1)); + args.putLong("account", getArguments().getLong("account", -1)); + args.putLong("reference", getArguments().getLong("reference", -1)); + args.putLong("answer", getArguments().getLong("answer", -1)); + args.putString("to", getArguments().getString("to")); + args.putString("cc", getArguments().getString("cc")); + args.putString("bcc", getArguments().getString("bcc")); + args.putString("subject", getArguments().getString("subject")); + args.putString("body", getArguments().getString("body")); + args.putParcelableArrayList("attachments", getArguments().getParcelableArrayList("attachments")); + draftLoader.load(this, args); + } else { + Bundle args = new Bundle(); + args.putString("action", "edit"); + args.putLong("id", working); + args.putLong("account", -1); + args.putLong("reference", -1); + args.putLong("answer", -1); + draftLoader.load(this, args); + } } else { encrypted = savedInstanceState.getString("encrypted"); diff --git a/app/src/main/java/eu/faircode/email/FragmentEx.java b/app/src/main/java/eu/faircode/email/FragmentEx.java index 8ac89e10e5..b98e05941f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentEx.java +++ b/app/src/main/java/eu/faircode/email/FragmentEx.java @@ -54,13 +54,14 @@ public class FragmentEx extends Fragment { @Override public void onSaveInstanceState(Bundle outState) { + Log.i(Helper.TAG, "Save instance " + this); super.onSaveInstanceState(outState); outState.putString("subtitle", subtitle); } @Override public void onCreate(Bundle savedInstanceState) { - Log.i(Helper.TAG, "Create " + this); + Log.i(Helper.TAG, "Create " + this + " saved=" + (savedInstanceState != null)); super.onCreate(savedInstanceState); if (savedInstanceState != null) subtitle = savedInstanceState.getString("subtitle"); @@ -74,7 +75,7 @@ public class FragmentEx extends Fragment { @Override public void onActivityCreated(Bundle savedInstanceState) { - Log.i(Helper.TAG, "Activity " + this); + Log.i(Helper.TAG, "Activity " + this + " saved=" + (savedInstanceState != null)); super.onActivityCreated(savedInstanceState); }