Skip to content
This repository was archived by the owner on Jun 22, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.content.res.Resources
import android.os.BadParcelableException
import android.os.Handler
import android.os.Looper
import java.util.*
import java.util.Locale

open class LocalizationActivityDelegate(val activity: Activity) {
private lateinit var currentLanguage: Locale
Expand Down Expand Up @@ -145,11 +145,14 @@ open class LocalizationActivityDelegate(val activity: Activity) {

// Check if locale has change while this activity was run to back stack.
private fun checkLocaleChange(context: Context) {
val defaultLocale = LanguageSetting.getDefaultLanguage(context)
val currentLocale = LanguageSetting.getLanguageWithDefault(context, defaultLocale)
if (!isCurrentLanguageSetting(currentLanguage, currentLocale)) {
isLocalizationChanged = true
notifyLanguageChanged()
if (this::currentLanguage.isInitialized) {
val defaultLocale = LanguageSetting.getDefaultLanguage(context)
val currentLocale = LanguageSetting.getLanguageWithDefault(context, defaultLocale)

if (!isCurrentLanguageSetting(currentLanguage, currentLocale)) {
isLocalizationChanged = true
notifyLanguageChanged()
}
}
}

Expand Down