From 462208066adb90187e07194a995c732215b82581 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 24 Aug 2020 22:30:52 +0800 Subject: [PATCH] Directly open url without checking available packages in openInBrowser in LinkResolverActivity. Replace android:tint with app:tint. --- .../Activity/LinkResolverActivity.java | 15 ++++++++++++--- .../layout/fragment_theme_preview_comments.xml | 4 ---- .../res/layout/fragment_theme_preview_posts.xml | 2 +- app/src/main/res/layout/item_comment.xml | 2 -- app/src/main/res/layout/item_flair.xml | 3 ++- app/src/main/res/layout/item_post_compact.xml | 2 +- .../layout/item_post_compact_right_thumbnail.xml | 2 +- .../main/res/layout/item_post_detail_gallery.xml | 3 --- .../item_post_detail_image_and_gif_autoplay.xml | 3 --- app/src/main/res/layout/item_post_detail_link.xml | 3 --- .../layout/item_post_detail_no_preview_link.xml | 6 ++---- app/src/main/res/layout/item_post_detail_text.xml | 3 --- .../item_post_detail_video_and_gif_preview.xml | 3 --- .../layout/item_post_detail_video_autoplay.xml | 3 --- app/src/main/res/layout/item_post_gallery.xml | 2 +- .../main/res/layout/item_post_no_preview_link.xml | 2 +- 16 files changed, 21 insertions(+), 37 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 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 activities = pm.queryIntentActivities(intent, 0); ArrayList 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 getCustomTabsPackages(PackageManager pm) { // Get default VIEW intent handler. Intent activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.example.com")); diff --git a/app/src/main/res/layout/fragment_theme_preview_comments.xml b/app/src/main/res/layout/fragment_theme_preview_comments.xml index 69e8d7f3..c810b949 100644 --- a/app/src/main/res/layout/fragment_theme_preview_comments.xml +++ b/app/src/main/res/layout/fragment_theme_preview_comments.xml @@ -145,7 +145,6 @@ android:clickable="true" android:focusable="true" android:src="@drawable/ic_arrow_downward_grey_24dp" - android:tint="@android:color/tab_indicator_text" app:layout_constraintStart_toEndOf="@+id/score_text_view_theme_preview_comments_fragment" app:layout_constraintEnd_toStartOf="@id/more_button_theme_preview_comments_fragment" app:layout_constraintTop_toTopOf="parent" @@ -176,7 +175,6 @@ android:clickable="true" android:focusable="true" android:src="@drawable/ic_expand_less_grey_24dp" - android:tint="@android:color/tab_indicator_text" app:layout_constraintEnd_toStartOf="@+id/save_button_theme_preview_comments_fragment" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> @@ -354,7 +352,6 @@ android:clickable="true" android:focusable="true" android:src="@drawable/ic_arrow_downward_grey_24dp" - android:tint="@android:color/tab_indicator_text" app:layout_constraintStart_toEndOf="@+id/score_text_view_award_background_theme_preview_comments_fragment" app:layout_constraintEnd_toStartOf="@id/more_button_award_background_theme_preview_comments_fragment" app:layout_constraintTop_toTopOf="parent" @@ -385,7 +382,6 @@ android:clickable="true" android:focusable="true" android:src="@drawable/ic_expand_less_grey_24dp" - android:tint="@android:color/tab_indicator_text" app:layout_constraintEnd_toStartOf="@+id/save_button_award_background_theme_preview_comments_fragment" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> diff --git a/app/src/main/res/layout/fragment_theme_preview_posts.xml b/app/src/main/res/layout/fragment_theme_preview_posts.xml index 7e384540..05c32376 100644 --- a/app/src/main/res/layout/fragment_theme_preview_posts.xml +++ b/app/src/main/res/layout/fragment_theme_preview_posts.xml @@ -233,7 +233,7 @@ android:layout_height="150dp" android:scaleType="center" android:src="@drawable/ic_link" - android:tint="@android:color/tab_indicator_text" /> + app:tint="@android:color/tab_indicator_text" /> @@ -23,7 +24,7 @@ android:layout_marginStart="32dp" android:src="@drawable/ic_outline_edit_24px" android:visibility="gone" - android:tint="?attr/primaryTextColor" + app:tint="?attr/primaryTextColor" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" /> diff --git a/app/src/main/res/layout/item_post_compact.xml b/app/src/main/res/layout/item_post_compact.xml index a5943b69..54f1f34d 100644 --- a/app/src/main/res/layout/item_post_compact.xml +++ b/app/src/main/res/layout/item_post_compact.xml @@ -266,7 +266,7 @@ android:layout_height="72dp" android:scaleType="center" android:src="@drawable/ic_link" - android:tint="@android:color/tab_indicator_text" /> + app:tint="@android:color/tab_indicator_text" /> diff --git a/app/src/main/res/layout/item_post_compact_right_thumbnail.xml b/app/src/main/res/layout/item_post_compact_right_thumbnail.xml index 0458c12b..92a8c4c5 100644 --- a/app/src/main/res/layout/item_post_compact_right_thumbnail.xml +++ b/app/src/main/res/layout/item_post_compact_right_thumbnail.xml @@ -134,7 +134,7 @@ android:layout_height="72dp" android:scaleType="center" android:src="@drawable/ic_link" - android:tint="@android:color/tab_indicator_text" /> + app:tint="@android:color/tab_indicator_text" /> diff --git a/app/src/main/res/layout/item_post_detail_gallery.xml b/app/src/main/res/layout/item_post_detail_gallery.xml index 1de319c2..321a7638 100644 --- a/app/src/main/res/layout/item_post_detail_gallery.xml +++ b/app/src/main/res/layout/item_post_detail_gallery.xml @@ -254,7 +254,6 @@ android:layout_height="wrap_content" android:padding="12dp" android:src="@drawable/ic_arrow_upward_grey_24dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -280,7 +279,6 @@ android:layout_height="wrap_content" android:padding="12dp" android:src="@drawable/ic_arrow_downward_grey_24dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -308,7 +306,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="12dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" diff --git a/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml b/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml index add4082f..2d3e70f0 100644 --- a/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml +++ b/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml @@ -245,7 +245,6 @@ android:layout_height="wrap_content" android:padding="12dp" android:src="@drawable/ic_arrow_upward_grey_24dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -271,7 +270,6 @@ android:layout_height="wrap_content" android:padding="12dp" android:src="@drawable/ic_arrow_downward_grey_24dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -299,7 +297,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="12dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" diff --git a/app/src/main/res/layout/item_post_detail_link.xml b/app/src/main/res/layout/item_post_detail_link.xml index 27a3f407..9266e19e 100644 --- a/app/src/main/res/layout/item_post_detail_link.xml +++ b/app/src/main/res/layout/item_post_detail_link.xml @@ -255,7 +255,6 @@ android:layout_height="wrap_content" android:padding="12dp" android:src="@drawable/ic_arrow_upward_grey_24dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -281,7 +280,6 @@ android:layout_height="wrap_content" android:padding="12dp" android:src="@drawable/ic_arrow_downward_grey_24dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" @@ -309,7 +307,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="12dp" - android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" diff --git a/app/src/main/res/layout/item_post_detail_no_preview_link.xml b/app/src/main/res/layout/item_post_detail_no_preview_link.xml index 99f5ad0b..7b6d5778 100644 --- a/app/src/main/res/layout/item_post_detail_no_preview_link.xml +++ b/app/src/main/res/layout/item_post_detail_no_preview_link.xml @@ -218,7 +218,8 @@ android:layout_width="match_parent" android:layout_height="150dp" android:scaleType="center" - android:src="@drawable/ic_link" /> + android:src="@drawable/ic_link" + app:tint="@android:color/tab_indicator_text" /> + app:tint="@android:color/tab_indicator_text" />