Change summary
src/cheogram/res/values/colors.xml | 8 ++
src/cheogram/res/values/themes.xml | 6 +
src/main/java/eu/siacs/conversations/ui/SettingsActivity.java | 9 ++
src/main/java/eu/siacs/conversations/utils/ThemeHelper.java | 20 +++++
src/main/res/xml/preferences.xml | 10 ++
5 files changed, 52 insertions(+), 1 deletion(-)
Detailed changes
@@ -9,6 +9,14 @@
<color name="yeller">#FFC700</color>
<color name="custom_theme_primary">@color/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/grey700</color>
+ <color name="custom_theme_background_tertiary_dark">@color/grey900</color>
<color name="custom_theme_primary_dark">@color/black_perpy</color>
+
<color name="custom_theme_accent">@color/black_perpy</color>
</resources>
@@ -361,6 +361,9 @@
<style name="ConversationsTheme.Custom" parent="ConversationsTheme">
<item name="colorPrimary">@color/custom_theme_primary</item>
+ <item name="color_background_primary">@color/custom_theme_background_primary</item>
+ <item name="color_background_secondary">@color/custom_theme_background_secondary</item>
+ <item name="color_background_tertiary">@color/custom_theme_background_tertiary</item>
<item name="colorPrimaryDark">@color/custom_theme_primary_dark</item>
<item name="colorAccent">@color/custom_theme_accent</item>
<item name="message_bubble_received_bg">?colorPrimary</item>
@@ -369,6 +372,9 @@
<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="message_bubble_received_bg">?colorPrimary</item>
</style>
@@ -581,7 +581,14 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
xmppConnectionService.reinitializeMuclumbusService();
} else if (name.equals(AUTOMATIC_MESSAGE_DELETION)) {
xmppConnectionService.expireOldMessages(true);
- } else if (name.equals(THEME) || name.equals("custom_theme_primary") || name.equals("custom_theme_primary_dark") || name.equals("custom_theme_accent") || name.equals("custom_theme_dark")) {
+ } else if ( name.equals(THEME) ||
+ 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"))
+ {
final int theme = findTheme();
xmppConnectionService.setTheme(theme);
ThemeHelper.applyCustomColors(xmppConnectionService);
@@ -64,6 +64,26 @@ public class ThemeHelper {
if (sharedPreferences.contains("custom_theme_primary")) colors.put(R.color.custom_theme_primary, sharedPreferences.getInt("custom_theme_primary", 0));
if (sharedPreferences.contains("custom_theme_primary_dark")) colors.put(R.color.custom_theme_primary_dark, sharedPreferences.getInt("custom_theme_primary_dark", 0));
if (sharedPreferences.contains("custom_theme_accent")) colors.put(R.color.custom_theme_accent, sharedPreferences.getInt("custom_theme_accent", 0));
+ if (sharedPreferences.contains("custom_theme_background_primary")) {
+ int background_primary = sharedPreferences.getInt("custom_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, background_primary);
+ 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);
+ 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)(40 + red*.84) << 16) | ((int)(40 + green*.84) << 8) | (int)(40 + blue*.84)));
+ colors.put(R.color.custom_theme_background_tertiary_dark, (int)((alpha << 24) | ((int)(red*.5) << 16) | ((int)(green*.5) << 8) | (int)(blue*.5)));
+ }
if (colors.isEmpty()) return colors;
ResourcesLoader loader = ColorResourcesLoaderCreator.create(context, colors);
@@ -211,6 +211,16 @@
android:defaultValue="false"
android:key="custom_theme_dark"
android:title="Custom Theme is Dark?" />
+ <com.rarepebble.colorpicker.ColorPreference
+ android:key="custom_theme_background_primary"
+ android:title="Custom Background Color"
+ android:defaultValue="@color/grey50"
+ app:colorpicker_showAlpha="false" />
+ <com.rarepebble.colorpicker.ColorPreference
+ android:key="custom_theme_background_primary_dark"
+ android:title="Custom Dark Background Color"
+ android:defaultValue="@color/grey800"
+ app:colorpicker_showAlpha="false" />
<com.rarepebble.colorpicker.ColorPreference
android:key="custom_theme_primary"
android:title="Custom Primary Color"