diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-08-24 14:30:52 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-08-24 14:30:52 +0000 |
commit | 462208066adb90187e07194a995c732215b82581 (patch) | |
tree | 86015c1b73bcb4608982cb6ab74ad16993dd2871 /app/src/main/java | |
parent | 53ef74b70e445763fc50b6a1382cd8ee2dab3299 (diff) | |
download | infinity-for-reddit-462208066adb90187e07194a995c732215b82581.tar infinity-for-reddit-462208066adb90187e07194a995c732215b82581.tar.gz infinity-for-reddit-462208066adb90187e07194a995c732215b82581.tar.bz2 infinity-for-reddit-462208066adb90187e07194a995c732215b82581.tar.lz infinity-for-reddit-462208066adb90187e07194a995c732215b82581.tar.xz infinity-for-reddit-462208066adb90187e07194a995c732215b82581.tar.zst infinity-for-reddit-462208066adb90187e07194a995c732215b82581.zip |
Directly open url without checking available packages in openInBrowser in LinkResolverActivity. Replace android:tint with app:tint.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java index fcbc0608..f318c1b5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java @@ -262,7 +262,17 @@ public class LinkResolverActivity extends AppCompatActivity { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(uri); - List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0); + try { + startActivity(intent); + } catch (ActivityNotFoundException e) { + if (handleError) { + openInCustomTabs(uri, pm, false); + } else { + Toast.makeText(this, R.string.no_browser_found, Toast.LENGTH_SHORT).show(); + } + } + + /*List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0); ArrayList<String> packageNames = new ArrayList<>(); String currentPackageName = getApplicationContext().getPackageName(); @@ -289,10 +299,9 @@ public class LinkResolverActivity extends AppCompatActivity { } else { Toast.makeText(this, R.string.no_browser_found, Toast.LENGTH_SHORT).show(); } - } + }*/ } - private ArrayList<ResolveInfo> getCustomTabsPackages(PackageManager pm) { // Get default VIEW intent handler. Intent activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.example.com")); |