forked from AlmightyHak/extensions-source
Update HiAnime.kt
This commit is contained in:
parent
19127e1c07
commit
f9f86e46ae
1 changed files with 28 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.zoro
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.lib.megacloudextractor.MegaCloudExtractor
|
||||
|
@ -12,7 +15,7 @@ import org.jsoup.nodes.Element
|
|||
class HiAnime : ZoroTheme(
|
||||
"en",
|
||||
"HiAnime",
|
||||
"https://hianime.to",
|
||||
"https://hianimez.to",
|
||||
hosterNames = listOf(
|
||||
"HD-1",
|
||||
"HD-2",
|
||||
|
@ -45,4 +48,28 @@ class HiAnime : ZoroTheme(
|
|||
else -> emptyList()
|
||||
}
|
||||
}
|
||||
// Added the setupPreferenceScreen method here
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
screen.addPreference(ListPreference(screen.context).apply {
|
||||
key = PREF_DOMAIN_KEY
|
||||
title = "Preferred domain"
|
||||
entries = arrayOf("hianimez.to", "hianime.to", "hianime.bz", "hianime.pe")
|
||||
entryValues = arrayOf("https://hianimez.to", "https://hianime.to", "https://hianime.bz", "https://hianime.pe")
|
||||
setDefaultValue(PREF_DOMAIN_DEFAULT)
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
Toast.makeText(screen.context, "Restart Aniyomi to apply changes", Toast.LENGTH_LONG).show()
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PREF_DOMAIN_KEY = "preferred_domain"
|
||||
private const val PREF_DOMAIN_DEFAULT = "https://hianimez.to"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue