Luke Plant avatar Luke Plant committed f000a5d

Replaced 'Copy URL' with 'Share URL' action

Comments (0)

Files changed (4)

 1.5
 ---
 * Made menu visible on newer Android phones
-* Added "Copy page address" menu item
+* Added "Share URL" menu item
 
 1.4
 ---

gen/net/learnscripture/webviewapp/R.java

     }
     public static final class id {
         public static final int contact_menuitem=0x7f080006;
-        public static final int copy_url_menuitem=0x7f080007;
         public static final int dashboard_menuitem=0x7f080003;
         public static final int fullscreen_content_controls=0x7f080000;
         public static final int preferences_menuitem=0x7f080005;
         public static final int progressbar=0x7f080001;
         public static final int refresh_menuitem=0x7f080004;
+        public static final int share_url_menuitem=0x7f080007;
         public static final int web_engine=0x7f080002;
     }
     public static final class layout {

res/menu/main_menu.xml

     <item android:id="@+id/refresh_menuitem" android:title="Refresh"></item>
     <item android:id="@+id/preferences_menuitem" android:title="Preferences"></item>
     <item android:id="@+id/contact_menuitem" android:title="Contact"></item>
-    <item android:id="@+id/copy_url_menuitem" android:title="Copy page address"></item>
+    <item android:id="@+id/share_url_menuitem" android:title="Share URL"></item>
 </menu>

src/net/learnscripture/webviewapp/Dashboard.java

 import android.net.MailTo;
 import android.net.Uri;
 import android.os.Bundle;
-import android.text.ClipboardManager;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 		case R.id.contact_menuitem:
 			getEngine().loadUrl(CONTACT_URL);
 			return true;
-		case R.id.copy_url_menuitem:
+		case R.id.share_url_menuitem:
 			final String url = (jsInterface.urlForSharing != null
 								? jsInterface.urlForSharing
 								: getEngine().getUrl());
-			((ClipboardManager) getSystemService(CLIPBOARD_SERVICE)).setText(url);
-			Toast.makeText(getApplicationContext(), "Page address copied", Toast.LENGTH_SHORT).show();
+			Intent i = new Intent(Intent.ACTION_SEND);
+			i.setType("text/plain");
+			i.putExtra(Intent.EXTRA_SUBJECT, "LearnScripture URL");
+			i.putExtra(Intent.EXTRA_TEXT, url);
+			startActivity(Intent.createChooser(i, "Share URL"));
 		default:
 			return super.onOptionsItemSelected(item);
 		}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.