Merge pull request #1153 from Bnyro/master

attempt to fix languages
This commit is contained in:
Bnyro 2022-08-25 12:06:14 +02:00 committed by GitHub
commit c796025d7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -36,7 +36,6 @@ import com.github.libretube.models.SearchViewModel
import com.github.libretube.preferences.PreferenceHelper import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys import com.github.libretube.preferences.PreferenceKeys
import com.github.libretube.services.ClosingService import com.github.libretube.services.ClosingService
import com.github.libretube.util.LocaleHelper
import com.github.libretube.util.NetworkHelper import com.github.libretube.util.NetworkHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -54,9 +53,6 @@ class MainActivity : BaseActivity() {
lateinit var searchView: SearchView lateinit var searchView: SearchView
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
// set the language
LocaleHelper.updateLanguage(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
autoRotationEnabled = PreferenceHelper.getBoolean(PreferenceKeys.AUTO_ROTATION, false) autoRotationEnabled = PreferenceHelper.getBoolean(PreferenceKeys.AUTO_ROTATION, false)

View File

@ -2,13 +2,20 @@ package com.github.libretube.extensions
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.github.libretube.util.LocaleHelper
import com.github.libretube.util.ThemeHelper import com.github.libretube.util.ThemeHelper
/**
* Activity that applies the LibreTube theme and the in-app language
*/
open class BaseActivity : AppCompatActivity() { open class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
// set the app theme (e.g. Material You) // set the app theme (e.g. Material You)
ThemeHelper.updateTheme(this) ThemeHelper.updateTheme(this)
// set the apps language
LocaleHelper.updateLanguage(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
} }