That fuck shit the fascists are using
1package org.tm.archive.util;
2
3
4import android.content.ComponentName;
5import android.content.Context;
6import android.content.Intent;
7import android.content.pm.LabeledIntent;
8import android.content.pm.PackageManager;
9import android.content.pm.ResolveInfo;
10import android.widget.Toast;
11
12import androidx.annotation.NonNull;
13import androidx.annotation.Nullable;
14import androidx.annotation.StringRes;
15
16import java.util.List;
17import java.util.function.Consumer;
18
19public class IntentUtils {
20
21 public static boolean isResolvable(@NonNull Context context, @NonNull Intent intent) {
22 List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentActivities(intent, 0);
23 return resolveInfoList != null && resolveInfoList.size() > 1;
24 }
25
26 /**
27 * From: <a href="https://stackoverflow.com/a/12328282">https://stackoverflow.com/a/12328282</a>
28 */
29 public static @Nullable LabeledIntent getLabelintent(@NonNull Context context, @NonNull Intent origIntent, int name, int drawable) {
30 PackageManager pm = context.getPackageManager();
31 ComponentName launchName = origIntent.resolveActivity(pm);
32
33 if (launchName != null) {
34 Intent resolved = new Intent();
35 resolved.setComponent(launchName);
36 resolved.setData(origIntent.getData());
37
38 return new LabeledIntent(resolved, context.getPackageName(), name, drawable);
39 }
40 return null;
41 }
42}