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
|
@ -19,7 +19,7 @@ fun updateProgress(media: Media, number: String) {
|
||||||
if (Anilist.userid != null) {
|
if (Anilist.userid != null) {
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
val a = number.toFloatOrNull()?.toInt()
|
val a = number.toFloatOrNull()?.toInt()
|
||||||
if ((a ?: 0) > (media.userProgress ?: 0)) {
|
if ((a ?: 0) > (media.userProgress ?: -1)) {
|
||||||
Anilist.mutation.editList(
|
Anilist.mutation.editList(
|
||||||
media.id,
|
media.id,
|
||||||
a,
|
a,
|
||||||
|
|
|
@ -1854,17 +1854,23 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
|
|
||||||
private fun updateAniProgress() {
|
private fun updateAniProgress() {
|
||||||
val incognito: Boolean = PrefManager.getVal(PrefName.Incognito)
|
val incognito: Boolean = PrefManager.getVal(PrefName.Incognito)
|
||||||
if (!incognito && exoPlayer.currentPosition / episodeLength > PrefManager.getVal<Float>(
|
val episodeEnd = exoPlayer.currentPosition / episodeLength > PrefManager.getVal<Float>(
|
||||||
PrefName.WatchPercentage
|
PrefName.WatchPercentage
|
||||||
) && Anilist.userid != null
|
)
|
||||||
|
val episode0 = currentEpisodeIndex == 0 && PrefManager.getVal(PrefName.ChapterZeroPlayer)
|
||||||
|
if (!incognito && (episodeEnd || episode0) && Anilist.userid != null
|
||||||
)
|
)
|
||||||
if (PrefManager.getCustomVal(
|
if (PrefManager.getCustomVal(
|
||||||
"${media.id}_save_progress",
|
"${media.id}_save_progress",
|
||||||
true
|
true
|
||||||
) && (if (media.isAdult) PrefManager.getVal(PrefName.UpdateForHPlayer) else true)
|
) && (if (media.isAdult) PrefManager.getVal(PrefName.UpdateForHPlayer) else true)
|
||||||
) {
|
) {
|
||||||
media.anime!!.selectedEpisode?.apply {
|
if (episode0) {
|
||||||
updateProgress(media, this)
|
updateProgress(media, "0")
|
||||||
|
} else {
|
||||||
|
media.anime!!.selectedEpisode?.apply {
|
||||||
|
updateProgress(media, this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,21 @@ class MangaReaderActivity : AppCompatActivity() {
|
||||||
defaultSettings = loadReaderSettings("reader_settings") ?: defaultSettings
|
defaultSettings = loadReaderSettings("reader_settings") ?: defaultSettings
|
||||||
|
|
||||||
onBackPressedDispatcher.addCallback(this) {
|
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()
|
controllerDuration = (PrefManager.getVal<Float>(PrefName.AnimationSpeed) * 200).toLong()
|
||||||
|
|
|
@ -167,6 +167,14 @@ class PlayerSettingsActivity : AppCompatActivity() {
|
||||||
PrefManager.getVal(PrefName.AskIndividualPlayer)
|
PrefManager.getVal(PrefName.AskIndividualPlayer)
|
||||||
binding.playerSettingsAskUpdateProgress.setOnCheckedChangeListener { _, isChecked ->
|
binding.playerSettingsAskUpdateProgress.setOnCheckedChangeListener { _, isChecked ->
|
||||||
PrefManager.setVal(PrefName.AskIndividualPlayer, isChecked)
|
PrefManager.setVal(PrefName.AskIndividualPlayer, isChecked)
|
||||||
|
binding.playerSettingsAskChapterZero.isEnabled = !isChecked
|
||||||
|
}
|
||||||
|
binding.playerSettingsAskChapterZero.isChecked =
|
||||||
|
PrefManager.getVal(PrefName.ChapterZeroPlayer)
|
||||||
|
binding.playerSettingsAskChapterZero.isEnabled =
|
||||||
|
!PrefManager.getVal<Boolean>(PrefName.AskIndividualPlayer)
|
||||||
|
binding.playerSettingsAskChapterZero.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
PrefManager.setVal(PrefName.ChapterZeroPlayer, isChecked)
|
||||||
}
|
}
|
||||||
binding.playerSettingsAskUpdateHentai.isChecked =
|
binding.playerSettingsAskUpdateHentai.isChecked =
|
||||||
PrefManager.getVal(PrefName.UpdateForHPlayer)
|
PrefManager.getVal(PrefName.UpdateForHPlayer)
|
||||||
|
|
|
@ -355,6 +355,14 @@ class ReaderSettingsActivity : AppCompatActivity() {
|
||||||
PrefManager.getVal(PrefName.AskIndividualReader)
|
PrefManager.getVal(PrefName.AskIndividualReader)
|
||||||
binding.readerSettingsAskUpdateProgress.setOnCheckedChangeListener { _, isChecked ->
|
binding.readerSettingsAskUpdateProgress.setOnCheckedChangeListener { _, isChecked ->
|
||||||
PrefManager.setVal(PrefName.AskIndividualReader, isChecked)
|
PrefManager.setVal(PrefName.AskIndividualReader, isChecked)
|
||||||
|
binding.readerSettingsAskChapterZero.isEnabled = !isChecked
|
||||||
|
}
|
||||||
|
binding.readerSettingsAskChapterZero.isChecked =
|
||||||
|
PrefManager.getVal(PrefName.ChapterZeroReader)
|
||||||
|
binding.readerSettingsAskChapterZero.isEnabled =
|
||||||
|
!PrefManager.getVal<Boolean>(PrefName.AskIndividualReader)
|
||||||
|
binding.readerSettingsAskChapterZero.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
PrefManager.setVal(PrefName.ChapterZeroReader, isChecked)
|
||||||
}
|
}
|
||||||
binding.readerSettingsAskUpdateDoujins.isChecked =
|
binding.readerSettingsAskUpdateDoujins.isChecked =
|
||||||
PrefManager.getVal(PrefName.UpdateForHReader)
|
PrefManager.getVal(PrefName.UpdateForHReader)
|
||||||
|
|
|
@ -95,6 +95,7 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
||||||
AutoPlay(Pref(Location.Player, Boolean::class, true)),
|
AutoPlay(Pref(Location.Player, Boolean::class, true)),
|
||||||
AutoSkipFiller(Pref(Location.Player, Boolean::class, false)),
|
AutoSkipFiller(Pref(Location.Player, Boolean::class, false)),
|
||||||
AskIndividualPlayer(Pref(Location.Player, Boolean::class, true)),
|
AskIndividualPlayer(Pref(Location.Player, Boolean::class, true)),
|
||||||
|
ChapterZeroPlayer(Pref(Location.Player, Boolean::class, true)),
|
||||||
UpdateForHPlayer(Pref(Location.Player, Boolean::class, false)),
|
UpdateForHPlayer(Pref(Location.Player, Boolean::class, false)),
|
||||||
WatchPercentage(Pref(Location.Player, Float::class, 0.8f)),
|
WatchPercentage(Pref(Location.Player, Float::class, 0.8f)),
|
||||||
AlwaysContinue(Pref(Location.Player, Boolean::class, true)),
|
AlwaysContinue(Pref(Location.Player, Boolean::class, true)),
|
||||||
|
@ -114,6 +115,7 @@ enum class PrefName(val data: Pref) { //TODO: Split this into multiple files
|
||||||
ShowSystemBars(Pref(Location.Reader, Boolean::class, false)),
|
ShowSystemBars(Pref(Location.Reader, Boolean::class, false)),
|
||||||
AutoDetectWebtoon(Pref(Location.Reader, Boolean::class, true)),
|
AutoDetectWebtoon(Pref(Location.Reader, Boolean::class, true)),
|
||||||
AskIndividualReader(Pref(Location.Reader, Boolean::class, true)),
|
AskIndividualReader(Pref(Location.Reader, Boolean::class, true)),
|
||||||
|
ChapterZeroReader(Pref(Location.Reader, Boolean::class, true)),
|
||||||
UpdateForHReader(Pref(Location.Reader, Boolean::class, false)),
|
UpdateForHReader(Pref(Location.Reader, Boolean::class, false)),
|
||||||
Direction(Pref(Location.Reader, Int::class, 0)),
|
Direction(Pref(Location.Reader, Int::class, 0)),
|
||||||
LayoutReader(Pref(Location.Reader, Int::class, 2)),
|
LayoutReader(Pref(Location.Reader, Int::class, 2)),
|
||||||
|
|
16
app/src/main/res/drawable/ic_round_early_bird_special.xml
Normal file
16
app/src/main/res/drawable/ic_round_early_bird_special.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="#000000"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M12.5,4.5m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M19.77,17.72l-0.64,-6.37C19.06,10.58 18.41,10 17.64,10H16c-1.5,-0.02 -2.86,-0.54 -3.76,-1.44l-2,-1.98C10.08,6.42 9.62,6 8.83,6C8.32,6 7.81,6.2 7.42,6.59L4.08,9.91c-0.53,0.68 -0.51,1.57 -0.21,2.13l1.43,2.8l-3.15,4.05l1.57,1.24l3.68,-4.73l-0.17,-1.36L8,14.75V20h2v-6.12l-2.12,-2.12l2.36,-2.36c0.94,0.94 1.72,1.82 3.59,2.32L13,20h1.5l0.41,-3.5h3.18l0.14,1.22c-0.44,0.26 -0.73,0.74 -0.73,1.28c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5C20.5,18.46 20.21,17.98 19.77,17.72zM15.09,15l0.41,-3.5h2l0.41,3.5H15.09z"/>
|
||||||
|
|
||||||
|
</vector>
|
|
@ -705,6 +705,41 @@
|
||||||
android:text="@string/ask_update_progress_info_ep"
|
android:text="@string/ask_update_progress_info_ep"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
|
android:id="@+id/playerSettingsAskChapterZero"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:checked="false"
|
||||||
|
android:drawableStart="@drawable/ic_round_early_bird_special"
|
||||||
|
android:drawablePadding="16dp"
|
||||||
|
android:elegantTextHeight="true"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:minHeight="64dp"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:text="@string/ask_update_progress_chapter_zero"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textColor="?attr/colorOnBackground"
|
||||||
|
app:cornerRadius="0dp"
|
||||||
|
app:drawableTint="?attr/colorPrimary"
|
||||||
|
app:showText="false"
|
||||||
|
app:thumbTint="@color/button_switch_track">
|
||||||
|
|
||||||
|
</com.google.android.material.materialswitch.MaterialSwitch>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:alpha="0.58"
|
||||||
|
android:fontFamily="@font/poppins_family"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:text="@string/ask_update_progress_info_zero"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<com.google.android.material.materialswitch.MaterialSwitch
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
android:id="@+id/playerSettingsAskUpdateHentai"
|
android:id="@+id/playerSettingsAskUpdateHentai"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1312,6 +1312,41 @@
|
||||||
android:text="@string/ask_update_progress_info_chap"
|
android:text="@string/ask_update_progress_info_chap"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
|
android:id="@+id/readerSettingsAskChapterZero"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:checked="false"
|
||||||
|
android:drawableStart="@drawable/ic_round_early_bird_special"
|
||||||
|
android:drawablePadding="16dp"
|
||||||
|
android:elegantTextHeight="true"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:minHeight="64dp"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:text="@string/ask_update_progress_chapter_zero"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textColor="?attr/colorOnBackground"
|
||||||
|
app:cornerRadius="0dp"
|
||||||
|
app:drawableTint="?attr/colorPrimary"
|
||||||
|
app:showText="false"
|
||||||
|
app:thumbTint="@color/button_switch_track">
|
||||||
|
|
||||||
|
</com.google.android.material.materialswitch.MaterialSwitch>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:alpha="0.58"
|
||||||
|
android:fontFamily="@font/poppins_family"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:text="@string/ask_update_progress_info_zero"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<com.google.android.material.materialswitch.MaterialSwitch
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
android:id="@+id/readerSettingsAskUpdateDoujins"
|
android:id="@+id/readerSettingsAskUpdateDoujins"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -244,6 +244,8 @@
|
||||||
<string name="ask_update_progress_manga">Ask for each Manga \"Individually\"</string>
|
<string name="ask_update_progress_manga">Ask for each Manga \"Individually\"</string>
|
||||||
<string name="ask_update_progress_info_ep">Turning off will always automatically update progress when the episode is watched.</string>
|
<string name="ask_update_progress_info_ep">Turning off will always automatically update progress when the episode is watched.</string>
|
||||||
<string name="ask_update_progress_info_chap">Turning off will always automatically update progress when the chapter is read.</string>
|
<string name="ask_update_progress_info_chap">Turning off will always automatically update progress when the chapter is read.</string>
|
||||||
|
<string name="ask_update_progress_chapter_zero">Update Progress for Chapter 0</string>
|
||||||
|
<string name="ask_update_progress_info_zero">Turning on will add newly started items to Anilist with progress set to chapter 0.</string>
|
||||||
<string name="ask_update_progress_hentai">Update Progress for Hentai</string>
|
<string name="ask_update_progress_hentai">Update Progress for Hentai</string>
|
||||||
<string name="ask_update_progress_doujin">Update Progress for Doujins</string>
|
<string name="ask_update_progress_doujin">Update Progress for Doujins</string>
|
||||||
<string name="very_bold">very bold of you sar</string>
|
<string name="very_bold">very bold of you sar</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue