diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 13a0ec59f..e863df646 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -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" diff --git a/app/src/main/java/com/github/libretube/MainActivity.kt b/app/src/main/java/com/github/libretube/MainActivity.kt index 01d4e9876..98edeb0da 100644 --- a/app/src/main/java/com/github/libretube/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/MainActivity.kt @@ -81,7 +81,6 @@ class MainActivity : AppCompatActivity() { } } else { setContentView(R.layout.activity_main) - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT bottomNavigationView = findViewById(R.id.bottomNav) diff --git a/app/src/main/java/com/github/libretube/SettingsActivity.kt b/app/src/main/java/com/github/libretube/SettingsActivity.kt index d48731739..7dd289cc4 100644 --- a/app/src/main/java/com/github/libretube/SettingsActivity.kt +++ b/app/src/main/java/com/github/libretube/SettingsActivity.kt @@ -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("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 } diff --git a/app/src/main/java/com/github/libretube/ThemeChanger.kt b/app/src/main/java/com/github/libretube/ThemeChanger.kt index 89beb0dcd..96374dd30 100644 --- a/app/src/main/java/com/github/libretube/ThemeChanger.kt +++ b/app/src/main/java/com/github/libretube/ThemeChanger.kt @@ -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) } -} \ No newline at end of file +} + +fun oledMode(context: Context) { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) + context.setTheme(R.style.Theme_OLED) +} diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 69816ca17..057d435cf 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -1,6 +1,6 @@ - - + + + \ No newline at end of file diff --git a/app/src/main/res/values-v23/themes.xml b/app/src/main/res/values-v23/themes.xml index 67099caf3..cb8b7ae5f 100644 --- a/app/src/main/res/values-v23/themes.xml +++ b/app/src/main/res/values-v23/themes.xml @@ -1,7 +1,7 @@ -