mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Light theme partially fixed
This commit is contained in:
parent
9712975fd9
commit
4d355ecf1c
@ -50,6 +50,7 @@ class MainActivity : AppCompatActivity() {
|
||||
SponsorBlockSettings.outroEnabled = sharedPreferences.getBoolean("outro_category_key", false)
|
||||
|
||||
updateAccentColor(this)
|
||||
updateThemeMode(this)
|
||||
|
||||
DynamicColors.applyToActivitiesIfAvailable(application)
|
||||
|
||||
@ -70,22 +71,17 @@ class MainActivity : AppCompatActivity() {
|
||||
res.updateConfiguration(conf, dm)
|
||||
}
|
||||
|
||||
when (sharedPreferences.getString("theme_togglee", "A")!!) {
|
||||
"A" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
"L" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
"D" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
}
|
||||
|
||||
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
val networkInfo=connectivityManager.activeNetworkInfo
|
||||
val isConnected = networkInfo != null && networkInfo.isConnected
|
||||
|
||||
if (isConnected == false) {
|
||||
if (!isConnected) {
|
||||
setContentView(R.layout.activity_nointernet)
|
||||
findViewById<Button>(R.id.retry_button).setOnClickListener() {
|
||||
recreate()
|
||||
}
|
||||
} else {
|
||||
updateAccentColor(this)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
@ -100,6 +96,7 @@ class MainActivity : AppCompatActivity() {
|
||||
"library" -> navController.navigate(R.id.library)
|
||||
}
|
||||
|
||||
bottomNavigationView.setBackgroundColor(0) // otherwise Navbar Theme doesn't change
|
||||
bottomNavigationView.setOnItemSelectedListener {
|
||||
when (it.itemId) {
|
||||
R.id.home2 -> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.github.libretube
|
||||
|
||||
import android.content.Context
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.preference.PreferenceManager
|
||||
|
||||
fun updateAccentColor(context: Context) {
|
||||
@ -13,3 +14,12 @@ fun updateAccentColor(context: Context) {
|
||||
"purple" -> context.setTheme(R.style.Theme_Purple)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateThemeMode(context: Context) {
|
||||
val themeMode = PreferenceManager.getDefaultSharedPreferences(context).getString("theme_togglee", "A")
|
||||
when (themeMode) {
|
||||
"A" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
"L" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
"D" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
}
|
||||
}
|
@ -236,7 +236,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:backgroundTint="?android:attr/colorBackground"
|
||||
android:backgroundTint="?attr/colorOnPrimary"
|
||||
android:drawableLeft="@drawable/ic_bell"
|
||||
android:drawableTint="?android:attr/textColorPrimary"
|
||||
android:text="@string/subscribe"
|
||||
|
@ -9,10 +9,12 @@
|
||||
<item name="colorOnPrimaryContainer">@color/red_light_accentLight</item> //
|
||||
<item name="colorSecondary">@color/red_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/red_light_accentDark</item> //
|
||||
<!-- <item name="colorSecondaryContainer">@color/red_light_accentDark</item> --> // navbar surround
|
||||
<item name="colorSecondaryContainer">@color/red_light_accentDark</item> // navbar surround
|
||||
<item name="colorOnSecondaryContainer">@color/red_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/red_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/red_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
<item name="colorControlNormal">#101042</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
@ -29,9 +31,11 @@
|
||||
<item name="colorSecondary">@color/blue_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/blue_light_accentDark</item> //
|
||||
<item name="colorSecondaryContainer">@color/blue_light_accentDark</item> // navbar surround
|
||||
<!-- <item name="colorOnSecondaryContainer">@color/blue_light_background</item> --> // navbar icon fill
|
||||
<item name="colorOnSecondaryContainer">@color/blue_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/blue_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/blue_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
<item name="android:colorButtonNormal">@color/black</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
@ -48,9 +52,10 @@
|
||||
<item name="colorSecondary">@color/yellow_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/yellow_light_accentDark</item> //
|
||||
<item name="colorSecondaryContainer">@color/yellow_light_accentDark</item> // navbar surround
|
||||
<!-- <item name="colorOnSecondaryContainer">@color/yellow_light_background</item> --> // navbar icon fill
|
||||
<item name="colorOnSecondaryContainer">@color/yellow_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/yellow_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/yellow_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
@ -67,9 +72,10 @@
|
||||
<item name="colorSecondary">@color/green_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/green_light_accentDark</item> //
|
||||
<item name="colorSecondaryContainer">@color/green_light_accentDark</item> // navbar surround
|
||||
<!-- <item name="colorOnSecondaryContainer">@color/green_light_background</item> --> // navbar icon fill
|
||||
<item name="colorOnSecondaryContainer">@color/green_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/green_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/green_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
@ -86,9 +92,10 @@
|
||||
<item name="colorSecondary">@color/purple_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/purple_light_accentDark</item> //
|
||||
<item name="colorSecondaryContainer">@color/purple_light_accentDark</item> // navbar surround
|
||||
<!-- <item name="colorOnSecondaryContainer">@color/purple_light_background</item> --> // navbar icon fill
|
||||
<item name="colorOnSecondaryContainer">@color/purple_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/purple_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/purple_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
|
@ -8,10 +8,13 @@
|
||||
<item name="colorOnPrimaryContainer">@color/red_light_accentLight</item> //
|
||||
<item name="colorSecondary">@color/red_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/red_light_accentDark</item> //
|
||||
<!-- <item name="colorSecondaryContainer">@color/red_light_accentDark</item> --> // navbar surround
|
||||
<item name="colorSecondaryContainer">@color/red_light_accentDark</item> // navbar surround
|
||||
<item name="colorOnSecondaryContainer">@color/red_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/red_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/red_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
<item name="android:colorButtonNormal">@color/black</item>
|
||||
|
||||
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
@ -25,9 +28,11 @@
|
||||
<item name="colorSecondary">@color/blue_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/blue_light_accentDark</item> //
|
||||
<item name="colorSecondaryContainer">@color/blue_light_accentDark</item> // navbar surround
|
||||
<!-- <item name="colorOnSecondaryContainer">@color/blue_light_background</item> --> // navbar icon fill
|
||||
<item name="colorOnSecondaryContainer">@color/blue_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/blue_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/blue_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
<item name="android:colorButtonNormal">@color/black</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
|
||||
@ -42,9 +47,10 @@
|
||||
<item name="colorSecondary">@color/yellow_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/yellow_light_accentDark</item> //
|
||||
<item name="colorSecondaryContainer">@color/yellow_light_accentDark</item> // navbar surround
|
||||
<!-- <item name="colorOnSecondaryContainer">@color/yellow_light_background</item> --> // navbar icon fill
|
||||
<item name="colorOnSecondaryContainer">@color/yellow_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/yellow_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/yellow_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
|
||||
@ -59,9 +65,10 @@
|
||||
<item name="colorSecondary">@color/green_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/green_light_accentDark</item> //
|
||||
<item name="colorSecondaryContainer">@color/green_light_accentDark</item> // navbar surround
|
||||
<!-- <item name="colorOnSecondaryContainer">@color/green_light_background</item> --> // navbar icon fill
|
||||
<item name="colorOnSecondaryContainer">@color/green_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/green_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/green_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
|
||||
@ -76,9 +83,10 @@
|
||||
<item name="colorSecondary">@color/purple_light_accentLight</item> // Settings Categories
|
||||
<item name="colorOnSecondary">@color/purple_light_accentDark</item> //
|
||||
<item name="colorSecondaryContainer">@color/purple_light_accentDark</item> // navbar surround
|
||||
<!-- <item name="colorOnSecondaryContainer">@color/purple_light_background</item> --> // navbar icon fill
|
||||
<item name="colorOnSecondaryContainer">@color/purple_light_background</item> // navbar icon fill
|
||||
<item name="android:colorBackground">@color/purple_light_background</item> // background
|
||||
<item name="colorOnBackground">@color/purple_light_background</item>
|
||||
<item name="android:textColor">@color/black</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user