Merge remote-tracking branch 'origin/master'

This commit is contained in:
Blatzar 2022-09-23 20:20:53 +02:00
commit 2a6d20cab4
8 changed files with 99 additions and 42 deletions

View file

@ -166,6 +166,8 @@ object CommonActivity {
"Light" -> R.style.LightMode "Light" -> R.style.LightMode
"Amoled" -> R.style.AmoledMode "Amoled" -> R.style.AmoledMode
"AmoledLight" -> R.style.AmoledModeLight "AmoledLight" -> R.style.AmoledModeLight
"Monet" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
R.style.MonetMode else R.style.AppTheme
else -> R.style.AppTheme else -> R.style.AppTheme
} }
@ -186,6 +188,10 @@ object CommonActivity {
"Banana" -> R.style.OverlayPrimaryColorBanana "Banana" -> R.style.OverlayPrimaryColorBanana
"Party" -> R.style.OverlayPrimaryColorParty "Party" -> R.style.OverlayPrimaryColorParty
"Pink" -> R.style.OverlayPrimaryColorPink "Pink" -> R.style.OverlayPrimaryColorPink
"Monet" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
R.style.OverlayPrimaryColorMonet else R.style.OverlayPrimaryColorNormal
"Monet2" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
R.style.OverlayPrimaryColorMonetTwo else R.style.OverlayPrimaryColorNormal
else -> R.style.OverlayPrimaryColorNormal else -> R.style.OverlayPrimaryColorNormal
} }
act.theme.applyStyle(currentTheme, true) act.theme.applyStyle(currentTheme, true)

View file

@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.ui.settings package com.lagradost.cloudstream3.ui.settings
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
@ -83,8 +84,20 @@ class SettingsUI : PreferenceFragmentCompat() {
} }
getPref(R.string.app_theme_key)?.setOnPreferenceClickListener { getPref(R.string.app_theme_key)?.setOnPreferenceClickListener {
val prefNames = resources.getStringArray(R.array.themes_names) val prefNames = resources.getStringArray(R.array.themes_names).toMutableList()
val prefValues = resources.getStringArray(R.array.themes_names_values) val prefValues = resources.getStringArray(R.array.themes_names_values).toMutableList()
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { // remove monet on android 11 and less
val toRemove = prefValues
.mapIndexed { idx, s -> if (s.startsWith("Monet")) idx else null }
.filterNotNull()
var offset = 0
toRemove.forEach { idx ->
prefNames.removeAt(idx - offset)
prefValues.removeAt(idx - offset)
offset += 1
}
}
val currentLayout = val currentLayout =
settingsManager.getString(getString(R.string.app_theme_key), prefValues.first()) settingsManager.getString(getString(R.string.app_theme_key), prefValues.first())
@ -107,8 +120,20 @@ class SettingsUI : PreferenceFragmentCompat() {
return@setOnPreferenceClickListener true return@setOnPreferenceClickListener true
} }
getPref(R.string.primary_color_key)?.setOnPreferenceClickListener { getPref(R.string.primary_color_key)?.setOnPreferenceClickListener {
val prefNames = resources.getStringArray(R.array.themes_overlay_names) val prefNames = resources.getStringArray(R.array.themes_overlay_names).toMutableList()
val prefValues = resources.getStringArray(R.array.themes_overlay_names_values) val prefValues = resources.getStringArray(R.array.themes_overlay_names_values).toMutableList()
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { // remove monet on android 11 and less
val toRemove = prefValues
.mapIndexed { idx, s -> if (s.startsWith("Monet")) idx else null }
.filterNotNull()
var offset = 0
toRemove.forEach { idx ->
prefNames.removeAt(idx - offset)
prefValues.removeAt(idx - offset)
offset += 1
}
}
val currentLayout = val currentLayout =
settingsManager.getString(getString(R.string.primary_color_key), prefValues.first()) settingsManager.getString(getString(R.string.primary_color_key), prefValues.first())

View file

@ -14,19 +14,6 @@
<item>@id/cast_button_type_forward_30_seconds</item> <item>@id/cast_button_type_forward_30_seconds</item>
</array> </array>
<array name="media_type_pref">
<item>Todos</item>
<item>Películas y TV</item>
<item>Anime</item>
<item>Documental</item>
</array>
<array name="media_type_pref_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</array>
<array name="limit_title_rez_pref_names"> <array name="limit_title_rez_pref_names">
<item>@string/resolution_and_title</item> <item>@string/resolution_and_title</item>
<item>@string/title</item> <item>@string/title</item>
@ -222,6 +209,8 @@
<item>Banana</item> <item>Banana</item>
<item>Fiesta</item> <item>Fiesta</item>
<item>Dolor rosa</item> <item>Dolor rosa</item>
<item>Material You</item>
<item>Material You (Secondary)</item>
</string-array> </string-array>
<string-array name="themes_overlay_names_values"> <string-array name="themes_overlay_names_values">
<item>Normal</item> <item>Normal</item>
@ -240,19 +229,24 @@
<item>Banana</item> <item>Banana</item>
<item>Party</item> <item>Party</item>
<item>Pink</item> <item>Pink</item>
<item>Monet</item>
<item>Monet2</item>
</string-array> </string-array>
<string-array name="themes_names"> <string-array name="themes_names">
<item>Oscuro</item> <item>Oscuro</item>
<item>Gris</item> <item>Gris</item>
<item>Amoled</item> <item>Amoled</item>
<item>Destello</item> <item>Destello</item>
<item>Material You</item>
</string-array> </string-array>
<string-array name="themes_names_values"> <string-array name="themes_names_values">
<item>AmoledLight</item> <item>AmoledLight</item>
<item>Black</item> <item>Black</item>
<item>Amoled</item> <item>Amoled</item>
<item>Light</item> <item>Light</item>
<item>Monet</item>
</string-array> </string-array>
<!--https://github.com/videolan/vlc-android/blob/72ccfb93db027b49855760001d1a930fa657c5a8/application/resources/src/main/res/values/arrays.xml#L266--> <!--https://github.com/videolan/vlc-android/blob/72ccfb93db027b49855760001d1a930fa657c5a8/application/resources/src/main/res/values/arrays.xml#L266-->

View file

@ -218,6 +218,8 @@
<item>Bananowy</item> <item>Bananowy</item>
<item>Łososiowy</item> <item>Łososiowy</item>
<item>Świnko peppowy</item> <item>Świnko peppowy</item>
<item>Material You</item>
<item>Material You (drugorzędny)</item>
</string-array> </string-array>
<string-array name="themes_overlay_names_values"> <string-array name="themes_overlay_names_values">
<item>Normal</item> <item>Normal</item>
@ -236,19 +238,24 @@
<item>Banana</item> <item>Banana</item>
<item>Party</item> <item>Party</item>
<item>Pink</item> <item>Pink</item>
<item>Monet</item>
<item>Monet2</item>
</string-array> </string-array>
<string-array name="themes_names"> <string-array name="themes_names">
<item>Ciemny</item> <item>Ciemny</item>
<item>Szary</item> <item>Szary</item>
<item>Amoled</item> <item>Amoled</item>
<item>Flashbang</item> <item>Flashbang</item>
<item>Material You</item>
</string-array> </string-array>
<string-array name="themes_names_values"> <string-array name="themes_names_values">
<item>AmoledLight</item> <item>AmoledLight</item>
<item>Black</item> <item>Black</item>
<item>Amoled</item> <item>Amoled</item>
<item>Light</item> <item>Light</item>
<item>Monet</item>
</string-array> </string-array>
<!--https://github.com/videolan/vlc-android/blob/72ccfb93db027b49855760001d1a930fa657c5a8/application/resources/src/main/res/values/arrays.xml#L266--> <!--https://github.com/videolan/vlc-android/blob/72ccfb93db027b49855760001d1a930fa657c5a8/application/resources/src/main/res/values/arrays.xml#L266-->

View file

@ -14,19 +14,6 @@
<item>@id/cast_button_type_forward_30_seconds</item> <item>@id/cast_button_type_forward_30_seconds</item>
</array> </array>
<array name="media_type_pref">
<item>Hepsi</item>
<item>Film ve Dizi</item>
<item>Anime</item>
<item>Belgesel</item>
</array>
<array name="media_type_pref_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</array>
<array name="limit_title_rez_pref_names"> <array name="limit_title_rez_pref_names">
<item>@string/resolution_and_title</item> <item>@string/resolution_and_title</item>
<item>@string/title</item> <item>@string/title</item>
@ -222,6 +209,8 @@
<item>Muz</item> <item>Muz</item>
<item>Parti</item> <item>Parti</item>
<item>Pembe</item> <item>Pembe</item>
<item>Material You</item>
<item>Material You (Secondary)</item>
</string-array> </string-array>
<string-array name="themes_overlay_names_values"> <string-array name="themes_overlay_names_values">
<item>Normal</item> <item>Normal</item>
@ -240,19 +229,24 @@
<item>Banana</item> <item>Banana</item>
<item>Party</item> <item>Party</item>
<item>Pink</item> <item>Pink</item>
<item>Monet</item>
<item>Monet2</item>
</string-array> </string-array>
<string-array name="themes_names"> <string-array name="themes_names">
<item>Koyu</item> <item>Koyu</item>
<item>Gri</item> <item>Gri</item>
<item>Amoled</item> <item>Amoled</item>
<item>Flaş Bombası</item> <item>Flaş Bombası</item>
<item>Material You</item>
</string-array> </string-array>
<string-array name="themes_names_values"> <string-array name="themes_names_values">
<item>AmoledLight</item> <item>AmoledLight</item>
<item>Black</item> <item>Black</item>
<item>Amoled</item> <item>Amoled</item>
<item>Light</item> <item>Light</item>
<item>Monet</item>
</string-array> </string-array>
<!--https://github.com/videolan/vlc-android/blob/72ccfb93db027b49855760001d1a930fa657c5a8/application/resources/src/main/res/values/arrays.xml#L266--> <!--https://github.com/videolan/vlc-android/blob/72ccfb93db027b49855760001d1a930fa657c5a8/application/resources/src/main/res/values/arrays.xml#L266-->

View file

@ -14,18 +14,6 @@
<item>@id/cast_button_type_forward_30_seconds</item> <item>@id/cast_button_type_forward_30_seconds</item>
</array> </array>
<array name="media_type_pref">
<item>Tất cả</item>
<item>Phim lẻ và Phim bộ</item>
<item>Anime</item>
<item>Phim tài liệu</item>
</array>
<array name="media_type_pref_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</array>
<array name="limit_title_rez_pref_names"> <array name="limit_title_rez_pref_names">
<item>@string/resolution_and_title</item> <item>@string/resolution_and_title</item>
@ -222,6 +210,8 @@
<item>Vàng</item> <item>Vàng</item>
<item>Hồng</item> <item>Hồng</item>
<item>Hồng đậm</item> <item>Hồng đậm</item>
<item>Material You</item>
<item>Material You (Secondary)</item>
</string-array> </string-array>
<string-array name="themes_overlay_names_values"> <string-array name="themes_overlay_names_values">
<item>Normal</item> <item>Normal</item>
@ -240,19 +230,24 @@
<item>Banana</item> <item>Banana</item>
<item>Party</item> <item>Party</item>
<item>Pink</item> <item>Pink</item>
<item>Monet</item>
<item>Monet2</item>
</string-array> </string-array>
<string-array name="themes_names"> <string-array name="themes_names">
<item>Tối</item> <item>Tối</item>
<item>Xám</item> <item>Xám</item>
<item>Amoled</item> <item>Amoled</item>
<item>Sáng</item> <item>Sáng</item>
<item>Material You</item>
</string-array> </string-array>
<string-array name="themes_names_values"> <string-array name="themes_names_values">
<item>AmoledLight</item> <item>AmoledLight</item>
<item>Black</item> <item>Black</item>
<item>Amoled</item> <item>Amoled</item>
<item>Light</item> <item>Light</item>
<item>Monet</item>
</string-array> </string-array>
<!--https://github.com/videolan/vlc-android/blob/72ccfb93db027b49855760001d1a930fa657c5a8/application/resources/src/main/res/values/arrays.xml#L266--> <!--https://github.com/videolan/vlc-android/blob/72ccfb93db027b49855760001d1a930fa657c5a8/application/resources/src/main/res/values/arrays.xml#L266-->

View file

@ -228,6 +228,8 @@
<item>Banana</item> <item>Banana</item>
<item>Party</item> <item>Party</item>
<item>Pink Pain</item> <item>Pink Pain</item>
<item>Material You</item>
<item>Material You (Secondary)</item>
</string-array> </string-array>
<string-array name="themes_overlay_names_values"> <string-array name="themes_overlay_names_values">
<item>Normal</item> <item>Normal</item>
@ -246,6 +248,8 @@
<item>Banana</item> <item>Banana</item>
<item>Party</item> <item>Party</item>
<item>Pink</item> <item>Pink</item>
<item>Monet</item>
<item>Monet2</item>
</string-array> </string-array>
<string-array name="themes_names"> <string-array name="themes_names">
@ -253,12 +257,14 @@
<item>Gray</item> <item>Gray</item>
<item>Amoled</item> <item>Amoled</item>
<item>Flashbang</item> <item>Flashbang</item>
<item>Material You</item>
</string-array> </string-array>
<string-array name="themes_names_values"> <string-array name="themes_names_values">
<item>AmoledLight</item> <item>AmoledLight</item>
<item>Black</item> <item>Black</item>
<item>Amoled</item> <item>Amoled</item>
<item>Light</item> <item>Light</item>
<item>Monet</item>
</string-array> </string-array>
<string-array name="extension_statuses"> <string-array name="extension_statuses">

View file

@ -95,6 +95,16 @@
<item name="white">#000</item> <item name="white">#000</item>
</style> </style>
<style name="MonetMode">
<item name="primaryGrayBackground">@color/material_dynamic_neutral20</item>
<item name="primaryBlackBackground">@color/material_dynamic_neutral10</item>
<item name="iconGrayBackground">@color/material_dynamic_neutral20</item>
<item name="boxItemBackground">@color/material_dynamic_neutral20</item>
<item name="textColor">@color/material_dynamic_neutral90</item>
<item name="grayTextColor">@color/material_dynamic_neutral60</item>
<item name="white">@color/material_dynamic_neutral90</item>
</style>
<style name="OverlayPrimaryColorNormal"> <style name="OverlayPrimaryColorNormal">
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimary">@color/colorPrimary</item> <item name="android:colorPrimary">@color/colorPrimary</item>
@ -105,6 +115,26 @@
<item name="android:colorAccent">@color/colorAccent</item> <item name="android:colorAccent">@color/colorAccent</item>
</style> </style>
<style name="OverlayPrimaryColorMonet">
<item name="colorPrimary">@color/material_dynamic_primary80</item>
<item name="android:colorPrimary">@color/material_dynamic_primary80</item>
<item name="colorPrimaryDark">@color/material_dynamic_primary30</item>
<item name="colorAccent">@color/material_dynamic_primary80</item>
<item name="colorOnPrimary">@color/material_dynamic_primary20</item>
<!-- Needed for leanback fuckery -->
<item name="android:colorAccent">@color/material_dynamic_primary30</item>
</style>
<style name="OverlayPrimaryColorMonetTwo">
<item name="colorPrimary">@color/material_dynamic_tertiary80</item>
<item name="android:colorPrimary">@color/material_dynamic_tertiary80</item>
<item name="colorPrimaryDark">@color/material_dynamic_tertiary30</item>
<item name="colorAccent">@color/material_dynamic_tertiary80</item>
<item name="colorOnPrimary">@color/material_dynamic_tertiary20</item>
<!-- Needed for leanback fuckery -->
<item name="android:colorAccent">@color/material_dynamic_tertiary30</item>
</style>
<style name="OverlayPrimaryColorBlue"> <style name="OverlayPrimaryColorBlue">
<item name="colorPrimary">@color/colorPrimaryBlue</item> <item name="colorPrimary">@color/colorPrimaryBlue</item>
<item name="android:colorPrimary">@color/colorPrimaryBlue</item> <item name="android:colorPrimary">@color/colorPrimaryBlue</item>