mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-26 20:21:05 +00:00
* got rid of both companion object * minor changes * It Now show lang on extensions * fixed * quickfix * android locale tuning * toggle option to setting * some fixes added 2 fonts removed Scanlators for anime --------- Co-authored-by: rebelonion <87634197+rebelonion@users.noreply.github.com>
23 lines
755 B
Kotlin
23 lines
755 B
Kotlin
package ani.dantotsu.others
|
|
|
|
import android.app.Activity
|
|
import android.content.res.Configuration
|
|
import android.content.res.Resources
|
|
import java.util.Locale
|
|
|
|
|
|
|
|
|
|
class LangSet {
|
|
companion object{
|
|
fun setLocale(activity: Activity) {
|
|
val useCursedLang = activity.getSharedPreferences("Dantotsu", Activity.MODE_PRIVATE).getBoolean("use_cursed_lang", false)
|
|
val locale = if(useCursedLang) Locale("en", "DW") else Locale("en", "US")
|
|
Locale.setDefault(locale)
|
|
val resources: Resources = activity.resources
|
|
val config: Configuration = resources.configuration
|
|
config.setLocale(locale)
|
|
resources.updateConfiguration(config, resources.displayMetrics)
|
|
}
|
|
}
|
|
} |