Merge pull request #7110 from Bnyro/master

fix: configuration issues causing missing margin in download player
This commit is contained in:
Bnyro 2025-02-17 21:39:40 +01:00 committed by GitHub
commit 301f80f723
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,7 @@ package com.github.libretube.ui.base
import android.content.Context
import android.content.pm.ActivityInfo
import android.content.res.Configuration
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.libretube.R
@ -53,21 +54,17 @@ open class BaseActivity : AppCompatActivity() {
}
override fun attachBaseContext(newBase: Context?) {
if (newBase == null) {
super.attachBaseContext(null)
return
}
super.attachBaseContext(newBase)
// change the locale according to the user's preference (or system language as fallback)
val locale = LocaleHelper.getAppLocale()
Locale.setDefault(locale)
val configuration = newBase.resources.configuration.apply {
val configuration = Configuration().apply {
setLocale(locale)
}
val newContext = newBase.createConfigurationContext(configuration)
super.attachBaseContext(newContext)
applyOverrideConfiguration(configuration)
}
/**