aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGiovanni Palmieri <gianni00palmieri@gmail.com>2022-01-15 04:25:07 +0000
committerGitHub <noreply@github.com>2022-01-15 04:25:07 +0000
commitaaa3e91b821254bfa35ee2fec4c54863c2a129e0 (patch)
tree0d18e6ff2c2eca543b64d0a5b9d7aa932ad8f2a8 /app
parentaf3447419a361071c7d0719da3c2c5dcd9bc6e68 (diff)
downloadinfinity-for-reddit-aaa3e91b821254bfa35ee2fec4c54863c2a129e0.tar
infinity-for-reddit-aaa3e91b821254bfa35ee2fec4c54863c2a129e0.tar.gz
infinity-for-reddit-aaa3e91b821254bfa35ee2fec4c54863c2a129e0.tar.bz2
infinity-for-reddit-aaa3e91b821254bfa35ee2fec4c54863c2a129e0.tar.lz
infinity-for-reddit-aaa3e91b821254bfa35ee2fec4c54863c2a129e0.tar.xz
infinity-for-reddit-aaa3e91b821254bfa35ee2fec4c54863c2a129e0.tar.zst
infinity-for-reddit-aaa3e91b821254bfa35ee2fec4c54863c2a129e0.zip
added "Open in browser" button to internal browser (#622)
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java9
-rw-r--r--app/src/main/res/menu/web_view_activity.xml5
-rw-r--r--app/src/main/res/values/strings.xml2
3 files changed, 16 insertions, 0 deletions
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" />
+ <item
+ android:id="@+id/action_open_external_browser_web_view_activity"
+ android:orderInCategory="4"
+ android:title="@string/action_open_external_browser"
+ app:showAsAction="never" />
</menu> \ 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 @@
<string name="action_add_to_multireddit">Add to Multireddit</string>
<string name="action_share_link">Share Link</string>
<string name="action_copy_link">Copy Link</string>
+ <string name="action_open_external_browser">Open in browser</string>
<string name="action_add_to_post_filter">Add to Post Filter</string>
<string name="action_delete_logs">Delete Logs</string>
<string name="action_share_rpan_link">Share RPAN Link</string>
@@ -277,6 +278,7 @@
<string name="sort_time_all_time">All Time</string>
<string name="no_activity_found_for_share">There is no app that can handle the share action</string>
+ <string name="no_activity_found_for_external_browser">There is no app that can handle the open in external browser action</string>
<string name="archived_post_vote_unavailable">Archived post. Vote unavailable.</string>
<string name="archived_post_comment_unavailable">Archived post. Comment unavailable.</string>