mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
OLED Mode + new colors
This commit is contained in:
parent
512cc128f0
commit
4f59a85ad9
@ -14,7 +14,7 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_libretube_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.LibreTube"
|
||||
android:theme="@style/Theme.Red"
|
||||
android:name=".myApp"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:largeHeap="true"
|
||||
|
@ -81,7 +81,6 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
} else {
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
|
||||
bottomNavigationView = findViewById(R.id.bottomNav)
|
||||
|
@ -36,6 +36,9 @@ class SettingsActivity : AppCompatActivity(),
|
||||
SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
updateAccentColor(this)
|
||||
updateThemeMode(this)
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
overridePendingTransition(50, 50)
|
||||
@ -44,7 +47,7 @@ class SettingsActivity : AppCompatActivity(),
|
||||
view.setAlpha(0F)
|
||||
view.animate().alpha(1F).setDuration(300)
|
||||
|
||||
updateAccentColor(this)
|
||||
|
||||
|
||||
setContentView(R.layout.activity_settings)
|
||||
if (savedInstanceState == null) {
|
||||
@ -221,11 +224,8 @@ class SettingsActivity : AppCompatActivity(),
|
||||
|
||||
val themeToggle = findPreference<ListPreference>("theme_togglee")
|
||||
themeToggle?.setOnPreferenceChangeListener { _, newValue ->
|
||||
when (newValue.toString()) {
|
||||
"A" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
"L" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
"D" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
}
|
||||
val refresh = Intent(context, SettingsActivity::class.java)
|
||||
startActivity(refresh)
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import androidx.preference.PreferenceManager
|
||||
fun updateAccentColor(context: Context) {
|
||||
val colorAccent = PreferenceManager.getDefaultSharedPreferences(context).getString("accent_color", "red")
|
||||
when (colorAccent) {
|
||||
"red" -> context.setTheme(R.style.Theme_LibreTube)
|
||||
"red" -> context.setTheme(R.style.Theme_Red)
|
||||
"blue" -> context.setTheme(R.style.Theme_Blue)
|
||||
"yellow" -> context.setTheme(R.style.Theme_Yellow)
|
||||
"green" -> context.setTheme(R.style.Theme_Green)
|
||||
@ -21,5 +21,11 @@ fun updateThemeMode(context: Context) {
|
||||
"A" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
"L" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
"D" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
"O" -> oledMode(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun oledMode(context: Context) {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
context.setTheme(R.style.Theme_OLED)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Theme.LibreTube" parent="Theme.Material3.Dark.NoActionBar">
|
||||
<style name="Theme.Red" parent="Theme.Material3.Dark.NoActionBar">
|
||||
|
||||
<item name="colorPrimary">@color/red_dark_accentLight</item> // container
|
||||
<item name="colorOnPrimary">@color/red_dark_accentDark</item> // title
|
||||
@ -94,5 +94,9 @@
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Theme.OLED" parent="Theme.Material3.Dark.NoActionBar">
|
||||
<item name="android:colorBackground">@color/black</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.LibreTube" parent="Theme.Material3.Light.NoActionBar">
|
||||
<style name="Theme.Red" parent="Theme.Material3.Light.NoActionBar">
|
||||
|
||||
<item name="colorPrimary">@color/red_light_accentLight</item> // container
|
||||
<item name="colorOnPrimary">@color/red_light_accentDark</item> // title
|
||||
|
@ -463,12 +463,14 @@
|
||||
<item>@string/systemDefault</item>
|
||||
<item>@string/lightTheme</item>
|
||||
<item>@string/darkTheme</item>
|
||||
<item>@string/oledTheme</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="themesValue">
|
||||
<item>A</item>
|
||||
<item>L</item>
|
||||
<item>D</item>
|
||||
<item>O</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="accents">
|
||||
|
@ -22,12 +22,12 @@
|
||||
<color name="blue_dark_accentDark">#0E4B67</color>
|
||||
<color name="blue_dark_background">#201A1A</color>
|
||||
|
||||
<color name="yellow_light_accentLight">#FFC107</color>
|
||||
<color name="yellow_light_accentDark">#AC6600</color>
|
||||
<color name="yellow_light_accentLight">#F3E570</color>
|
||||
<color name="yellow_light_accentDark">#EDE06A</color>
|
||||
<color name="yellow_light_background">#FFFFFF</color>
|
||||
|
||||
<color name="yellow_dark_accentLight">#FFC107</color>
|
||||
<color name="yellow_dark_accentDark">#714400</color>
|
||||
<color name="yellow_dark_accentLight">#E2EF55</color>
|
||||
<color name="yellow_dark_accentDark">#999520</color>
|
||||
<color name="yellow_dark_background">#201A1A</color>
|
||||
|
||||
<color name="green_light_accentLight">#8BC34A</color>
|
||||
@ -38,12 +38,12 @@
|
||||
<color name="green_dark_accentDark">#003A05</color>
|
||||
<color name="green_dark_background">#201A1A</color>
|
||||
|
||||
<color name="purple_light_accentLight">#972EA8</color>
|
||||
<color name="purple_light_accentDark">#371377</color>
|
||||
<color name="purple_light_accentLight">#db1fb6</color>
|
||||
<color name="purple_light_accentDark">#d42cb2</color>
|
||||
<color name="purple_light_background">#FFFFFF</color>
|
||||
|
||||
<color name="purple_dark_accentLight">#9621AA</color>
|
||||
<color name="purple_dark_accentDark">#2E1261</color>
|
||||
<color name="purple_dark_accentDark">#371377</color>
|
||||
<color name="purple_dark_background">#201A1A</color>
|
||||
|
||||
</resources>
|
@ -107,4 +107,5 @@
|
||||
<string name="color_yellow">Yellow</string>
|
||||
<string name="color_green">Green</string>
|
||||
<string name="color_purple">Purple</string>
|
||||
<string name="oledTheme">OLED Theme</string>
|
||||
</resources>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Theme.LibreTube" parent="Theme.Material3.Light.NoActionBar">
|
||||
<style name="Theme.Red" parent="Theme.Material3.Light.NoActionBar">
|
||||
|
||||
<item name="colorPrimary">@color/red_light_accentLight</item> // container
|
||||
<item name="colorOnPrimary">@color/red_light_accentDark</item> // title
|
||||
|
Loading…
Reference in New Issue
Block a user