diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsPlayerScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsPlayerScreen.kt index daa7400001..c053c116f1 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsPlayerScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsPlayerScreen.kt @@ -24,6 +24,15 @@ import eu.kanade.domain.base.BasePreferences import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.util.collectAsState import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.ui.player.JUST_PLAYER +import eu.kanade.tachiyomi.ui.player.MPV_PLAYER +import eu.kanade.tachiyomi.ui.player.MPV_REMOTE +import eu.kanade.tachiyomi.ui.player.MX_PLAYER +import eu.kanade.tachiyomi.ui.player.MX_PLAYER_FREE +import eu.kanade.tachiyomi.ui.player.MX_PLAYER_PRO +import eu.kanade.tachiyomi.ui.player.NEXT_PLAYER +import eu.kanade.tachiyomi.ui.player.VLC_PLAYER +import eu.kanade.tachiyomi.ui.player.X_PLAYER import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences import eu.kanade.tachiyomi.util.preference.asState import tachiyomi.presentation.core.components.WheelTextPicker @@ -305,17 +314,8 @@ object SettingsPlayerScreen : SearchableSettings { val pm = basePreferences.context.packageManager val installedPackages = pm.getInstalledPackages(0) - val supportedPlayers = installedPackages.filter { - when (it.packageName) { - "is.xyz.mpv" -> true - "com.mxtech.videoplayer" -> true - "com.mxtech.videoplayer.ad" -> true - "com.mxtech.videoplayer.pro" -> true - "org.videolan.vlc" -> true - "com.husudosu.mpvremote" -> true - else -> false - } - } + val supportedPlayers = installedPackages.filter { it.packageName in externalPlayers } + val packageNames = supportedPlayers.map { it.packageName } val packageNamesReadable = supportedPlayers .map { pm.getApplicationLabel(it.applicationInfo).toString() } @@ -384,3 +384,15 @@ object SettingsPlayerScreen : SearchableSettings { ) } } + +val externalPlayers = listOf( + MPV_PLAYER, + MX_PLAYER, + MX_PLAYER_FREE, + MX_PLAYER_PRO, + VLC_PLAYER, + MPV_REMOTE, + JUST_PLAYER, + NEXT_PLAYER, + X_PLAYER, +) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt index 51b80daf5b..7bdb99e201 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt @@ -260,9 +260,12 @@ class ExternalIntents { private fun getComponent(packageName: String): ComponentName? { return when (packageName) { MPV_PLAYER -> ComponentName(packageName, "$packageName.MPVActivity") - MX_PLAYER_FREE, MX_PLAYER_PRO -> ComponentName(packageName, "$packageName.ActivityScreen") + MX_PLAYER, MX_PLAYER_FREE, MX_PLAYER_PRO -> ComponentName(packageName, "$packageName.ActivityScreen") VLC_PLAYER -> ComponentName(packageName, "$packageName.gui.video.VideoPlayerActivity") MPV_REMOTE -> ComponentName(packageName, "$packageName.MainActivity") + JUST_PLAYER -> ComponentName(packageName, "$packageName.PlayerActivity") + NEXT_PLAYER -> ComponentName(packageName, "$packageName.feature.player.PlayerActivity") + X_PLAYER -> ComponentName(packageName, "com.inshot.xplayer.activities.PlayerActivity") else -> null } } @@ -285,7 +288,6 @@ class ExternalIntents { /** * Saves the episode's data based on whats returned by the external player. * - * @param resultCode the code sent to ensure that the returned [intent] is valid. * @param intent the [Intent] that contains the episode's position and duration. */ @OptIn(DelicateCoroutinesApi::class) @@ -496,8 +498,12 @@ class ExternalIntents { } // List of supported external players and their packages -private const val MPV_PLAYER = "is.xyz.mpv" -private const val MX_PLAYER_FREE = "com.mxtech.videoplayer.ad" -private const val MX_PLAYER_PRO = "com.mxtech.videoplayer.pro" -private const val VLC_PLAYER = "org.videolan.vlc" -private const val MPV_REMOTE = "com.husudosu.mpvremote" +const val MPV_PLAYER = "is.xyz.mpv" +const val MX_PLAYER = "com.mxtech.videoplayer" +const val MX_PLAYER_FREE = "com.mxtech.videoplayer.ad" +const val MX_PLAYER_PRO = "com.mxtech.videoplayer.pro" +const val VLC_PLAYER = "org.videolan.vlc" +const val MPV_REMOTE = "com.husudosu.mpvremote" +const val JUST_PLAYER = "com.brouken.player" +const val NEXT_PLAYER = "dev.anilbeesetti.nextplayer" +const val X_PLAYER = "video.player.videoplayer"