Detailed changes
@@ -9,14 +9,16 @@
<color name="yeller">#FFC700</color>
<color name="custom_theme_primary">@color/perpy</color>
+ <color name="custom_theme_primary_dark">@color/black_perpy</color>
+ <color name="custom_theme_accent">@color/black_perpy</color>
<color name="custom_theme_background_primary">@color/grey50</color>
<color name="custom_theme_background_secondary">@color/grey200</color>
<color name="custom_theme_background_tertiary">@color/grey300</color>
- <color name="custom_theme_background_primary_dark">@color/grey800</color>
- <color name="custom_theme_background_secondary_dark">@color/grey900</color>
- <color name="custom_theme_background_tertiary_dark">@color/grey700</color>
- <color name="custom_theme_primary_dark">@color/black_perpy</color>
-
- <color name="custom_theme_accent">@color/black_perpy</color>
+ <color name="custom_dark_theme_primary">@color/perpy</color>
+ <color name="custom_dark_theme_primary_dark">@color/black_perpy</color>
+ <color name="custom_dark_theme_accent">@color/black_perpy</color>
+ <color name="custom_dark_theme_background_primary">@color/grey800</color>
+ <color name="custom_dark_theme_background_secondary">@color/grey900</color>
+ <color name="custom_dark_theme_background_tertiary">@color/grey700</color>
</resources>
@@ -370,12 +370,12 @@
</style>
<style name="ConversationsTheme.CustomDark" parent="ConversationsTheme.Dark">
- <item name="colorPrimary">@color/custom_theme_primary</item>
- <item name="colorPrimaryDark">@color/custom_theme_primary_dark</item>
- <item name="color_background_primary">@color/custom_theme_background_primary_dark</item>
- <item name="color_background_secondary">@color/custom_theme_background_secondary_dark</item>
- <item name="color_background_tertiary">@color/custom_theme_background_tertiary_dark</item>
- <item name="colorAccent">@color/custom_theme_accent</item>
+ <item name="colorPrimary">@color/custom_dark_theme_primary</item>
+ <item name="colorPrimaryDark">@color/custom_dark_theme_primary_dark</item>
+ <item name="color_background_primary">@color/custom_dark_theme_background_primary</item>
+ <item name="color_background_secondary">@color/custom_dark_theme_background_secondary</item>
+ <item name="color_background_tertiary">@color/custom_dark_theme_background_tertiary</item>
+ <item name="colorAccent">@color/custom_dark_theme_accent</item>
<item name="message_bubble_received_bg">?colorPrimary</item>
</style>
@@ -428,6 +428,19 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
final Preference customTheme = mSettingsFragment.findPreference("custom_theme");
if (customTheme != null) uiCategory.removePreference(customTheme);
}
+
+ final boolean customAutomatic = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("custom_theme_automatic", false);
+ if (Build.VERSION.SDK_INT > 30 && theTheme.equals("custom") && !customAutomatic) {
+ final PreferenceScreen customTheme = (PreferenceScreen) mSettingsFragment.findPreference("custom_theme");
+ final boolean isDark = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("custom_theme_dark", false);
+ if (isDark) {
+ final PreferenceCategory customThemeColors = (PreferenceCategory) mSettingsFragment.findPreference("custom_theme_colors");
+ customTheme.removePreference(customThemeColors);
+ } else {
+ final PreferenceCategory customThemeColorsDark = (PreferenceCategory) mSettingsFragment.findPreference("custom_theme_colors_dark");
+ customTheme.removePreference(customThemeColorsDark);
+ }
+ }
}
private void changeOmemoSettingSummary() {
@@ -583,12 +596,15 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
xmppConnectionService.expireOldMessages(true);
} else if ( name.equals(THEME) ||
name.equals("custom_theme_automatic") ||
+ name.equals("custom_theme_dark") ||
name.equals("custom_theme_primary") ||
name.equals("custom_theme_primary_dark") ||
name.equals("custom_theme_accent") ||
- name.equals("custom_theme_dark") ||
name.equals("custom_theme_background_primary") ||
- name.equals("custom_theme_background_primary_dark"))
+ name.equals("custom_dark_theme_primary") ||
+ name.equals("custom_dark_theme_primary_dark") ||
+ name.equals("custom_dark_theme_accent") ||
+ name.equals("custom_dark_theme_background_primary"))
{
final int theme = findTheme();
xmppConnectionService.setTheme(theme);
@@ -74,15 +74,18 @@ public class ThemeHelper {
colors.put(R.color.custom_theme_background_secondary, (int)((alpha << 24) | ((int)(red*.9) << 16) | ((int)(green*.9) << 8) | (int)(blue*.9)));
colors.put(R.color.custom_theme_background_tertiary, (int)((alpha << 24) | ((int)(red*.85) << 16) | ((int)(green*.85) << 8) | (int)(blue*.85)));
}
- if (sharedPreferences.contains("custom_theme_background_primary_dark")) {
- int background_primary = sharedPreferences.getInt("custom_theme_background_primary_dark", 0);
+ if (sharedPreferences.contains("custom_dark_theme_primary")) colors.put(R.color.custom_dark_theme_primary, sharedPreferences.getInt("custom_dark_theme_primary", 0));
+ if (sharedPreferences.contains("custom_dark_theme_primary_dark")) colors.put(R.color.custom_dark_theme_primary_dark, sharedPreferences.getInt("custom_dark_theme_primary_dark", 0));
+ if (sharedPreferences.contains("custom_dark_theme_accent")) colors.put(R.color.custom_dark_theme_accent, sharedPreferences.getInt("custom_dark_theme_accent", 0));
+ if (sharedPreferences.contains("custom_dark_theme_background_primary")) {
+ int background_primary = sharedPreferences.getInt("custom_dark_theme_background_primary", 0);
int alpha = (background_primary >> 24) & 0xFF;
int red = (background_primary >> 16) & 0xFF;
int green = (background_primary >> 8) & 0xFF;
int blue = background_primary & 0xFF;
- colors.put(R.color.custom_theme_background_primary_dark, background_primary);
- colors.put(R.color.custom_theme_background_secondary_dark, (int)((alpha << 24) | ((int)(red*.5) << 16) | ((int)(green*.5) << 8) | (int)(blue*.5)));
- colors.put(R.color.custom_theme_background_tertiary_dark, (int)((alpha << 24) | ((int)(40 + red*.84) << 16) | ((int)(40 + green*.84) << 8) | (int)(40 + blue*.84)));
+ colors.put(R.color.custom_dark_theme_background_primary, background_primary);
+ colors.put(R.color.custom_dark_theme_background_secondary, (int)((alpha << 24) | ((int)(red*.5) << 16) | ((int)(green*.5) << 8) | (int)(blue*.5)));
+ colors.put(R.color.custom_dark_theme_background_tertiary, (int)((alpha << 24) | ((int)(40 + red*.84) << 16) | ((int)(40 + green*.84) << 8) | (int)(40 + blue*.84)));
}
if (colors.isEmpty()) return colors;
@@ -202,21 +202,21 @@
android:selectable="false"
android:persistent="false"
android:summary="You may sometimes have to force quit the app to get changes applied."/>
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:disableDependentsState="true"
+ android:key="custom_theme_automatic"
+ android:title="Follow System Dark Mode?" />
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:dependency="custom_theme_automatic"
+ android:key="custom_theme_dark"
+ android:title="Custom Theme is Dark?" />
<PreferenceCategory
android:key="custom_theme_colors"
- android:title="Colors">
+ android:title="Light">
- <CheckBoxPreference
- android:defaultValue="false"
- android:disableDependentsState="true"
- android:key="custom_theme_automatic"
- android:title="Follow System Dark Mode?" />
- <CheckBoxPreference
- android:defaultValue="false"
- android:dependency="custom_theme_automatic"
- android:key="custom_theme_dark"
- android:title="Custom Theme is Dark?" />
<com.rarepebble.colorpicker.ColorPreference
android:key="custom_theme_primary"
android:title="Custom Primary Color"
@@ -224,7 +224,7 @@
app:colorpicker_showAlpha="false" />
<com.rarepebble.colorpicker.ColorPreference
android:key="custom_theme_primary_dark"
- android:title="Custom Primary Dark Color"
+ android:title="Custom Secondary Color"
android:defaultValue="@color/black_perpy"
app:colorpicker_showAlpha="false" />
<com.rarepebble.colorpicker.ColorPreference
@@ -237,13 +237,33 @@
android:title="Custom Background Color"
android:defaultValue="@color/grey50"
app:colorpicker_showAlpha="false" />
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:key="custom_theme_colors_dark"
+ app:isPreferenceVisible="false"
+ android:title="Dark">
+
<com.rarepebble.colorpicker.ColorPreference
- android:key="custom_theme_background_primary_dark"
- android:title="Custom Background Color (Dark)"
+ android:key="custom_dark_theme_primary"
+ android:title="Custom Primary Color"
+ android:defaultValue="@color/perpy"
+ app:colorpicker_showAlpha="false" />
+ <com.rarepebble.colorpicker.ColorPreference
+ android:key="custom_dark_theme_primary_dark"
+ android:title="Custom Secondary Color"
+ android:defaultValue="@color/black_perpy"
+ app:colorpicker_showAlpha="false" />
+ <com.rarepebble.colorpicker.ColorPreference
+ android:key="custom_dark_theme_accent"
+ android:title="Custom Accent Color"
+ android:defaultValue="@color/black_perpy"
+ app:colorpicker_showAlpha="false" />
+ <com.rarepebble.colorpicker.ColorPreference
+ android:key="custom_dark_theme_background_primary"
+ android:title="Custom Background Color"
android:defaultValue="@color/grey800"
app:colorpicker_showAlpha="false" />
</PreferenceCategory>
-
<intent
android:action="android.intent.action.VIEW"
android:targetClass="eu.siacs.conversations.ui.SettingsActivity"