summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/menu/browsercontext.xml2
-rw-r--r--src/com/android/browser/Controller.java12
2 files changed, 14 insertions, 0 deletions
diff --git a/res/menu/browsercontext.xml b/res/menu/browsercontext.xml
index a8ae5c8..8137a67 100644
--- a/res/menu/browsercontext.xml
+++ b/res/menu/browsercontext.xml
@@ -52,6 +52,8 @@
android:title="@string/contextmenu_view_image"/>
<item android:id="@+id/set_wallpaper_context_menu_id"
android:title="@string/contextmenu_set_wallpaper"/>
+ <item android:id="@+id/share_link_context_menu_id"
+ android:title="@string/contextmenu_sharelink"/>
</group>
<group android:id="@+id/SELECT_TEXT_MENU">
<item android:id="@+id/select_text_menu_id"
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 0b49aff..9861184 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1403,8 +1403,20 @@ public class Controller
}
// otherwise fall through to handle image part
case WebView.HitTestResult.IMAGE_TYPE:
+ MenuItem shareItem = menu.findItem(R.id.share_link_context_menu_id);
+ shareItem.setVisible(type == WebView.HitTestResult.IMAGE_TYPE);
if (type == WebView.HitTestResult.IMAGE_TYPE) {
menu.setHeaderTitle(extra);
+ shareItem.setOnMenuItemClickListener(
+ new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ sharePage(mActivity, null, extra, null,
+ null);
+ return true;
+ }
+ }
+ );
}
menu.findItem(R.id.view_image_context_menu_id)
.setOnMenuItemClickListener(new OnMenuItemClickListener() {