コード例 #1
0
 private boolean canPaste() {
   ClipboardManagerCompat clip = ClipboardManagerCompatFactory.getManager(getApplicationContext());
   if (clip.hasText()) {
     return true;
   }
   return false;
 }
コード例 #2
0
 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());
 }
コード例 #3
0
 private void doCopyAll() {
   ClipboardManagerCompat clip = ClipboardManagerCompatFactory.getManager(getApplicationContext());
   clip.setText(getCurrentTermSession().getTranscriptText().trim());
 }