File tree Expand file tree Collapse file tree
app/src/main/java/com/github/libretube/ui/base Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package com.github.libretube.ui.base
22
33import android.content.Context
44import android.content.pm.ActivityInfo
5+ import android.content.res.Configuration
56import android.os.Bundle
67import androidx.appcompat.app.AppCompatActivity
78import com.github.libretube.R
@@ -53,21 +54,17 @@ open class BaseActivity : AppCompatActivity() {
5354 }
5455
5556 override fun attachBaseContext (newBase : Context ? ) {
56- if (newBase == null ) {
57- super .attachBaseContext(null )
58- return
59- }
57+ super .attachBaseContext(newBase)
6058
6159 // change the locale according to the user's preference (or system language as fallback)
6260 val locale = LocaleHelper .getAppLocale()
6361 Locale .setDefault(locale)
6462
65- val configuration = newBase.resources.configuration .apply {
63+ val configuration = Configuration () .apply {
6664 setLocale(locale)
6765 }
68- val newContext = newBase.createConfigurationContext(configuration)
6966
70- super .attachBaseContext(newContext )
67+ applyOverrideConfiguration(configuration )
7168 }
7269
7370 /* *
You can’t perform that action at this time.
0 commit comments