Fix up and repackage

This commit is contained in:
JFronny 2022-05-14 15:47:55 +02:00
parent 4df292bddf
commit cde7fd6565
No known key found for this signature in database
GPG key ID: E76429612C2929F4
510 changed files with 2660 additions and 3312 deletions

View file

@ -0,0 +1,25 @@
package io.github.muntashirakon.music
import android.content.Context
import android.content.ContextWrapper
import android.os.LocaleList
import code.name.monkey.appthemehelper.util.VersionUtils.hasNougatMR
import java.util.*
class LanguageContextWrapper(base: Context?) : ContextWrapper(base) {
companion object {
fun wrap(context: Context?, newLocale: Locale?): LanguageContextWrapper {
if (context == null) return LanguageContextWrapper(context)
val configuration = context.resources.configuration
if (hasNougatMR()) {
configuration.setLocale(newLocale)
val localeList = LocaleList(newLocale)
LocaleList.setDefault(localeList)
configuration.setLocales(localeList)
} else {
configuration.setLocale(newLocale)
}
return LanguageContextWrapper(context.createConfigurationContext(configuration))
}
}
}