mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 06:01:12 +00:00
Refactoring
This commit is contained in:
parent
76d322befb
commit
3206a3ae3d
1 changed files with 28 additions and 11 deletions
|
@ -642,10 +642,18 @@ public class FragmentCompose extends FragmentBase {
|
|||
activity.onUserInteraction();
|
||||
|
||||
int index = start + before;
|
||||
if (count - before == 1 && index > 0 && text.charAt(index) == '\n') {
|
||||
Log.i("Added=" + index);
|
||||
added = index;
|
||||
save = (text.charAt(index - 1) != '\n');
|
||||
|
||||
if (count - before == 1 && index > 0) {
|
||||
char c = text.charAt(index);
|
||||
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)
|
||||
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) {
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
|
@ -799,9 +800,25 @@ public class FragmentCompose extends FragmentBase {
|
|||
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)
|
||||
TextUtils.dumpSpans(text, lp, "---after>");
|
||||
}
|
||||
|
||||
private boolean isDot(char c) {
|
||||
return BuildConfig.DEBUG &&
|
||||
(c == '.' /* Latin */ || c == '。' /* Chinese */);
|
||||
}
|
||||
});
|
||||
|
||||
tvSignature.setTypeface(StyleHelper.getTypeface(compose_font, getContext()));
|
||||
|
|
Loading…
Reference in a new issue