From 7bc5e96f2e29c8f2f5353308a4c8988584d6ef10 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 1 Dec 2021 09:41:48 +0100 Subject: [PATCH] Set cursor at end on ref edit / bottom posting --- .../java/eu/faircode/email/FragmentCompose.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index e449b8e05c..7573f1a984 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1291,6 +1291,7 @@ public class FragmentCompose extends FragmentBase { Bundle extras = new Bundle(); extras.putString("html", html); extras.putBoolean("show", true); + extras.putBoolean("refedit", true); onAction(R.id.action_save, extras, "refedit"); } @@ -5240,7 +5241,7 @@ public class FragmentCompose extends FragmentBase { }; } - showDraft(draft, postShow); + showDraft(draft, false, postShow); } tvDsn.setVisibility( @@ -6019,8 +6020,9 @@ public class FragmentCompose extends FragmentBase { Bundle extras = args.getBundle("extras"); boolean show = extras.getBoolean("show"); + boolean refedit = extras.getBoolean("refedit"); if (show) - showDraft(draft, null); + showDraft(draft, refedit, null); bottom_navigation.getMenu().findItem(R.id.action_undo).setVisible(draft.revision > 1); bottom_navigation.getMenu().findItem(R.id.action_redo).setVisible(draft.revision < draft.revisions); @@ -6041,7 +6043,7 @@ public class FragmentCompose extends FragmentBase { finish(); } else if (action == R.id.action_undo || action == R.id.action_redo) { - showDraft(draft, null); + showDraft(draft, false, null); } else if (action == R.id.action_save) { boolean autosave = extras.getBoolean("autosave"); @@ -6202,7 +6204,7 @@ public class FragmentCompose extends FragmentBase { ref.first().before(div); } - private void showDraft(final EntityMessage draft, Runnable postShow) { + private void showDraft(final EntityMessage draft, boolean refedit, Runnable postShow) { Bundle args = new Bundle(); args.putLong("id", draft.id); args.putBoolean("show_images", show_images); @@ -6334,6 +6336,9 @@ public class FragmentCompose extends FragmentBase { setBodyPadding(); + if (refedit && write_below) + etBody.setSelection(etBody.length()); + if (state == State.LOADED) return; state = State.LOADED;