aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-09-22 15:41:57 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-09-22 15:41:57 +0000
commit58af3557e846687d17ace088574b9a6b9b2633e0 (patch)
tree457bf8ec569964881e6ecdbc57a65a0b4c58e100 /app/src/main/java
parentc5480bfb98a93531a4306e2cd3488aaaa2e5e859 (diff)
downloadinfinity-for-reddit-58af3557e846687d17ace088574b9a6b9b2633e0.tar
infinity-for-reddit-58af3557e846687d17ace088574b9a6b9b2633e0.tar.gz
infinity-for-reddit-58af3557e846687d17ace088574b9a6b9b2633e0.tar.bz2
infinity-for-reddit-58af3557e846687d17ace088574b9a6b9b2633e0.tar.lz
infinity-for-reddit-58af3557e846687d17ace088574b9a6b9b2633e0.tar.xz
infinity-for-reddit-58af3557e846687d17ace088574b9a6b9b2633e0.tar.zst
infinity-for-reddit-58af3557e846687d17ace088574b9a6b9b2633e0.zip
Support Chrome Custom Tabs in Android 11.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java34
1 files changed, 4 insertions, 30 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 241d47a6..9706d015 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
@@ -271,40 +271,14 @@ public class LinkResolverActivity extends AppCompatActivity {
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();
-
- for (ResolveInfo info : activities) {
- if (!info.activityInfo.packageName.equals(currentPackageName)) {
- packageNames.add(info.activityInfo.packageName);
- }
- }
-
- if (!packageNames.isEmpty()) {
- 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();
- }
- }
- } else {
- if (handleError) {
- openInCustomTabs(uri, pm, false);
- } 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"));
+ Intent activityIntent = new Intent()
+ .setAction(Intent.ACTION_VIEW)
+ .addCategory(Intent.CATEGORY_BROWSABLE)
+ .setData(Uri.fromParts("http", "", null));
// Get all apps that can handle VIEW intents.
List<ResolveInfo> resolvedActivityList = pm.queryIntentActivities(activityIntent, 0);