Minor bugs related to Custom Tabs fixed. Support more reddit domains.

This commit is contained in:
Alex Ning 2019-08-05 17:44:00 +08:00
parent 7761d38756
commit 5bb9cf7891
2 changed files with 14 additions and 2 deletions

View File

@ -38,6 +38,15 @@
<data <data
android:host="www.reddit.com" android:host="www.reddit.com"
android:scheme="https" /> android:scheme="https" />
<data
android:host="reddit.com"
android:scheme="https" />
<data
android:host="amp.reddit.com"
android:scheme="https" />
<data
android:host="m.reddit.com"
android:scheme="https" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity

View File

@ -40,8 +40,11 @@ public class CustomMarkwonView extends MarkwonView {
builder.addDefaultShareMenuItem(); builder.addDefaultShareMenuItem();
builder.setToolbarColor(context.getResources().getColor(R.color.colorPrimary)); builder.setToolbarColor(context.getResources().getColor(R.color.colorPrimary));
CustomTabsIntent customTabsIntent = builder.build(); CustomTabsIntent customTabsIntent = builder.build();
Uri uri = Uri.parse(link);
if(uri.getHost() != null && uri.getHost().equals("www.reddit.com")) {
customTabsIntent.intent.setPackage(context.getPackageName()); customTabsIntent.intent.setPackage(context.getPackageName());
customTabsIntent.launchUrl(context, Uri.parse(link)); }
customTabsIntent.launchUrl(context, uri);
} }
}).build(); }).build();