mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
fix theme
This commit is contained in:
parent
a1b5975c40
commit
d024908a5c
@ -47,7 +47,23 @@ class MainActivity : AppCompatActivity() {
|
||||
private var startFragmentId = R.id.homeFragment
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
/**
|
||||
* apply dynamic colors if enabled
|
||||
*/
|
||||
val materialColorsEnabled = PreferenceHelper
|
||||
.getString(this, "accent_color", "purple") == "my"
|
||||
if (materialColorsEnabled) {
|
||||
// apply dynamic colors to the current activity
|
||||
DynamicColors.applyToActivityIfAvailable(this)
|
||||
// apply dynamic colors to the all other activities
|
||||
DynamicColors.applyToActivitiesIfAvailable(application)
|
||||
}
|
||||
|
||||
// set the theme
|
||||
ThemeHelper.updateTheme(applicationContext)
|
||||
// set the language
|
||||
LocaleHelper.updateLanguage(applicationContext)
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// start service that gets called on closure
|
||||
@ -69,9 +85,6 @@ class MainActivity : AppCompatActivity() {
|
||||
RetrofitInstance.url
|
||||
}
|
||||
|
||||
ThemeHelper.updateTheme(this)
|
||||
LocaleHelper.updateLanguage(this)
|
||||
|
||||
// show noInternet Activity if no internet available on app startup
|
||||
if (!ConnectionHelper.isNetworkAvailable(this)) {
|
||||
val noInternetIntent = Intent(this, NoInternetActivity::class.java)
|
||||
|
@ -5,6 +5,7 @@ import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.databinding.ActivityNointernetBinding
|
||||
import com.github.libretube.preferences.PreferenceHelper
|
||||
import com.github.libretube.util.ConnectionHelper
|
||||
import com.github.libretube.util.ThemeHelper
|
||||
import com.google.android.material.color.DynamicColors
|
||||
@ -14,8 +15,16 @@ class NoInternetActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityNointernetBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
/**
|
||||
* apply dynamic colors if enabled
|
||||
*/
|
||||
val materialColorsEnabled = PreferenceHelper
|
||||
.getString(this, "accent_color", "purple") == "my"
|
||||
if (materialColorsEnabled) {
|
||||
DynamicColors.applyToActivityIfAvailable(this)
|
||||
ThemeHelper.updateTheme(this)
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = ActivityNointernetBinding.inflate(layoutInflater)
|
||||
|
Loading…
Reference in New Issue
Block a user