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
android:host="www.reddit.com"
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>
</activity>
<activity

View File

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