mirror of https://github.com/M66B/FairEmail.git
Added copy reference text
This commit is contained in:
parent
e487c27fb5
commit
a1cb4e86d8
|
@ -1072,7 +1072,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_edit_plain_text, 1, R.string.title_edit_plain_text);
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_edit_plain_text, 1, R.string.title_edit_plain_text);
|
||||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_edit_formatted_text, 2, R.string.title_edit_formatted_text);
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_edit_formatted_text, 2, R.string.title_edit_formatted_text);
|
||||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_delete, 3, R.string.title_delete);
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_clipboard_copy, 3, R.string.title_clipboard_copy);
|
||||||
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_delete, 4, R.string.title_delete);
|
||||||
|
|
||||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1084,6 +1085,9 @@ public class FragmentCompose extends FragmentBase {
|
||||||
} else if (itemId == R.string.title_edit_formatted_text) {
|
} else if (itemId == R.string.title_edit_formatted_text) {
|
||||||
convertRef(false);
|
convertRef(false);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (itemId == R.string.title_clipboard_copy) {
|
||||||
|
copyRef();
|
||||||
|
return true;
|
||||||
} else if (itemId == R.string.title_delete) {
|
} else if (itemId == R.string.title_delete) {
|
||||||
deleteRef();
|
deleteRef();
|
||||||
return true;
|
return true;
|
||||||
|
@ -1155,6 +1159,26 @@ public class FragmentCompose extends FragmentBase {
|
||||||
}.execute(FragmentCompose.this, args, "compose:convert");
|
}.execute(FragmentCompose.this, args, "compose:convert");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void copyRef() {
|
||||||
|
Context context = getContext();
|
||||||
|
if (context == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ClipboardManager clipboard =
|
||||||
|
(ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
if (clipboard == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String html = HtmlHelper.toHtml((Spanned) tvReference.getText(), context);
|
||||||
|
|
||||||
|
ClipData clip = ClipData.newHtmlText(
|
||||||
|
etSubject.getText().toString(),
|
||||||
|
HtmlHelper.getText(getContext(), html),
|
||||||
|
html);
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
ToastEx.makeText(context, R.string.title_clipboard_copied, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
private void deleteRef() {
|
private void deleteRef() {
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
extras.putString("html", HtmlHelper.toHtml(etBody.getText(), getContext()));
|
extras.putString("html", HtmlHelper.toHtml(etBody.getText(), getContext()));
|
||||||
|
|
Loading…
Reference in New Issue