Use generic bg executor for LT and DeepL

pull/214/head
M66B 12 months ago
parent 80d5102364
commit 66d718ffa2

@ -2756,6 +2756,8 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onExecuted(Bundle args, DeepL.Translation translation) {
if (etSubject == null)
return;
etSubject.setText(translation.translated_text);
}
@ -2763,7 +2765,7 @@ public class FragmentCompose extends FragmentBase {
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex, !(ex instanceof IOException));
}
}.serial().execute(FragmentCompose.this, args, "compose:translate");
}.execute(FragmentCompose.this, args, "compose:translate");
} else {
final Pair<Integer, Integer> paragraph = StyleHelper.getParagraph(etBody);
if (paragraph == null)
@ -2890,7 +2892,7 @@ public class FragmentCompose extends FragmentBase {
etBody.setSelection(paragraph.second);
Log.unexpectedError(getParentFragmentManager(), ex, !(ex instanceof IOException));
}
}.serial().execute(FragmentCompose.this, args, "compose:translate");
}.execute(FragmentCompose.this, args, "compose:translate");
}
}
});
@ -2970,7 +2972,7 @@ public class FragmentCompose extends FragmentBase {
Log.unexpectedError(getParentFragmentManager(), exex, false);
}
}
}.serial().execute(this, args, "compose:lt");
}.execute(this, args, "compose:lt");
}
private void onActionRecordAudio() {

@ -409,6 +409,8 @@ public class LanguageTool {
}
static void applySuggestions(EditText etBody, int start, int end, List<Suggestion> suggestions) {
if (etBody == null)
return;
Editable edit = etBody.getText();
if (edit == null)
return;

Loading…
Cancel
Save