Update HiAnime.kt
This commit is contained in:
parent
87dcd5dfd3
commit
115a9408e1
1 changed files with 15 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
package eu.kanade.tachiyomi.animeextension.en.zoro
|
package eu.kanade.tachiyomi.animeextension.en.hianime
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
@ -17,12 +17,14 @@ import org.jsoup.nodes.Element
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
class HiAnime : ConfigurableAnimeSource, ZoroTheme(
|
class HiAnime :
|
||||||
lang = "en",
|
ConfigurableAnimeSource,
|
||||||
name = "HiAnime",
|
ZoroTheme(
|
||||||
baseUrl = preferences.getString(PREF_BASE_URL_KEY, DEFAULT_BASE_URL)!!,
|
"en",
|
||||||
|
"HiAnime",
|
||||||
|
getPrefBaseUrl(),
|
||||||
hosterNames = listOf("HD-1", "HD-2", "StreamTape"),
|
hosterNames = listOf("HD-1", "HD-2", "StreamTape"),
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override val id = 6706411382606718900L
|
override val id = 6706411382606718900L
|
||||||
|
|
||||||
|
@ -61,13 +63,13 @@ class HiAnime : ConfigurableAnimeSource, ZoroTheme(
|
||||||
summary = "Set a custom domain to override the default ($DEFAULT_BASE_URL)"
|
summary = "Set a custom domain to override the default ($DEFAULT_BASE_URL)"
|
||||||
dialogTitle = "Custom domain"
|
dialogTitle = "Custom domain"
|
||||||
setDefaultValue(DEFAULT_BASE_URL)
|
setDefaultValue(DEFAULT_BASE_URL)
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, _ ->
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
screen.context,
|
screen.context,
|
||||||
"Restart Aniyomi to apply changes.",
|
"Restart Aniyomi to apply changes.",
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
true // Save the preference
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,5 +83,9 @@ class HiAnime : ConfigurableAnimeSource, ZoroTheme(
|
||||||
private val preferences: SharedPreferences by lazy {
|
private val preferences: SharedPreferences by lazy {
|
||||||
Injekt.get<Application>().getSharedPreferences("hianime", 0)
|
Injekt.get<Application>().getSharedPreferences("hianime", 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getPrefBaseUrl(): String {
|
||||||
|
return preferences.getString(PREF_BASE_URL_KEY, DEFAULT_BASE_URL) ?: DEFAULT_BASE_URL
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue