diff --git a/app/src/main/java/com/franckrj/respawnirc/WebBrowserActivity.java b/app/src/main/java/com/franckrj/respawnirc/WebBrowserActivity.java index 82c5866a..49f22e35 100644 --- a/app/src/main/java/com/franckrj/respawnirc/WebBrowserActivity.java +++ b/app/src/main/java/com/franckrj/respawnirc/WebBrowserActivity.java @@ -152,6 +152,10 @@ public boolean onOptionsItemSelected(MenuItem item) { return true; case R.id.action_reload_page_webbrowser: browserWebView.reload(); + return true; + case R.id.action_share_url_webbrowser: + Utils.shareThisLink(currentUrl, this); + return true; default: return super.onOptionsItemSelected(item); } diff --git a/app/src/main/java/com/franckrj/respawnirc/dialogs/LinkMenuDialogFragment.java b/app/src/main/java/com/franckrj/respawnirc/dialogs/LinkMenuDialogFragment.java index 6f683446..ff3dd6e7 100644 --- a/app/src/main/java/com/franckrj/respawnirc/dialogs/LinkMenuDialogFragment.java +++ b/app/src/main/java/com/franckrj/respawnirc/dialogs/LinkMenuDialogFragment.java @@ -17,6 +17,7 @@ public class LinkMenuDialogFragment extends DialogFragment { private static final int POS_OPEN_IN_WEB_BROWSER = 0; private static final int POS_OPEN_IN_INTERN_BROWSER = 1; private static final int POS_COPY = 2; + private static final int POS_SHARE_URL = 3; private String urlOfLink; @@ -33,25 +34,26 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { } builder.setTitle(urlOfLink); - builder.setItems(R.array.choicesForLinkMenu, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (getActivity() != null) { - switch (which) { - case POS_OPEN_IN_WEB_BROWSER: - Utils.openLinkInExternalBrowser(urlOfLink, getActivity()); - break; - case POS_OPEN_IN_INTERN_BROWSER: - Utils.openLinkInInternalBrowser(urlOfLink, getActivity()); - break; - case POS_COPY: - Utils.putStringInClipboard(urlOfLink, getActivity()); - Toast.makeText(getActivity(), R.string.copyDone, Toast.LENGTH_SHORT).show(); - break; - } + builder.setItems(R.array.choicesForLinkMenu, (dialog, which) -> { + if (getActivity() != null) { + switch (which) { + case POS_OPEN_IN_WEB_BROWSER: + Utils.openLinkInExternalBrowser(urlOfLink, getActivity()); + break; + case POS_OPEN_IN_INTERN_BROWSER: + Utils.openLinkInInternalBrowser(urlOfLink, getActivity()); + break; + case POS_COPY: + Utils.putStringInClipboard(urlOfLink, getActivity()); + Toast.makeText(getActivity(), R.string.copyDone, Toast.LENGTH_SHORT).show(); + break; + case POS_SHARE_URL: + Utils.shareThisLink(urlOfLink, getActivity()); + break; + } - dialog.dismiss(); } + dialog.dismiss(); }); return builder.create(); diff --git a/app/src/main/res/menu/menu_webbrowser.xml b/app/src/main/res/menu/menu_webbrowser.xml index 2d3a7e8e..aca851d9 100644 --- a/app/src/main/res/menu/menu_webbrowser.xml +++ b/app/src/main/res/menu/menu_webbrowser.xml @@ -10,4 +10,7 @@ + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e1f3257b..b1eac09b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -329,6 +329,7 @@ @string/openInExternalBrowser @string/openInInternBrowser @string/copy + @string/share @string/openCDV