mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-14 04:53:22 +02:00
Fixed inserting links in some situations
This commit is contained in:
@@ -237,6 +237,8 @@ public class ActivitySignature extends ActivityBase {
|
||||
|
||||
if (action == R.id.menu_link) {
|
||||
Uri uri = null;
|
||||
final int start = etText.getSelectionStart();
|
||||
final int end = etText.getSelectionEnd();
|
||||
|
||||
ClipboardManager cbm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
if (cbm != null && cbm.hasPrimaryClip()) {
|
||||
@@ -259,6 +261,7 @@ public class ActivitySignature extends ActivityBase {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String link = etLink.getText().toString();
|
||||
etText.setSelection(start, end);
|
||||
StyleHelper.apply(R.id.menu_link, etText, link);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -336,6 +336,9 @@ public class FragmentAnswer extends FragmentBase {
|
||||
|
||||
private void onLinkSelected(Bundle args) {
|
||||
String link = args.getString("link");
|
||||
int start = args.getInt("start");
|
||||
int end = args.getInt("end");
|
||||
etText.setSelection(start, end);
|
||||
StyleHelper.apply(R.id.menu_link, etText, link);
|
||||
}
|
||||
|
||||
@@ -389,6 +392,8 @@ public class FragmentAnswer extends FragmentBase {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable("uri", uri);
|
||||
args.putInt("start", etText.getSelectionStart());
|
||||
args.putInt("end", etText.getSelectionEnd());
|
||||
|
||||
FragmentDialogLink fragment = new FragmentDialogLink();
|
||||
fragment.setArguments(args);
|
||||
|
||||
@@ -1519,6 +1519,8 @@ public class FragmentCompose extends FragmentBase {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable("uri", uri);
|
||||
args.putInt("start", etBody.getSelectionStart());
|
||||
args.putInt("end", etBody.getSelectionEnd());
|
||||
|
||||
FragmentDialogLink fragment = new FragmentDialogLink();
|
||||
fragment.setArguments(args);
|
||||
@@ -2674,6 +2676,9 @@ public class FragmentCompose extends FragmentBase {
|
||||
|
||||
private void onLinkSelected(Bundle args) {
|
||||
String link = args.getString("link");
|
||||
int start = args.getInt("start");
|
||||
int end = args.getInt("end");
|
||||
etBody.setSelection(start, end);
|
||||
StyleHelper.apply(R.id.menu_link, etBody, link);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user