Fixed edit text plain

pull/184/head
M66B 4 years ago
parent 661f2e3732
commit f10b2fd3c4

@ -45,13 +45,14 @@ public class EditTextPlain extends FixedEditText {
ClipboardManager cbm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
if (cbm != null && cbm.hasPrimaryClip()) {
ClipData data = cbm.getPrimaryClip();
ClipData.Item item = data.getItemAt(0);
CharSequence text = item.coerceToText(context);
data = ClipData.newPlainText("coerced_plain_text", text);
ClipData.Item item = (data == null ? null : data.getItemAt(0));
CharSequence text = (item == null ? null : item.coerceToText(context));
if (text != null) {
data = ClipData.newPlainText("coerced_plain_text", text.toString());
cbm.setPrimaryClip(data);
}
}
}
return super.onTextContextMenuItem(id);
} catch (Throwable ex) {

Loading…
Cancel
Save