Refactoring

This commit is contained in:
M66B
2022-12-07 10:15:00 +01:00
parent fb8c3c2582
commit fcbcb1236d
4 changed files with 423 additions and 417 deletions

View File

@@ -2163,7 +2163,7 @@ public class FragmentCompose extends FragmentBase {
startSearch();
return true;
} else if (itemId == R.id.menu_clear) {
StyleHelper.apply(R.id.menu_clear, getViewLifecycleOwner(), null, etBody);
StyleHelper.apply(-1, R.id.menu_clear, getViewLifecycleOwner(), null, etBody);
return true;
} else if (itemId == R.id.menu_legend) {
onMenuLegend();
@@ -2791,7 +2791,7 @@ public class FragmentCompose extends FragmentBase {
private boolean onActionStyle(int action, View anchor) {
Log.i("Style action=" + action);
return StyleHelper.apply(action, getViewLifecycleOwner(), anchor, etBody);
return StyleHelper.apply(-1, action, getViewLifecycleOwner(), anchor, etBody);
}
private void onActionRecordAudio() {
@@ -4464,7 +4464,7 @@ public class FragmentCompose extends FragmentBase {
int end = args.getInt("end");
String title = args.getString("title");
etBody.setSelection(start, end);
StyleHelper.apply(R.id.menu_link, getViewLifecycleOwner(), null, etBody, link, title);
StyleHelper.apply(-1, R.id.menu_link, getViewLifecycleOwner(), null, etBody, link, title);
}
private void onActionDiscardConfirmed() {
@@ -7403,17 +7403,17 @@ public class FragmentCompose extends FragmentBase {
return true;
case KeyEvent.KEYCODE_B:
if (etBody.hasSelection())
return StyleHelper.apply(R.id.menu_bold, getViewLifecycleOwner(), null, etBody);
return StyleHelper.apply(-1, R.id.menu_bold, getViewLifecycleOwner(), null, etBody);
else
return false;
case KeyEvent.KEYCODE_I:
if (etBody.hasSelection())
return StyleHelper.apply(R.id.menu_italic, getViewLifecycleOwner(), null, etBody);
return StyleHelper.apply(-1, R.id.menu_italic, getViewLifecycleOwner(), null, etBody);
else
return false;
case KeyEvent.KEYCODE_U:
if (etBody.hasSelection())
return StyleHelper.apply(R.id.menu_underline, getViewLifecycleOwner(), null, etBody);
return StyleHelper.apply(-1, R.id.menu_underline, getViewLifecycleOwner(), null, etBody);
else
return false;
}