index fix

This commit is contained in:
Finnley Somdahl 2024-01-23 13:54:15 -06:00
parent 3fa2690277
commit 4c797c5eb1

View file

@ -240,12 +240,12 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
"Dantotsu",
Context.MODE_PRIVATE
).getInt("settings_def_anime_source_s_r", 0)
val oldName = AnimeSources.names[oldDefaultSourceIndex]
val oldName = if (oldDefaultSourceIndex >= AnimeSources.names.size) "" else AnimeSources.names[oldDefaultSourceIndex]
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
.putStringSet("pinned_anime_sources", pinnedSources).apply()
AnimeSources.pinnedAnimeSources = pinnedSources
AnimeSources.performReorderAnimeSources()
val newDefaultSourceIndex = AnimeSources.names.indexOf(oldName)
val newDefaultSourceIndex = if (oldName == "") 0 else AnimeSources.names.indexOf(oldName)
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
.putInt("settings_def_anime_source_s_r", newDefaultSourceIndex).apply()
dialog.dismiss()
@ -493,12 +493,12 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
"Dantotsu",
Context.MODE_PRIVATE
).getInt("settings_def_manga_source_s_r", 0)
val oldName = MangaSources.names[oldDefaultSourceIndex]
val oldName = if (oldDefaultSourceIndex >= MangaSources.names.size) "" else MangaSources.names[oldDefaultSourceIndex]
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
.putStringSet("pinned_manga_sources", pinnedSources).apply()
MangaSources.pinnedMangaSources = pinnedSources
MangaSources.performReorderMangaSources()
val newDefaultSourceIndex = MangaSources.names.indexOf(oldName)
val newDefaultSourceIndex = if (oldName == "") 0 else MangaSources.names.indexOf(oldName)
getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).edit()
.putInt("settings_def_manga_source_s_r", newDefaultSourceIndex).apply()
dialog.dismiss()