Scroll to end on edit ref

This commit is contained in:
M66B 2020-03-25 16:13:07 +01:00
parent 23e5414612
commit e664e5408f
1 changed files with 11 additions and 6 deletions

View File

@ -3536,7 +3536,7 @@ public class FragmentCompose extends FragmentBase {
Log.i("Draft content=" + draft.content); Log.i("Draft content=" + draft.content);
if (draft.content && state == State.NONE) if (draft.content && state == State.NONE)
showDraft(draft); showDraft(draft, false);
tvNoInternet.setTag(draft.content); tvNoInternet.setTag(draft.content);
checkInternet(); checkInternet();
@ -4035,12 +4035,14 @@ public class FragmentCompose extends FragmentBase {
finish(); finish();
} else if (action == R.id.action_undo || action == R.id.action_redo) { } else if (action == R.id.action_undo || action == R.id.action_redo) {
showDraft(draft); showDraft(draft, false);
} else if (action == R.id.action_save) { } else if (action == R.id.action_save) {
boolean show = args.getBundle("extras").getBoolean("show"); Bundle extras = args.getBundle("extras");
boolean show = extras.getBoolean("show");
boolean html = extras.containsKey("html");
if (show) if (show)
showDraft(draft); showDraft(draft, html);
} else if (action == R.id.action_check) { } else if (action == R.id.action_check) {
boolean dialog = args.getBundle("extras").getBoolean("dialog"); boolean dialog = args.getBundle("extras").getBoolean("dialog");
@ -4161,7 +4163,7 @@ public class FragmentCompose extends FragmentBase {
ref.first().before(div); ref.first().before(div);
} }
private void showDraft(final EntityMessage draft) { private void showDraft(final EntityMessage draft, final boolean scroll) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", draft.id); args.putLong("id", draft.id);
args.putBoolean("show_images", show_images); args.putBoolean("show_images", show_images);
@ -4261,7 +4263,10 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
protected void onExecuted(Bundle args, Spanned[] text) { protected void onExecuted(Bundle args, Spanned[] text) {
etBody.setText(text[0]); etBody.setText(text[0]);
etBody.setSelection(0); if (scroll && text[0] != null)
etBody.setSelection(text[0].length());
else
etBody.setSelection(0);
grpBody.setVisibility(View.VISIBLE); grpBody.setVisibility(View.VISIBLE);
cbSignature.setChecked(draft.signature); cbSignature.setChecked(draft.signature);