Loading app/ui/base/src/main/java/com/fsck/k9/ui/base/K9Activity.kt +10 −0 Original line number Diff line number Diff line package com.fsck.k9.ui.base import android.content.Context import android.os.Build import android.os.Bundle import androidx.annotation.LayoutRes import androidx.appcompat.app.AppCompatActivity Loading Loading @@ -35,9 +36,18 @@ abstract class K9Activity(private val themeType: ThemeType) : AppCompatActivity( initializePushController() super.onCreate(savedInstanceState) setLayoutDirection() listenForAppLanguageChanges() } // On Android 12+ the layout direction doesn't seem to be updated when recreating the activity. This is a problem // when switching from an LTR to an RTL language (or the other way around) using the language picker in the app. private fun setLayoutDirection() { if (Build.VERSION.SDK_INT >= 31) { window.decorView.layoutDirection = resources.configuration.layoutDirection } } private fun listenForAppLanguageChanges() { appLanguageManager.overrideLocale.asLiveData().observe(this) { overrideLocale -> if (overrideLocale != overrideLocaleOnLaunch) { Loading Loading
app/ui/base/src/main/java/com/fsck/k9/ui/base/K9Activity.kt +10 −0 Original line number Diff line number Diff line package com.fsck.k9.ui.base import android.content.Context import android.os.Build import android.os.Bundle import androidx.annotation.LayoutRes import androidx.appcompat.app.AppCompatActivity Loading Loading @@ -35,9 +36,18 @@ abstract class K9Activity(private val themeType: ThemeType) : AppCompatActivity( initializePushController() super.onCreate(savedInstanceState) setLayoutDirection() listenForAppLanguageChanges() } // On Android 12+ the layout direction doesn't seem to be updated when recreating the activity. This is a problem // when switching from an LTR to an RTL language (or the other way around) using the language picker in the app. private fun setLayoutDirection() { if (Build.VERSION.SDK_INT >= 31) { window.decorView.layoutDirection = resources.configuration.layoutDirection } } private fun listenForAppLanguageChanges() { appLanguageManager.overrideLocale.asLiveData().observe(this) { overrideLocale -> if (overrideLocale != overrideLocaleOnLaunch) { Loading