|
|
|
@ -1347,6 +1347,9 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
outState.putInt("fair:pickRequest", pickRequest);
|
|
|
|
|
outState.putParcelable("fair:pickUri", pickUri);
|
|
|
|
|
|
|
|
|
|
outState.putInt("fair:start", etBody.getSelectionStart());
|
|
|
|
|
outState.putInt("fair:end", etBody.getSelectionEnd());
|
|
|
|
|
|
|
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1398,6 +1401,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putString("action", "edit");
|
|
|
|
|
args.putLong("id", working);
|
|
|
|
|
|
|
|
|
|
draftLoader.execute(FragmentCompose.this, args, "compose:edit");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -1411,6 +1415,10 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putString("action", working < 0 ? "new" : "edit");
|
|
|
|
|
args.putLong("id", working);
|
|
|
|
|
|
|
|
|
|
args.putInt("start", savedInstanceState.getInt("fair:start"));
|
|
|
|
|
args.putInt("end", savedInstanceState.getInt("fair:end"));
|
|
|
|
|
|
|
|
|
|
draftLoader.execute(FragmentCompose.this, args, "compose:instance");
|
|
|
|
|
}
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
@ -5228,7 +5236,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showDraft(draft, false, postShow);
|
|
|
|
|
showDraft(draft, false, postShow, args.getInt("start"), args.getInt("end"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tvDsn.setVisibility(
|
|
|
|
@ -6041,7 +6049,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
boolean show = extras.getBoolean("show");
|
|
|
|
|
boolean refedit = extras.getBoolean("refedit");
|
|
|
|
|
if (show)
|
|
|
|
|
showDraft(draft, refedit, null);
|
|
|
|
|
showDraft(draft, refedit, null, -1, -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);
|
|
|
|
@ -6062,7 +6070,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
finish();
|
|
|
|
|
|
|
|
|
|
} else if (action == R.id.action_undo || action == R.id.action_redo) {
|
|
|
|
|
showDraft(draft, false, null);
|
|
|
|
|
showDraft(draft, false, null, -1, -1);
|
|
|
|
|
|
|
|
|
|
} else if (action == R.id.action_save) {
|
|
|
|
|
boolean autosave = extras.getBoolean("autosave");
|
|
|
|
@ -6224,7 +6232,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
ref.first().before(div);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showDraft(final EntityMessage draft, boolean refedit, Runnable postShow) {
|
|
|
|
|
private void showDraft(final EntityMessage draft, boolean refedit, Runnable postShow, int selStart, int selEnd) {
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putLong("id", draft.id);
|
|
|
|
|
args.putBoolean("show_images", show_images);
|
|
|
|
@ -6395,7 +6403,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
return;
|
|
|
|
|
state = State.LOADED;
|
|
|
|
|
|
|
|
|
|
setFocus(null, -1, -1, postShow == null);
|
|
|
|
|
setFocus(selStart > 0 ? R.id.etBody : null, selStart, selEnd, postShow == null);
|
|
|
|
|
if (postShow != null)
|
|
|
|
|
getMainHandler().post(postShow);
|
|
|
|
|
}
|
|
|
|
|