feat: progress for starting manga (#245)
The caveat is that the user must have disabled updating each title individually, along with the other standard checks. This will only apply when a chapter has not been completed.
This commit is contained in:
parent
8177dfdcef
commit
c054e2f2ac
10 changed files with 133 additions and 7 deletions
|
@ -1854,17 +1854,23 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
|||
|
||||
private fun updateAniProgress() {
|
||||
val incognito: Boolean = PrefManager.getVal(PrefName.Incognito)
|
||||
if (!incognito && exoPlayer.currentPosition / episodeLength > PrefManager.getVal<Float>(
|
||||
PrefName.WatchPercentage
|
||||
) && Anilist.userid != null
|
||||
val episodeEnd = exoPlayer.currentPosition / episodeLength > PrefManager.getVal<Float>(
|
||||
PrefName.WatchPercentage
|
||||
)
|
||||
val episode0 = currentEpisodeIndex == 0 && PrefManager.getVal(PrefName.ChapterZeroPlayer)
|
||||
if (!incognito && (episodeEnd || episode0) && Anilist.userid != null
|
||||
)
|
||||
if (PrefManager.getCustomVal(
|
||||
"${media.id}_save_progress",
|
||||
true
|
||||
) && (if (media.isAdult) PrefManager.getVal(PrefName.UpdateForHPlayer) else true)
|
||||
) {
|
||||
media.anime!!.selectedEpisode?.apply {
|
||||
updateProgress(media, this)
|
||||
if (episode0) {
|
||||
updateProgress(media, "0")
|
||||
} else {
|
||||
media.anime!!.selectedEpisode?.apply {
|
||||
updateProgress(media, this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,7 +151,21 @@ class MangaReaderActivity : AppCompatActivity() {
|
|||
defaultSettings = loadReaderSettings("reader_settings") ?: defaultSettings
|
||||
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
progress { finish() }
|
||||
val chapter = (MangaNameAdapter.findChapterNumber(media.manga!!.selectedChapter!!)
|
||||
?.minus(1L) ?: 0).toString()
|
||||
if (chapter == "0.0" && PrefManager.getVal(PrefName.ChapterZeroReader)
|
||||
// Not asking individually or incognito
|
||||
&& !showProgressDialog && !PrefManager.getVal<Boolean>(PrefName.Incognito)
|
||||
// Not ...opted out ...already? Somehow?
|
||||
&& PrefManager.getCustomVal("${media.id}_save_progress", true)
|
||||
// Allowing Doujin updates or not one
|
||||
&& if (media.isAdult) PrefManager.getVal(PrefName.UpdateForHReader) else true
|
||||
) {
|
||||
updateProgress(media, chapter)
|
||||
finish()
|
||||
} else {
|
||||
progress { finish() }
|
||||
}
|
||||
}
|
||||
|
||||
controllerDuration = (PrefManager.getVal<Float>(PrefName.AnimationSpeed) * 200).toLong()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue