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