|
|
@ -799,8 +799,13 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
if (renum)
|
|
|
|
if (renum)
|
|
|
|
StyleHelper.renumber(text, false, etBody.getContext());
|
|
|
|
StyleHelper.renumber(text, false, etBody.getContext());
|
|
|
|
|
|
|
|
|
|
|
|
if (lt_auto)
|
|
|
|
if (lt_auto) {
|
|
|
|
onLanguageTool(true);
|
|
|
|
int start = added;
|
|
|
|
|
|
|
|
while (start > 0 && text.charAt(start - 1) != '\n')
|
|
|
|
|
|
|
|
start--;
|
|
|
|
|
|
|
|
if (start < added)
|
|
|
|
|
|
|
|
onLanguageTool(start, added, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
Log.e(ex);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
@ -1968,7 +1973,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
if (lt_enabled) {
|
|
|
|
if (lt_enabled) {
|
|
|
|
onLanguageTool(false);
|
|
|
|
onLanguageTool(0, etBody.length(), false);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -2568,13 +2573,13 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
popupMenu.showWithIcons(context, anchor);
|
|
|
|
popupMenu.showWithIcons(context, anchor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onLanguageTool(boolean silent) {
|
|
|
|
private void onLanguageTool(int start, int end, boolean silent) {
|
|
|
|
etBody.clearComposingText();
|
|
|
|
etBody.clearComposingText();
|
|
|
|
|
|
|
|
|
|
|
|
Log.i("LT running enabled=" + etBody.isSuggestionsEnabled());
|
|
|
|
Log.i("LT running enabled=" + etBody.isSuggestionsEnabled());
|
|
|
|
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putCharSequence("text", etBody.getText());
|
|
|
|
args.putCharSequence("text", etBody.getText().subSequence(start, end));
|
|
|
|
|
|
|
|
|
|
|
|
new SimpleTask<List<LanguageTool.Suggestion>>() {
|
|
|
|
new SimpleTask<List<LanguageTool.Suggestion>>() {
|
|
|
|
private Toast toast = null;
|
|
|
|
private Toast toast = null;
|
|
|
@ -2605,7 +2610,7 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onExecuted(Bundle args, List<LanguageTool.Suggestion> suggestions) {
|
|
|
|
protected void onExecuted(Bundle args, List<LanguageTool.Suggestion> suggestions) {
|
|
|
|
LanguageTool.applySuggestions(etBody, suggestions);
|
|
|
|
LanguageTool.applySuggestions(etBody, start, end, suggestions);
|
|
|
|
|
|
|
|
|
|
|
|
if (!silent &&
|
|
|
|
if (!silent &&
|
|
|
|
(suggestions == null || suggestions.size() == 0))
|
|
|
|
(suggestions == null || suggestions.size() == 0))
|
|
|
@ -5692,15 +5697,17 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
Log.i("Draft content=" + draft.content);
|
|
|
|
Log.i("Draft content=" + draft.content);
|
|
|
|
if (draft.content && state == State.NONE) {
|
|
|
|
if (draft.content && state == State.NONE) {
|
|
|
|
Runnable postShow = null;
|
|
|
|
ArrayList<Uri> images = args.getParcelableArrayList("images");
|
|
|
|
if (args.containsKey("images")) {
|
|
|
|
args.remove("images"); // once
|
|
|
|
ArrayList<Uri> images = args.getParcelableArrayList("images");
|
|
|
|
|
|
|
|
args.remove("images"); // once
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
postShow = new Runnable() {
|
|
|
|
Runnable postShow = new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (lt_auto)
|
|
|
|
|
|
|
|
onLanguageTool(0, etBody.length(), true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (images != null) {
|
|
|
|
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);
|
|
|
@ -5715,12 +5722,12 @@ 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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.e(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
showDraft(draft, false, postShow, args.getInt("selection"));
|
|
|
|
showDraft(draft, false, postShow, args.getInt("selection"));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -6897,9 +6904,6 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
|
|
grpBody.setVisibility(View.VISIBLE);
|
|
|
|
grpBody.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
|
if (lt_auto)
|
|
|
|
|
|
|
|
onLanguageTool(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbSignature.setChecked(draft.signature);
|
|
|
|
cbSignature.setChecked(draft.signature);
|
|
|
|
tvSignature.setAlpha(draft.signature ? 1.0f : Helper.LOW_LIGHT);
|
|
|
|
tvSignature.setAlpha(draft.signature ? 1.0f : Helper.LOW_LIGHT);
|
|
|
|
|
|
|
|
|
|
|
|