Update HiAnime.kt
This commit is contained in:
parent
626ac52a05
commit
a1312daf0e
1 changed files with 10 additions and 2 deletions
|
@ -15,7 +15,7 @@ import org.jsoup.nodes.Element
|
||||||
class HiAnime : ZoroTheme(
|
class HiAnime : ZoroTheme(
|
||||||
"en",
|
"en",
|
||||||
"HiAnime",
|
"HiAnime",
|
||||||
"https://hianimez.to",
|
getPreferredDomain(),
|
||||||
hosterNames = listOf(
|
hosterNames = listOf(
|
||||||
"HD-1",
|
"HD-1",
|
||||||
"HD-2",
|
"HD-2",
|
||||||
|
@ -76,12 +76,14 @@ class HiAnime : ZoroTheme(
|
||||||
val selected = newValue as String
|
val selected = newValue as String
|
||||||
val index = findIndexOfValue(selected)
|
val index = findIndexOfValue(selected)
|
||||||
val entry = entryValues[index] as String
|
val entry = entryValues[index] as String
|
||||||
|
preferences.edit().putString(PREF_DOMAIN_KEY, entry).commit()
|
||||||
|
|
||||||
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()
|
||||||
preferences.edit().putString(key, entry).commit()
|
true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -90,5 +92,11 @@ class HiAnime : ZoroTheme(
|
||||||
companion object {
|
companion object {
|
||||||
private const val PREF_DOMAIN_KEY = "preferred_domain"
|
private const val PREF_DOMAIN_KEY = "preferred_domain"
|
||||||
private const val PREF_DOMAIN_DEFAULT = "https://hianimez.to"
|
private const val PREF_DOMAIN_DEFAULT = "https://hianimez.to"
|
||||||
|
|
||||||
|
fun getPreferredDomain(): String {
|
||||||
|
// Fetch the saved domain from SharedPreferences
|
||||||
|
val preferences = androidx.preference.PreferenceManager.getDefaultSharedPreferences(eu.kanade.tachiyomi.App.INSTANCE)
|
||||||
|
return preferences.getString(PREF_DOMAIN_KEY, PREF_DOMAIN_DEFAULT) ?: PREF_DOMAIN_DEFAULT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue