Fixed keyboard / add image interaction

pull/205/head
M66B 3 years ago
parent 3505c1ae03
commit c82171f930

@ -5040,13 +5040,17 @@ public class FragmentCompose extends FragmentBase {
getActivity().invalidateOptionsMenu(); getActivity().invalidateOptionsMenu();
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); Runnable postShow = null;
if (args.containsKey("images")) { if (args.containsKey("images")) {
ArrayList<Uri> images = args.getParcelableArrayList("images"); ArrayList<Uri> images = args.getParcelableArrayList("images");
args.remove("images"); // once args.remove("images"); // once
postShow = new Runnable() {
@Override
public void run() {
try {
boolean image_dialog = prefs.getBoolean("image_dialog", true); boolean image_dialog = prefs.getBoolean("image_dialog", true);
if (image_dialog) { if (image_dialog) {
Helper.hideKeyboard(view); Helper.hideKeyboard(view);
@ -5061,6 +5065,14 @@ public class FragmentCompose extends FragmentBase {
fragment.show(getParentFragmentManager(), "compose:shared"); fragment.show(getParentFragmentManager(), "compose:shared");
} else } else
onAddImageFile(images); onAddImageFile(images);
} catch (Throwable ex) {
Log.e(ex);
}
}
};
}
showDraft(draft, postShow);
} }
tvDsn.setVisibility( tvDsn.setVisibility(
@ -5815,7 +5827,7 @@ public class FragmentCompose extends FragmentBase {
Bundle extras = args.getBundle("extras"); Bundle extras = args.getBundle("extras");
boolean show = extras.getBoolean("show"); boolean show = extras.getBoolean("show");
if (show) if (show)
showDraft(draft); showDraft(draft, null);
bottom_navigation.getMenu().findItem(R.id.action_undo).setVisible(draft.revision > 1); 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); bottom_navigation.getMenu().findItem(R.id.action_redo).setVisible(draft.revision < draft.revisions);
@ -5836,7 +5848,7 @@ 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, null);
} else if (action == R.id.action_save) { } else if (action == R.id.action_save) {
boolean autosave = extras.getBoolean("autosave"); boolean autosave = extras.getBoolean("autosave");
@ -5995,7 +6007,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, Runnable postShow) {
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);
@ -6130,7 +6142,9 @@ public class FragmentCompose extends FragmentBase {
return; return;
state = State.LOADED; state = State.LOADED;
setFocus(null, -1, -1, true); setFocus(null, -1, -1, postShow == null);
if (postShow != null)
getMainHandler().post(postShow);
} }
@Override @Override

Loading…
Cancel
Save