From a8c2caec3dde912762925e0f414c15317f9b0f31 Mon Sep 17 00:00:00 2001 From: LagradOst Date: Sun, 31 Oct 2021 15:14:01 +0100 Subject: [PATCH] app themes --- .../lagradost/cloudstream3/MainActivity.kt | 15 ++++---- .../ui/settings/SettingsFragment.kt | 23 ++++++++++++ app/src/main/res/color/item_select_color.xml | 5 +++ .../drawable/ic_baseline_bug_report_24.xml | 2 +- .../drawable/ic_baseline_color_lens_24.xml | 2 +- .../ic_baseline_developer_mode_24.xml | 2 +- .../main/res/drawable/ic_baseline_dns_24.xml | 2 +- .../main/res/drawable/ic_baseline_hd_24.xml | 2 +- .../ic_baseline_keyboard_arrow_right_24.xml | 2 +- .../res/drawable/ic_baseline_language_24.xml | 2 +- .../ic_baseline_notifications_active_24.xml | 2 +- .../ic_baseline_ondemand_video_24.xml | 2 +- .../ic_baseline_picture_in_picture_alt_24.xml | 2 +- .../res/drawable/ic_baseline_skip_next_24.xml | 2 +- .../drawable/ic_baseline_system_update_24.xml | 2 +- .../res/drawable/ic_baseline_touch_app_24.xml | 2 +- .../main/res/drawable/ic_baseline_tv_24.xml | 2 +- .../res/drawable/ic_baseline_warning_24.xml | 2 +- .../res/drawable/ic_outline_subtitles_24.xml | 2 +- .../drawable/ic_outline_voice_over_off_24.xml | 2 +- .../main/res/drawable/video_bottom_button.xml | 7 ++++ app/src/main/res/layout/activity_main.xml | 2 ++ app/src/main/res/layout/activity_main_tv.xml | 3 ++ .../main/res/layout/player_custom_layout.xml | 13 +++---- app/src/main/res/layout/toast.xml | 1 + app/src/main/res/values/array.xml | 11 ++++++ app/src/main/res/values/colors.xml | 10 +++--- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/values/styles.xml | 35 +++++++++++++++++-- app/src/main/res/xml/settings.xml | 5 +++ 30 files changed, 129 insertions(+), 37 deletions(-) create mode 100644 app/src/main/res/color/item_select_color.xml create mode 100644 app/src/main/res/drawable/video_bottom_button.xml diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt index 1291dbd8..d7a8c6a8 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt @@ -361,16 +361,12 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { } override fun onCreate(savedInstanceState: Bundle?) { - theme.applyStyle( - R.style.LoadedStyle, - true - ) // THEME IS SET BEFORE VIEW IS CREATED TO APPLY THE THEME TO THE MAIN VIEW - val settingsManager = PreferenceManager.getDefaultSharedPreferences(this) - val currentTheme = when (settingsManager.getString("theme", "")) { + val currentTheme = when (settingsManager.getString(getString(R.string.app_theme_key), "Black")) { "Black" -> R.style.AppTheme "Light" -> R.style.LightMode + "Amoled" -> R.style.AmoledMode else -> R.style.AppTheme } @@ -386,9 +382,14 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { else -> R.style.OverlayPrimaryColorNormal } - //theme.applyStyle(currentTheme, true) + theme.applyStyle(currentTheme, true) theme.applyStyle(currentOverlayTheme, true) + theme.applyStyle( + R.style.LoadedStyle, + true + ) // THEME IS SET BEFORE VIEW IS CREATED TO APPLY THE THEME TO THE MAIN VIEW + updateLocale() initRequestClient() super.onCreate(savedInstanceState) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt index 89e5d65f..318960f3 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt @@ -82,6 +82,7 @@ class SettingsFragment : PreferenceFragmentCompat() { val providerLangPreference = findPreference(getString(R.string.provider_lang_key))!! val allLayoutPreference = findPreference(getString(R.string.app_layout_key))!! val colorPrimaryPreference = findPreference(getString(R.string.primary_color_key))!! + val appThemePreference = findPreference(getString(R.string.app_theme_key))!! legalPreference.setOnPreferenceClickListener { val builder: AlertDialog.Builder = AlertDialog.Builder(it.context) @@ -207,6 +208,28 @@ class SettingsFragment : PreferenceFragmentCompat() { return@setOnPreferenceClickListener true } + appThemePreference.setOnPreferenceClickListener { + val prefNames = resources.getStringArray(R.array.themes_names) + val prefValues = resources.getStringArray(R.array.themes_names_values) + val settingsManager = PreferenceManager.getDefaultSharedPreferences(context) + + val currentLayout = settingsManager.getString( getString(R.string.app_theme_key),prefValues.first()) + context?.showBottomDialog( + prefNames.toList(), + prefValues.indexOf(currentLayout), + getString(R.string.app_theme_settings), + true, + {}) { + try { + settingsManager.edit().putString(getString(R.string.app_theme_key), prefValues[it]).apply() + activity?.recreate() + } catch (e : Exception) { + logError(e) + } + } + return@setOnPreferenceClickListener true + } + watchQualityPreference.setOnPreferenceClickListener { val prefNames = resources.getStringArray(R.array.quality_pref) val prefValues = resources.getIntArray(R.array.quality_pref_values) diff --git a/app/src/main/res/color/item_select_color.xml b/app/src/main/res/color/item_select_color.xml new file mode 100644 index 00000000..0d2834dd --- /dev/null +++ b/app/src/main/res/color/item_select_color.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_baseline_bug_report_24.xml b/app/src/main/res/drawable/ic_baseline_bug_report_24.xml index c72d5c25..dad38dca 100644 --- a/app/src/main/res/drawable/ic_baseline_bug_report_24.xml +++ b/app/src/main/res/drawable/ic_baseline_bug_report_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_color_lens_24.xml b/app/src/main/res/drawable/ic_baseline_color_lens_24.xml index b87ca001..3e6a50ae 100644 --- a/app/src/main/res/drawable/ic_baseline_color_lens_24.xml +++ b/app/src/main/res/drawable/ic_baseline_color_lens_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_developer_mode_24.xml b/app/src/main/res/drawable/ic_baseline_developer_mode_24.xml index 55febeee..a01f1048 100644 --- a/app/src/main/res/drawable/ic_baseline_developer_mode_24.xml +++ b/app/src/main/res/drawable/ic_baseline_developer_mode_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_dns_24.xml b/app/src/main/res/drawable/ic_baseline_dns_24.xml index b2677f76..e0fa55dc 100644 --- a/app/src/main/res/drawable/ic_baseline_dns_24.xml +++ b/app/src/main/res/drawable/ic_baseline_dns_24.xml @@ -3,7 +3,7 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" - android:tint="@color/white"> + android:tint="?attr/white"> diff --git a/app/src/main/res/drawable/ic_baseline_hd_24.xml b/app/src/main/res/drawable/ic_baseline_hd_24.xml index 02a314e9..5cfd9a65 100644 --- a/app/src/main/res/drawable/ic_baseline_hd_24.xml +++ b/app/src/main/res/drawable/ic_baseline_hd_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml b/app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml index e011dbcd..fc07eaae 100644 --- a/app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml +++ b/app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml @@ -1,5 +1,5 @@ diff --git a/app/src/main/res/drawable/ic_baseline_language_24.xml b/app/src/main/res/drawable/ic_baseline_language_24.xml index 0335ca0b..1749952e 100644 --- a/app/src/main/res/drawable/ic_baseline_language_24.xml +++ b/app/src/main/res/drawable/ic_baseline_language_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_notifications_active_24.xml b/app/src/main/res/drawable/ic_baseline_notifications_active_24.xml index 053e07ae..2003bfe7 100644 --- a/app/src/main/res/drawable/ic_baseline_notifications_active_24.xml +++ b/app/src/main/res/drawable/ic_baseline_notifications_active_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_ondemand_video_24.xml b/app/src/main/res/drawable/ic_baseline_ondemand_video_24.xml index bbd6d57b..80a75576 100644 --- a/app/src/main/res/drawable/ic_baseline_ondemand_video_24.xml +++ b/app/src/main/res/drawable/ic_baseline_ondemand_video_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_picture_in_picture_alt_24.xml b/app/src/main/res/drawable/ic_baseline_picture_in_picture_alt_24.xml index 941e803b..9b623071 100644 --- a/app/src/main/res/drawable/ic_baseline_picture_in_picture_alt_24.xml +++ b/app/src/main/res/drawable/ic_baseline_picture_in_picture_alt_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_skip_next_24.xml b/app/src/main/res/drawable/ic_baseline_skip_next_24.xml index 46804207..dca5cac8 100644 --- a/app/src/main/res/drawable/ic_baseline_skip_next_24.xml +++ b/app/src/main/res/drawable/ic_baseline_skip_next_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_system_update_24.xml b/app/src/main/res/drawable/ic_baseline_system_update_24.xml index 7ad99c9a..343016ee 100644 --- a/app/src/main/res/drawable/ic_baseline_system_update_24.xml +++ b/app/src/main/res/drawable/ic_baseline_system_update_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_touch_app_24.xml b/app/src/main/res/drawable/ic_baseline_touch_app_24.xml index 3a060f63..74c54fb9 100644 --- a/app/src/main/res/drawable/ic_baseline_touch_app_24.xml +++ b/app/src/main/res/drawable/ic_baseline_touch_app_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_tv_24.xml b/app/src/main/res/drawable/ic_baseline_tv_24.xml index d578ed0d..7194bf98 100644 --- a/app/src/main/res/drawable/ic_baseline_tv_24.xml +++ b/app/src/main/res/drawable/ic_baseline_tv_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_baseline_warning_24.xml b/app/src/main/res/drawable/ic_baseline_warning_24.xml index 3c9a4b35..f350c7a2 100644 --- a/app/src/main/res/drawable/ic_baseline_warning_24.xml +++ b/app/src/main/res/drawable/ic_baseline_warning_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_outline_subtitles_24.xml b/app/src/main/res/drawable/ic_outline_subtitles_24.xml index 3b0780bf..7d692c67 100644 --- a/app/src/main/res/drawable/ic_outline_subtitles_24.xml +++ b/app/src/main/res/drawable/ic_outline_subtitles_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_outline_voice_over_off_24.xml b/app/src/main/res/drawable/ic_outline_voice_over_off_24.xml index b6ed06ac..a77dfd72 100644 --- a/app/src/main/res/drawable/ic_outline_voice_over_off_24.xml +++ b/app/src/main/res/drawable/ic_outline_voice_over_off_24.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/video_bottom_button.xml b/app/src/main/res/drawable/video_bottom_button.xml new file mode 100644 index 00000000..ee4f97df --- /dev/null +++ b/app/src/main/res/drawable/video_bottom_button.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 078e52f9..ae179034 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -18,6 +18,8 @@ android:background="?attr/primaryGrayBackground" app:labelVisibilityMode="labeled" + app:itemTextColor="@color/item_select_color" + app:itemIconTint="@color/item_select_color" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" diff --git a/app/src/main/res/layout/activity_main_tv.xml b/app/src/main/res/layout/activity_main_tv.xml index 73382afb..6c396c0c 100644 --- a/app/src/main/res/layout/activity_main_tv.xml +++ b/app/src/main/res/layout/activity_main_tv.xml @@ -17,6 +17,9 @@ android:layout_height="wrap_content" android:background="?attr/primaryGrayBackground" + app:itemTextColor="@color/item_select_color" + app:itemIconTint="@color/item_select_color" + android:outlineSpotShadowColor="@color/transparent" android:outlineAmbientShadowColor="@color/transparent" diff --git a/app/src/main/res/layout/player_custom_layout.xml b/app/src/main/res/layout/player_custom_layout.xml index e6ebf249..61e493be 100644 --- a/app/src/main/res/layout/player_custom_layout.xml +++ b/app/src/main/res/layout/player_custom_layout.xml @@ -504,7 +504,8 @@ android:layout_marginEnd="20dp" card_view:cardCornerRadius="@dimen/card_corner_radius" card_view:cardBackgroundColor="@color/transparent" - android:foreground="?attr/selectableItemBackgroundBorderless" + + android:foreground="@drawable/video_bottom_button" card_view:cardElevation="0dp" tools:visibility="visible" > @@ -560,7 +561,7 @@ android:layout_marginEnd="20dp" card_view:cardCornerRadius="@dimen/card_corner_radius" card_view:cardBackgroundColor="@color/transparent" - android:foreground="?attr/selectableItemBackgroundBorderless" + android:foreground="@drawable/video_bottom_button" card_view:cardElevation="0dp" tools:visibility="visible" > @@ -608,7 +609,7 @@ android:layout_marginEnd="20dp" app:cardCornerRadius="@dimen/card_corner_radius" app:cardBackgroundColor="@color/transparent" - android:foreground="?attr/selectableItemBackgroundBorderless" + android:foreground="@drawable/video_bottom_button" app:cardElevation="0dp" > @@ -660,7 +661,7 @@ android:layout_marginEnd="20dp" card_view:cardCornerRadius="@dimen/card_corner_radius" card_view:cardBackgroundColor="@color/transparent" - android:foreground="?attr/selectableItemBackgroundBorderless" + android:foreground="@drawable/video_bottom_button" card_view:cardElevation="0dp" > @@ -710,7 +711,7 @@ android:layout_marginEnd="20dp" card_view:cardCornerRadius="@dimen/card_corner_radius" card_view:cardBackgroundColor="@color/transparent" - android:foreground="?attr/selectableItemBackgroundBorderless" + android:foreground="@drawable/video_bottom_button" card_view:cardElevation="0dp" > @@ -759,7 +760,7 @@ android:layout_marginEnd="20dp" card_view:cardCornerRadius="@dimen/card_corner_radius" card_view:cardBackgroundColor="@color/transparent" - android:foreground="?attr/selectableItemBackgroundBorderless" + android:foreground="@drawable/video_bottom_button" card_view:cardElevation="0dp" > Banana Party + + + Normal + Amoled + Flashbang + + + Black + Amoled + Light + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3ffe31b5..328a52b5 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -19,6 +19,8 @@ #00000000 #FFF + #000 + #3d50fa #803B65F5 #F54A3B @@ -39,10 +41,10 @@ #676767 - #fff - #EFEFEF - #FFF - #EDEDED + #f1f1f1 + #fff + #eeeeee + #eeeeee #202125 #5f6267 #5f6267 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 39ba9ec3..44f59de3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,6 +26,7 @@ dns_key app_layout_key primary_color_key + app_theme_key %d %s | %sMB @@ -302,4 +303,5 @@ Phone Layout Primary Color + App Theme diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index da07f6dc..da49da7c 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -8,9 +8,6 @@ ?attr/iconGrayBackground - ?attr/textColor - ?attr/textColor - @null @null @@ -32,6 +29,20 @@ @style/CustomCastMiniController + + ?attr/textColor + ?attr/grayTextColor + ?attr/grayTextColor + + ?attr/grayTextColor + ?attr/textColor + ?attr/textColor + ?attr/textColor + + true + true + + @color/colorPrimary @color/colorPrimaryDark @@ -46,6 +57,24 @@ #FFF + + + +