feat(YouTube): Add Override 'Open in YouTube Music' button patch

Co-authored-by: ILoveOpenSourceApplications <117499019+iloveopensourceapplications@users.noreply.github.com>
This commit is contained in:
oSumAtrIX 2026-03-08 22:39:22 +01:00
parent bc08ecf785
commit 8c2445f92f
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
6 changed files with 230 additions and 4 deletions

View file

@ -373,6 +373,29 @@ public class Utils {
return getContext().getResources().getStringArray(getResourceIdentifierOrThrow(ResourceType.ARRAY, resourceIdentifierName));
}
/**
* Checks if a specific app package is installed and enabled on the device.
*
* @param packageName The application package name to check (e.g., "app.morphe.android.apps.youtube.music").
* @return True if the package is installed and enabled, false otherwise.
*/
public static boolean isPackageEnabled(String packageName) {
Context context = getContext();
if (context == null || !isNotEmpty(packageName)) {
return false;
}
try {
PackageManager pm = context.getPackageManager();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
return pm.getApplicationInfo(packageName, PackageManager.ApplicationInfoFlags.of(0)).enabled;
} else {
return pm.getApplicationInfo(packageName, 0).enabled;
}
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
public interface MatchFilter<T> {
boolean matches(T object);
}