From 5559df14a539b8cf605d772735ab738bb00bcbd6 Mon Sep 17 00:00:00 2001 From: jmir1 Date: Mon, 17 May 2021 12:26:45 +0200 Subject: [PATCH] fix episode being marked as seen when exiting... ...before the full episode length was loaded --- .../eu/kanade/tachiyomi/ui/anime/AnimeController.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/anime/AnimeController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/anime/AnimeController.kt index 094bcc579..d8f09cca7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/anime/AnimeController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/anime/AnimeController.kt @@ -639,12 +639,14 @@ class AnimeController : presenter.editCover(anime!!, activity, dataUri) } if (requestCode == REQUEST_SECONDS) { - val seconds = data!!.getLongExtra("seconds_result", 0) - val totalSeconds = data.getLongExtra("total_seconds_result", 0) + val seconds = data!!.getLongExtra("seconds_result", 0L) + val totalSeconds = data.getLongExtra("total_seconds_result", 0L) val episode: Episode = data.getSerializableExtra("episode") as Episode - episode.last_second_seen = seconds - episode.total_seconds = totalSeconds - presenter.setEpisodesProgress(arrayListOf(EpisodeItem(episode, anime!!))) + if (totalSeconds > 0L) { + episode.last_second_seen = seconds + episode.total_seconds = totalSeconds + presenter.setEpisodesProgress(arrayListOf(EpisodeItem(episode, anime!!))) + } // if next or previous episode was pressed if (data.getBooleanExtra("nextResult", false)) { val episodeList = presenter.episodes.sortedWith(presenter.getEpisodeSort())