mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Support Chrome Custom Tabs in Android 11.
This commit is contained in:
parent
c5480bfb98
commit
58af3557e8
@ -3,6 +3,13 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="ml.docilealligator.infinityforreddit">
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name=
|
||||
"android.support.customtabs.action.CustomTabsService" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user