|
|
@ -642,10 +642,18 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
activity.onUserInteraction();
|
|
|
|
activity.onUserInteraction();
|
|
|
|
|
|
|
|
|
|
|
|
int index = start + before;
|
|
|
|
int index = start + before;
|
|
|
|
if (count - before == 1 && index > 0 && text.charAt(index) == '\n') {
|
|
|
|
|
|
|
|
Log.i("Added=" + index);
|
|
|
|
if (count - before == 1 && index > 0) {
|
|
|
|
added = index;
|
|
|
|
char c = text.charAt(index);
|
|
|
|
save = (text.charAt(index - 1) != '\n');
|
|
|
|
char b = text.charAt(index - 1);
|
|
|
|
|
|
|
|
save = (c == '\n' && b != '\n') || (isDot(c) && !isDot(b));
|
|
|
|
|
|
|
|
if (save)
|
|
|
|
|
|
|
|
Log.i("Save=" + index);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (c == '\n') {
|
|
|
|
|
|
|
|
Log.i("Added=" + index);
|
|
|
|
|
|
|
|
added = index;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -754,13 +762,6 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
if (renum)
|
|
|
|
if (renum)
|
|
|
|
StyleHelper.renumber(text, false, etBody.getContext());
|
|
|
|
StyleHelper.renumber(text, false, etBody.getContext());
|
|
|
|
|
|
|
|
|
|
|
|
if (save && auto_save &&
|
|
|
|
|
|
|
|
getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
|
|
|
|
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
|
|
|
|
extras.putBoolean("silent", true);
|
|
|
|
|
|
|
|
onAction(R.id.action_save, extras, "paragraph");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
Log.e(ex);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
@ -799,9 +800,25 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
translated = null;
|
|
|
|
translated = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (save && auto_save)
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
|
|
|
|
|
|
|
|
Bundle extras = new Bundle();
|
|
|
|
|
|
|
|
extras.putBoolean("silent", true);
|
|
|
|
|
|
|
|
onAction(R.id.action_save, extras, "paragraph");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
save = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lp != null)
|
|
|
|
if (lp != null)
|
|
|
|
TextUtils.dumpSpans(text, lp, "---after>");
|
|
|
|
TextUtils.dumpSpans(text, lp, "---after>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isDot(char c) {
|
|
|
|
|
|
|
|
return BuildConfig.DEBUG &&
|
|
|
|
|
|
|
|
(c == '.' /* Latin */ || c == '。' /* Chinese */);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
tvSignature.setTypeface(StyleHelper.getTypeface(compose_font, getContext()));
|
|
|
|
tvSignature.setTypeface(StyleHelper.getTypeface(compose_font, getContext()));
|
|
|
|