From e8ba0801aa9c94a029a12e8dfa65efc1d2274701 Mon Sep 17 00:00:00 2001 From: Jason Yao Date: Sat, 10 Oct 2020 19:06:00 -0400 Subject: [PATCH] update --- app/src/main/java/io/legado/app/utils/LanguageUtils.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/utils/LanguageUtils.kt b/app/src/main/java/io/legado/app/utils/LanguageUtils.kt index 551e91a00..cf1e5a159 100644 --- a/app/src/main/java/io/legado/app/utils/LanguageUtils.kt +++ b/app/src/main/java/io/legado/app/utils/LanguageUtils.kt @@ -41,7 +41,8 @@ object LanguageUtils { val resources: Resources = context.resources val targetLocale = getSetLocale(context) val configuration: Configuration = resources.configuration - configuration.setLocale(targetLocale) + @Suppress("DEPRECATION") + configuration.locale = targetLocale @Suppress("DEPRECATION") resources.updateConfiguration(configuration, resources.displayMetrics) } @@ -70,7 +71,7 @@ object LanguageUtils { locale = context.resources.configuration.locales[0] } else { @Suppress("DEPRECATION") - locale =context.resources.configuration.locale + locale = context.resources.configuration.locale } /* Log.d("h11128", "displayName " + locale.displayName) @@ -97,7 +98,7 @@ object LanguageUtils { } /** - * 判断系统语言和设置语言是否相同 + * 判断App语言和设置语言是否相同 */ fun isSameWithSetting(context: Context): Boolean { val locale = getAppLocale(context)