From e7dd79d8e03cc4ad26c6b359668ec04b3ec2f626 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 14 Nov 2022 12:15:43 +0100 Subject: [PATCH] Ask restart when theme is changed --- .../themes/contributors/Fedilab_theme_ACN.csv | 4 ++-- .../Fedilab_theme_Solarized_Cyan_Accent.csv | 8 ++++---- .../settings/FragmentThemingSettings.java | 15 ++++++++++++--- .../drawable/ic_baseline_account_circle_24.xml | 2 +- .../ic_baseline_keyboard_arrow_down_24.xml | 2 +- .../drawable/ic_baseline_keyboard_arrow_up_24.xml | 2 +- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/src/main/assets/themes/contributors/Fedilab_theme_ACN.csv b/app/src/main/assets/themes/contributors/Fedilab_theme_ACN.csv index 6e3a7168..c743dfdf 100644 --- a/app/src/main/assets/themes/contributors/Fedilab_theme_ACN.csv +++ b/app/src/main/assets/themes/contributors/Fedilab_theme_ACN.csv @@ -1,4 +1,4 @@ -base_theme,0 +base_theme,1 author,acn128 name,ACN theme_boost_header_color,-727060 @@ -10,6 +10,6 @@ theme_icons_color,-15395562 pref_color_background,-1 pref_color_navigation_bar,true pref_color_status_bar,true -theme_accent,-1 +theme_accent,-14059009 theme_text_color,-13027015 theme_primary,-1 diff --git a/app/src/main/assets/themes/contributors/Fedilab_theme_Solarized_Cyan_Accent.csv b/app/src/main/assets/themes/contributors/Fedilab_theme_Solarized_Cyan_Accent.csv index c88f8eac..5a259123 100644 --- a/app/src/main/assets/themes/contributors/Fedilab_theme_Solarized_Cyan_Accent.csv +++ b/app/src/main/assets/themes/contributors/Fedilab_theme_Solarized_Cyan_Accent.csv @@ -1,4 +1,4 @@ -base_theme,0 +base_theme,1 author,Animaly name,Solarized - Cyan Accent theme_boost_header_color,-69167 @@ -7,9 +7,9 @@ theme_text_header_2_line,-7102047 theme_statuses_color,-133405 theme_link_color,-14251054 theme_icons_color,-10106727 -pref_color_background,-1 +pref_color_background,-1120043 pref_color_navigation_bar,true pref_color_status_bar,true -theme_accent,-1 +theme_accent,-8021760 theme_text_color,-16766154 -theme_primary,-1 +theme_primary,-1120043 diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentThemingSettings.java b/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentThemingSettings.java index e2e2c8a3..fa39d9cf 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentThemingSettings.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentThemingSettings.java @@ -338,6 +338,7 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements if (launch_custom_theme != null) { launch_custom_theme.setOnPreferenceClickListener(preference -> { startActivity(new Intent(requireActivity(), CyaneaSettingsActivity.class)); + shouldRestart = true; return false; }); @@ -456,6 +457,7 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements ComposeActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE); return true; } + shouldRestart = true; Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); @@ -476,6 +478,7 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements createPref(); }); + shouldRestart = true; dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss()); AlertDialog alertDialog = dialogBuilder.create(); alertDialog.setCancelable(false); @@ -514,12 +517,18 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements int theme_statuses_color = appPref.getInt("theme_statuses_color", -1); int theme_link_color = appPref.getInt("theme_link_color", -1); int theme_icons_color = appPref.getInt("theme_icons_color", -1); - int pref_color_background = cyneaPref.getInt("pref_color_background", -1); + int pref_color_background; + if (cyneaPref.getString("base_theme", "DARK").compareTo("DARK") == 0) { + pref_color_background = cyneaPref.getInt("background_dark", -1); + } else { + pref_color_background = cyneaPref.getInt("background_light", -1); + } + boolean pref_color_navigation_bar = cyneaPref.getBoolean("pref_color_navigation_bar", true); boolean pref_color_status_bar = cyneaPref.getBoolean("pref_color_status_bar", true); - int theme_accent = cyneaPref.getInt("theme_accent", -1); + int theme_accent = cyneaPref.getInt("accent", -1); int theme_text_color = appPref.getInt("theme_text_color", -1); - int theme_primary = cyneaPref.getInt("theme_primary", -1); + int theme_primary = cyneaPref.getInt("primary", -1); int theme = appPref.getInt(getString(R.string.SET_THEME), 0); diff --git a/app/src/main/res/drawable/ic_baseline_account_circle_24.xml b/app/src/main/res/drawable/ic_baseline_account_circle_24.xml index 0b3fa82b..f9110996 100644 --- a/app/src/main/res/drawable/ic_baseline_account_circle_24.xml +++ b/app/src/main/res/drawable/ic_baseline_account_circle_24.xml @@ -1,7 +1,7 @@