mirror of https://github.com/M66B/FairEmail.git
Copy signature to clipboard
This commit is contained in:
parent
79603c5cfe
commit
815d57a193
|
@ -573,17 +573,20 @@ public class FragmentCompose extends FragmentBase {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
|
EntityIdentity identity = (EntityIdentity) spIdentity.getSelectedItem();
|
||||||
if (identity == null && TextUtils.isEmpty(identity.signature))
|
if (identity == null || TextUtils.isEmpty(identity.signature))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Spanned sig = HtmlHelper.fromHtml(identity.signature, new Html.ImageGetter() {
|
ClipboardManager clipboard =
|
||||||
@Override
|
(ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
public Drawable getDrawable(String source) {
|
if (clipboard != null) {
|
||||||
return ImageHelper.decodeImage(getContext(), working, source, true, zoom, etBody);
|
ClipData clip = ClipData.newHtmlText(
|
||||||
}
|
getContext().getString(R.string.title_edit_signature_text),
|
||||||
}, null);
|
HtmlHelper.getText(getContext(), identity.signature),
|
||||||
|
identity.signature);
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
|
||||||
etBody.getText().insert(etBody.getSelectionStart(), sig);
|
ToastEx.makeText(getContext(), R.string.title_clipboard_copied, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue