diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-08-15 08:25:20 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-08-15 08:25:20 +0000 |
commit | 2c6ca51e5c772f30490a35bf73305b43eef91b56 (patch) | |
tree | a4f531938c172bb1776811f217799be0ec33a224 /app/src/main/java/CustomView | |
parent | 478b85e67b1798ab6b0bdc4392785c40fe1c1307 (diff) | |
download | infinity-for-reddit-2c6ca51e5c772f30490a35bf73305b43eef91b56.tar infinity-for-reddit-2c6ca51e5c772f30490a35bf73305b43eef91b56.tar.gz infinity-for-reddit-2c6ca51e5c772f30490a35bf73305b43eef91b56.tar.bz2 infinity-for-reddit-2c6ca51e5c772f30490a35bf73305b43eef91b56.tar.lz infinity-for-reddit-2c6ca51e5c772f30490a35bf73305b43eef91b56.tar.xz infinity-for-reddit-2c6ca51e5c772f30490a35bf73305b43eef91b56.tar.zst infinity-for-reddit-2c6ca51e5c772f30490a35bf73305b43eef91b56.zip |
Handle invalid uri when opening in Custom Tabs.
Diffstat (limited to 'app/src/main/java/CustomView')
-rw-r--r-- | app/src/main/java/CustomView/CustomMarkwonView.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/java/CustomView/CustomMarkwonView.java b/app/src/main/java/CustomView/CustomMarkwonView.java index da6b2f55..d5828f13 100644 --- a/app/src/main/java/CustomView/CustomMarkwonView.java +++ b/app/src/main/java/CustomView/CustomMarkwonView.java @@ -44,7 +44,11 @@ public class CustomMarkwonView extends MarkwonView { if(uri.getHost() != null && uri.getHost().contains("reddit.com")) { customTabsIntent.intent.setPackage(context.getPackageName()); } - customTabsIntent.launchUrl(context, uri); + String uriString = uri.toString(); + if(!uriString.startsWith("http://") && (!uriString.startsWith("https://"))) { + uriString = "http://" + uriString; + } + customTabsIntent.launchUrl(context, Uri.parse(uriString)); } }).build(); |