private boolean canPaste() { ClipboardManagerCompat clip = ClipboardManagerCompatFactory.getManager(getApplicationContext()); if (clip.hasText()) { return true; } return false; }
private void doPaste() { if (!canPaste()) { return; } ClipboardManagerCompat clip = ClipboardManagerCompatFactory.getManager(getApplicationContext()); CharSequence paste = clip.getText(); byte[] utf8; try { utf8 = paste.toString().getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { Log.e(TermDebug.LOG_TAG, "UTF-8 encoding not found."); return; } getCurrentTermSession().write(paste.toString()); }
private void doCopyAll() { ClipboardManagerCompat clip = ClipboardManagerCompatFactory.getManager(getApplicationContext()); clip.setText(getCurrentTermSession().getTranscriptText().trim()); }