diff --git a/CHANGELOG.md b/CHANGELOG.md index a92cda7c63..72bdbb9398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - `Other` - for technical stuff. ## [Unreleased] +### Fixed +- Fix player crash when opening player ([@Secozzi](https://github.com/Secozzi)) ([#170](https://github.com/quickdesh/Animiru/pull/170)) ## [v0.19.7.8] - 2026-07-07 ### Added diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt index a0e94806cf..4c3728930e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt @@ -188,7 +188,17 @@ class PlayerViewModel @JvmOverloads constructor( private val autoSkip = playerPreferences.autoSkipIntro.get() private val netflixStyle = playerPreferences.enableNetflixStyleIntroSkip.get() private val defaultWaitingTime = playerPreferences.waitingTimeIntroSkip.get() + private val leftDoubleTapGesture = gesturePreferences.leftDoubleTapGesture.get() + private val centerDoubleTapGesture = gesturePreferences.centerDoubleTapGesture.get() + private val rightDoubleTapGesture = gesturePreferences.rightDoubleTapGesture.get() + private val doubleTapToSeekDuration = gesturePreferences.skipLengthPreference.get() + private val showSeekBar = gesturePreferences.showSeekBar.get() + private val pipEpisodeToasts = playerPreferences.pipEpisodeToasts.get() + private val showStatusBar = playerPreferences.showSystemStatusBar.get() + private val downloadAheadAmount = downloadPreferences.autoDownloadWhileWatching.get() + private val progress = playerPreferences.progressPreference.get() + private val fontExtensionRegex = Regex($$""".*\.[ot]tf$""") private val maxVolume = audioManager.getMaxVolume() private val screenAspectRatio: Double by lazy { val metrics = context.resources.displayMetrics @@ -240,6 +250,9 @@ class PlayerViewModel @JvmOverloads constructor( val eventFlow = _eventFlow.asSharedFlow() private var timerJob: Job? = null + private var getHosterVideoLinksJob: Job? = null + private var episodeToDownload: Download? = null + private var currentHosterList: List? = null init { viewModelScope.launchIO { @@ -510,7 +523,6 @@ class PlayerViewModel @JvmOverloads constructor( field = value } - private val fontExtensionRegex = Regex($$""".*\.[ot]tf$""") fun fetchFonts(includeSystemFonts: Boolean): List { val fontFiles = mutableListOf() @@ -579,8 +591,6 @@ class PlayerViewModel @JvmOverloads constructor( val position: Long?, ) - private var currentHosterList: List? = null - class ExceptionWithStringResource( message: String, val stringResource: StringResource, @@ -819,8 +829,6 @@ class PlayerViewModel @JvmOverloads constructor( // === Load === - private var getHosterVideoLinksJob: Job? = null - fun cancelHosterVideoLinksJob() { getHosterVideoLinksJob?.cancel() } @@ -1657,8 +1665,6 @@ class PlayerViewModel @JvmOverloads constructor( } } - private val pipEpisodeToasts = playerPreferences.pipEpisodeToasts.get() - /** * Load next or previous episode */ @@ -1757,7 +1763,6 @@ class PlayerViewModel @JvmOverloads constructor( updatePlaybackData { it.copy(paused = false) } } - private val showStatusBar = playerPreferences.showSystemStatusBar.get() fun showControls() { val currentUi = uiData.value if (currentUi.sheetShown != Sheets.None || @@ -2071,12 +2076,6 @@ class PlayerViewModel @JvmOverloads constructor( // === Seeking === - private val leftDoubleTapGesture = gesturePreferences.leftDoubleTapGesture.get() - private val centerDoubleTapGesture = gesturePreferences.centerDoubleTapGesture.get() - private val rightDoubleTapGesture = gesturePreferences.rightDoubleTapGesture.get() - private val doubleTapToSeekDuration = gesturePreferences.skipLengthPreference.get() - private val showSeekBar = gesturePreferences.showSeekBar.get() - fun updateGestureSeekAmount(value: Pair?) { updatePlaybackData { it.copy(gestureSeekAmount = value) } } @@ -2241,8 +2240,6 @@ class PlayerViewModel @JvmOverloads constructor( super.onCleared() } - private val progress = playerPreferences.progressPreference.get() - /** * Called every time a second is reached in the player. Used to mark the flag of episode being * seen, update tracking services, enqueue downloaded episode deletion and download next episode. @@ -2411,9 +2408,6 @@ class PlayerViewModel @JvmOverloads constructor( } } - private var episodeToDownload: Download? = null - private val downloadAheadAmount = downloadPreferences.autoDownloadWhileWatching.get() - private fun downloadNextEpisodes() { if (downloadAheadAmount == 0) return val anime = stateData.value.currentAnime ?: return