mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 13:48:55 +03:00
Merge branch 'master' into mihonmerge
This commit is contained in:
commit
525c4715e9
5 changed files with 68 additions and 48 deletions
|
@ -22,16 +22,18 @@ import cafe.adriel.voyager.navigator.LocalNavigator
|
|||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.presentation.more.settings.Preference
|
||||
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.WEB_VIDEO_CASTER
|
||||
import eu.kanade.tachiyomi.ui.player.X_PLAYER
|
||||
import eu.kanade.tachiyomi.ui.player.JustPlayer
|
||||
import eu.kanade.tachiyomi.ui.player.MpvKt
|
||||
import eu.kanade.tachiyomi.ui.player.MpvKtPreview
|
||||
import eu.kanade.tachiyomi.ui.player.MpvPlayer
|
||||
import eu.kanade.tachiyomi.ui.player.MpvRemote
|
||||
import eu.kanade.tachiyomi.ui.player.MxPlayer
|
||||
import eu.kanade.tachiyomi.ui.player.MxPlayerFree
|
||||
import eu.kanade.tachiyomi.ui.player.MxPlayerPro
|
||||
import eu.kanade.tachiyomi.ui.player.NextPlayer
|
||||
import eu.kanade.tachiyomi.ui.player.VlcPlayer
|
||||
import eu.kanade.tachiyomi.ui.player.WebVideoCaster
|
||||
import eu.kanade.tachiyomi.ui.player.XPlayer
|
||||
import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences
|
||||
import eu.kanade.tachiyomi.ui.player.viewer.AudioChannels
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
@ -440,14 +442,16 @@ 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,
|
||||
WEB_VIDEO_CASTER,
|
||||
MpvPlayer,
|
||||
MxPlayer,
|
||||
MxPlayerFree,
|
||||
MxPlayerPro,
|
||||
VlcPlayer,
|
||||
MpvKt,
|
||||
MpvKtPreview,
|
||||
MpvRemote,
|
||||
JustPlayer,
|
||||
NextPlayer,
|
||||
XPlayer,
|
||||
WebVideoCaster,
|
||||
)
|
||||
|
|
|
@ -170,7 +170,7 @@ class ExternalIntents {
|
|||
*/
|
||||
private fun getIntentForPackage(pkgName: String, context: Context, uri: Uri, video: Video): Intent {
|
||||
return when (pkgName) {
|
||||
WEB_VIDEO_CASTER -> webVideoCasterIntent(pkgName, context, uri, video)
|
||||
WebVideoCaster -> webVideoCasterIntent(pkgName, context, uri, video)
|
||||
else -> standardIntentForPackage(pkgName, context, uri, video)
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class ExternalIntents {
|
|||
private fun webVideoCasterIntent(pkgName: String, context: Context, uri: Uri, video: Video): Intent {
|
||||
return Intent(Intent.ACTION_VIEW).apply {
|
||||
setDataAndType(uri, "video/*")
|
||||
if (isPackageInstalled(pkgName, context.packageManager)) setPackage(WEB_VIDEO_CASTER)
|
||||
if (isPackageInstalled(pkgName, context.packageManager)) setPackage(WebVideoCaster)
|
||||
addExtrasAndFlags(true, this)
|
||||
|
||||
val headers = Bundle()
|
||||
|
@ -300,16 +300,17 @@ class ExternalIntents {
|
|||
*/
|
||||
private fun getComponent(packageName: String): ComponentName? {
|
||||
return when (packageName) {
|
||||
MPV_PLAYER -> ComponentName(packageName, "$packageName.MPVActivity")
|
||||
MX_PLAYER, MX_PLAYER_FREE, MX_PLAYER_PRO -> ComponentName(
|
||||
MpvPlayer -> ComponentName(packageName, "$packageName.MPVActivity")
|
||||
MxPlayer, MxPlayerFree, MxPlayerPro -> 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")
|
||||
VlcPlayer -> ComponentName(packageName, "$packageName.gui.video.VideoPlayerActivity")
|
||||
MpvKt, MpvKtPreview -> ComponentName(packageName, "live.mehiz.mpvkt.ui.player.PlayerActivity")
|
||||
MpvRemote -> ComponentName(packageName, "$packageName.MainActivity")
|
||||
JustPlayer -> ComponentName(packageName, "$packageName.PlayerActivity")
|
||||
NextPlayer -> ComponentName(packageName, "$packageName.feature.player.PlayerActivity")
|
||||
XPlayer -> ComponentName(packageName, "com.inshot.xplayer.activities.PlayerActivity")
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
@ -559,13 +560,15 @@ class ExternalIntents {
|
|||
}
|
||||
|
||||
// List of supported external players and their packages
|
||||
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"
|
||||
const val WEB_VIDEO_CASTER = "com.instantbits.cast.webvideo"
|
||||
const val MpvPlayer = "is.xyz.mpv"
|
||||
const val MxPlayer = "com.mxtech.videoplayer"
|
||||
const val MxPlayerFree = "com.mxtech.videoplayer.ad"
|
||||
const val MxPlayerPro = "com.mxtech.videoplayer.pro"
|
||||
const val VlcPlayer = "org.videolan.vlc"
|
||||
const val MpvKt = "live.mehiz.mpvkt"
|
||||
const val MpvKtPreview = "live.mehiz.mpvkt.preview"
|
||||
const val MpvRemote = "com.husudosu.mpvremote"
|
||||
const val JustPlayer = "com.brouken.player"
|
||||
const val NextPlayer = "dev.anilbeesetti.nextplayer"
|
||||
const val XPlayer = "video.player.videoplayer"
|
||||
const val WebVideoCaster = "com.instantbits.cast.webvideo"
|
||||
|
|
|
@ -112,6 +112,8 @@ import java.io.IOException
|
|||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.floor
|
||||
import kotlin.math.roundToInt
|
||||
import `is`.xyz.mpv.MPVView.Chapter as VideoChapter
|
||||
|
||||
|
@ -1735,6 +1737,7 @@ class PlayerActivity : BaseActivity() {
|
|||
// at void is.xyz.mpv.MPVLib.event(int) (MPVLib.java:86)
|
||||
@SuppressLint("SourceLockedOrientationActivity")
|
||||
internal suspend fun fileLoaded() {
|
||||
setMpvMediaTitle()
|
||||
val localLangName = LocaleHelper.getSimpleLocaleDisplayName()
|
||||
clearTracks()
|
||||
player.loadTracks()
|
||||
|
@ -1827,6 +1830,24 @@ class PlayerActivity : BaseActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setMpvMediaTitle() {
|
||||
val anime = viewModel.currentAnime ?: return
|
||||
val episode = viewModel.currentEpisode ?: return
|
||||
|
||||
val epNumber = episode.episode_number.let { number ->
|
||||
if (ceil(number) == floor(number)) number.toInt() else number
|
||||
}.toString().padStart(2, '0')
|
||||
|
||||
val title = stringResource(
|
||||
MR.strings.mpv_media_title,
|
||||
anime.title,
|
||||
epNumber,
|
||||
episode.name,
|
||||
)
|
||||
|
||||
MPVLib.setPropertyString("force-media-title", title)
|
||||
}
|
||||
|
||||
private var aniskipStamps: List<Stamp> = emptyList()
|
||||
|
||||
private fun updateChapters(stamps: List<Stamp>? = null, duration: Int? = null) {
|
||||
|
|
|
@ -1849,15 +1849,6 @@
|
|||
<ID>TopLevelPropertyNaming:DisplayExtensions.kt$// some tablets have screen width like 711dp = 1600px / 2.25 private const val TABLET_UI_MIN_SCREEN_WIDTH_PORTRAIT_DP = 700</ID>
|
||||
<ID>TopLevelPropertyNaming:DisplayExtensions.kt$private const val TABLET_UI_REQUIRED_SCREEN_WIDTH_DP = 720</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$// List of supported external players and their packages const val MPV_PLAYER = "is.xyz.mpv"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val JUST_PLAYER = "com.brouken.player"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val MPV_REMOTE = "com.husudosu.mpvremote"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val MX_PLAYER = "com.mxtech.videoplayer"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val MX_PLAYER_FREE = "com.mxtech.videoplayer.ad"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val MX_PLAYER_PRO = "com.mxtech.videoplayer.pro"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val NEXT_PLAYER = "dev.anilbeesetti.nextplayer"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val VLC_PLAYER = "org.videolan.vlc"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val WEB_VIDEO_CASTER = "com.instantbits.cast.webvideo"</ID>
|
||||
<ID>TopLevelPropertyNaming:ExternalIntents.kt$const val X_PLAYER = "video.player.videoplayer"</ID>
|
||||
<ID>TopLevelPropertyNaming:GLUtil.kt$// Safe minimum default size private const val IMAGE_MAX_BITMAP_DIMENSION = 2048</ID>
|
||||
<ID>TopLevelPropertyNaming:GestureHandler.kt$private const val STATE_HORIZONTAL = 1</ID>
|
||||
<ID>TopLevelPropertyNaming:GestureHandler.kt$private const val STATE_UP = 0</ID>
|
||||
|
|
|
@ -915,6 +915,7 @@
|
|||
<string name="go_to_next_chapter">Next chapter</string>
|
||||
<string name="go_to_previous_chapter">Previous chapter</string>
|
||||
<string name="go_to_after_opening">Skipped opening</string>
|
||||
<string name="mpv_media_title">%1$s - E%2$s - %3$s</string>
|
||||
<string name="pref_player_smooth_seek">Enable precise seeking</string>
|
||||
<string name="pref_player_smooth_seek_summary">When enabled, seeking will not focus on keyframes, leading to slower but precise seeking</string>
|
||||
<string name="pref_player_fullscreen">Show content in display cutout</string>
|
||||
|
|
Loading…
Reference in a new issue