Ask restart when theme is changed

This commit is contained in:
Thomas 2022-11-14 12:15:43 +01:00
parent e9b62b71d1
commit e7dd79d8e0
6 changed files with 21 additions and 12 deletions

View File

@ -1,4 +1,4 @@
base_theme,0 base_theme,1
author,acn128 author,acn128
name,ACN name,ACN
theme_boost_header_color,-727060 theme_boost_header_color,-727060
@ -10,6 +10,6 @@ theme_icons_color,-15395562
pref_color_background,-1 pref_color_background,-1
pref_color_navigation_bar,true pref_color_navigation_bar,true
pref_color_status_bar,true pref_color_status_bar,true
theme_accent,-1 theme_accent,-14059009
theme_text_color,-13027015 theme_text_color,-13027015
theme_primary,-1 theme_primary,-1

1 base_theme 0 1
2 author acn128
3 name ACN
4 theme_boost_header_color -727060
10 pref_color_background -1
11 pref_color_navigation_bar true
12 pref_color_status_bar true
13 theme_accent -1 -14059009
14 theme_text_color -13027015
15 theme_primary -1

View File

@ -1,4 +1,4 @@
base_theme,0 base_theme,1
author,Animaly author,Animaly
name,Solarized - Cyan Accent name,Solarized - Cyan Accent
theme_boost_header_color,-69167 theme_boost_header_color,-69167
@ -7,9 +7,9 @@ theme_text_header_2_line,-7102047
theme_statuses_color,-133405 theme_statuses_color,-133405
theme_link_color,-14251054 theme_link_color,-14251054
theme_icons_color,-10106727 theme_icons_color,-10106727
pref_color_background,-1 pref_color_background,-1120043
pref_color_navigation_bar,true pref_color_navigation_bar,true
pref_color_status_bar,true pref_color_status_bar,true
theme_accent,-1 theme_accent,-8021760
theme_text_color,-16766154 theme_text_color,-16766154
theme_primary,-1 theme_primary,-1120043

1 base_theme 0 1
2 author Animaly
3 name Solarized - Cyan Accent
4 theme_boost_header_color -69167
7 theme_statuses_color -133405
8 theme_link_color -14251054
9 theme_icons_color -10106727
10 pref_color_background -1 -1120043
11 pref_color_navigation_bar true
12 pref_color_status_bar true
13 theme_accent -1 -8021760
14 theme_text_color -16766154
15 theme_primary -1 -1120043

View File

@ -338,6 +338,7 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements
if (launch_custom_theme != null) { if (launch_custom_theme != null) {
launch_custom_theme.setOnPreferenceClickListener(preference -> { launch_custom_theme.setOnPreferenceClickListener(preference -> {
startActivity(new Intent(requireActivity(), CyaneaSettingsActivity.class)); startActivity(new Intent(requireActivity(), CyaneaSettingsActivity.class));
shouldRestart = true;
return false; return false;
}); });
@ -456,6 +457,7 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements
ComposeActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE); ComposeActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
return true; return true;
} }
shouldRestart = true;
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*"); intent.setType("*/*");
@ -476,6 +478,7 @@ public class FragmentThemingSettings extends PreferenceFragmentCompat implements
createPref(); createPref();
}); });
shouldRestart = true;
dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss()); dialogBuilder.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
AlertDialog alertDialog = dialogBuilder.create(); AlertDialog alertDialog = dialogBuilder.create();
alertDialog.setCancelable(false); 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_statuses_color = appPref.getInt("theme_statuses_color", -1);
int theme_link_color = appPref.getInt("theme_link_color", -1); int theme_link_color = appPref.getInt("theme_link_color", -1);
int theme_icons_color = appPref.getInt("theme_icons_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_navigation_bar = cyneaPref.getBoolean("pref_color_navigation_bar", true);
boolean pref_color_status_bar = cyneaPref.getBoolean("pref_color_status_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_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); int theme = appPref.getInt(getString(R.string.SET_THEME), 0);

View File

@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:tint="#FFFFFF" android:tint="?attr/colorControlNormal"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path

View File

@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:tint="#FFFFFF" android:tint="?attr/colorControlNormal"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path

View File

@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:tint="#FFFFFF" android:tint="?attr/colorControlNormal"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path