diff options
Diffstat (limited to 'app/src/main/java')
-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")); |