]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
"Share" patch from Benedikt Elser <da.boun@gmail.com>.
authorThad Hughes <thadh@google.com>
Tue, 26 Feb 2013 04:55:33 +0000 (20:55 -0800)
committerThad Hughes <thadh@google.com>
Tue, 26 Feb 2013 04:55:33 +0000 (20:55 -0800)
src/com/hughes/android/dictionary/DictionaryActivity.java

index fe0e57fb2243c767e8d62b18cba48fabd301bc64..f432a8faa7aa63ac10da5fea447e3a0c27cfd8b0 100644 (file)
@@ -787,6 +787,18 @@ public class DictionaryActivity extends ListActivity {
             }
         });
 
+        final MenuItem share = menu.add("Share");
+        share.setOnMenuItemClickListener(new OnMenuItemClickListener() {
+            public boolean onMenuItemClick(MenuItem item) {
+                Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
+                shareIntent.setType("text/plain");
+                shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, row.getTokenRow(true).getToken());
+                shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, row.getRawText(saveOnlyFirstSubentry));
+                startActivity(shareIntent);
+                return false;
+            }
+        });
+
         final MenuItem copy = menu.add(android.R.string.copy);
         copy.setOnMenuItemClickListener(new OnMenuItemClickListener() {
             public boolean onMenuItemClick(MenuItem item) {