From aaa3e91b821254bfa35ee2fec4c54863c2a129e0 Mon Sep 17 00:00:00 2001 From: Giovanni Palmieri Date: Sat, 15 Jan 2022 05:25:07 +0100 Subject: added "Open in browser" button to internal browser (#622) --- .../infinityforreddit/activities/WebViewActivity.java | 9 +++++++++ app/src/main/res/menu/web_view_activity.xml | 5 +++++ app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 16 insertions(+) (limited to 'app') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java index 50bc0819..37ac9b9b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java @@ -8,6 +8,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; +import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.InflateException; @@ -149,6 +150,14 @@ public class WebViewActivity extends BaseActivity { Toast.makeText(this, R.string.copy_link_failed, Toast.LENGTH_SHORT).show(); } return true; + } else if (item.getItemId() == R.id.action_open_external_browser_web_view_activity) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(url)); + startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(this, R.string.no_activity_found_for_external_browser, Toast.LENGTH_SHORT).show(); + } } return false; } diff --git a/app/src/main/res/menu/web_view_activity.xml b/app/src/main/res/menu/web_view_activity.xml index 217c6ca0..662bd4d4 100644 --- a/app/src/main/res/menu/web_view_activity.xml +++ b/app/src/main/res/menu/web_view_activity.xml @@ -18,4 +18,9 @@ android:orderInCategory="3" android:title="@string/action_copy_link" app:showAsAction="never" /> + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a82d844d..9a04f2e2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -86,6 +86,7 @@ Add to Multireddit Share Link Copy Link + Open in browser Add to Post Filter Delete Logs Share RPAN Link @@ -277,6 +278,7 @@ All Time There is no app that can handle the share action + There is no app that can handle the open in external browser action Archived post. Vote unavailable. Archived post. Comment unavailable. -- cgit v1.2.3