From 7ed16ed33af878fd90f034aa66e5f95e643fe747 Mon Sep 17 00:00:00 2001 From: "Silas S. Brown" <ssb22@cam.ac.uk> Date: Wed, 15 Feb 2017 09:39:01 +0000 Subject: [PATCH] Update Annotator Generator git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/adjuster@2714 29193198-4895-4776-b068-10539e920549 --- annogen.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/annogen.py b/annogen.py index 123fa9d..95d9f24 100755 --- a/annogen.py +++ b/annogen.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -program_name = "Annotator Generator v0.621 (c) 2012-17 Silas S. Brown" +program_name = "Annotator Generator v0.622 (c) 2012-17 Silas S. Brown" # See http://people.ds.cam.ac.uk/ssb22/adjuster/annogen.html @@ -1202,7 +1202,16 @@ public class MainActivity extends Activity { public void run() { android.app.AlertDialog.Builder d = new android.app.AlertDialog.Builder(act); d.setTitle(tt); d.setMessage(aa); - d.setNegativeButton("OK", null); // or can just click outside the dialog to clear. (TODO: would be nice if it could pop up somewhere near the word that was touched) + d.setNegativeButton("Copy",new android.content.DialogInterface.OnClickListener() { + @android.annotation.TargetApi(11) + public void onClick(android.content.DialogInterface dialog,int id) { + String text=tt+" "+aa; + if(Integer.valueOf(android.os.Build.VERSION.SDK) < android.os.Build.VERSION_CODES.HONEYCOMB) // SDK_INT requires API 4 but this works on API 1 + ((android.text.ClipboardManager)getSystemService(android.content.Context.CLIPBOARD_SERVICE)).setText(text); + else ((android.content.ClipboardManager)getSystemService(android.content.Context.CLIPBOARD_SERVICE)).setPrimaryClip(android.content.ClipData.newPlainText(text,text)); + } + }); + d.setPositiveButton("OK", null); // or can just click outside the dialog to clear. (TODO: would be nice if it could pop up somewhere near the word that was touched) d.create().show(); } } -- GitLab