Browse Source

Add Obsidian theme

peter-dev
Stephen Paul Weber 4 months ago
parent
commit
1ab4ee326e
No known key found for this signature in database
GPG Key ID: D11C2911CE519CDE
  1. 182
      art/message_bubble_received_obsidian.svg
  2. 40
      src/cheogram/res/values/themes.xml
  3. 9
      src/main/java/eu/siacs/conversations/utils/ThemeHelper.java
  4. BIN
      src/main/res/drawable-mdpi/message_bubble_received_obsidian.9.png
  5. BIN
      src/main/res/drawable-xhdpi/message_bubble_received_obsidian.9.png
  6. BIN
      src/main/res/drawable-xxhdpi/message_bubble_received_obsidian.9.png
  7. BIN
      src/main/res/drawable-xxxhdpi/message_bubble_received_obsidian.9.png
  8. 2
      src/main/res/values-v29/theme-settings.xml
  9. 1
      src/main/res/values/strings.xml
  10. 2
      src/main/res/values/theme-settings.xml

182
art/message_bubble_received_obsidian.svg

@ -0,0 +1,182 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="36"
height="26"
id="svg2"
version="1.1"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
sodipodi:docname="message_bubble_received_obsidian.svg">
<defs
id="defs4">
<filter
x="-0.25"
y="-0.25"
width="1.5"
height="1.5"
inkscape:label="Drop Shadow"
id="filter3811"
color-interpolation-filters="sRGB">
<feFlood
flood-opacity="0.25"
flood-color="rgb(0,0,0)"
result="flood"
id="feFlood3813" />
<feComposite
in="flood"
in2="SourceGraphic"
operator="in"
result="composite1"
id="feComposite3815" />
<feGaussianBlur
stdDeviation="0.5"
result="blur"
id="feGaussianBlur3817" />
<feOffset
dx="0"
dy="1"
result="offset"
id="feOffset3819" />
<feComposite
in="SourceGraphic"
in2="offset"
operator="over"
result="composite2"
id="feComposite3821" />
</filter>
<linearGradient
id="paint0_linear"
x1="1260"
y1="1570.41"
x2="618.987"
y2="488.325"
gradientUnits="userSpaceOnUse">
<stop
stop-color="#7D01DD"
id="stop1226" />
<stop
offset="1"
stop-color="#8301E9"
id="stop1228" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="10.265754"
inkscape:cy="15.902718"
inkscape:document-units="px"
inkscape:current-layer="layer"
showgrid="true"
inkscape:window-width="2354"
inkscape:window-height="1060"
inkscape:window-x="1478"
inkscape:window-y="1092"
inkscape:window-maximized="0"
showguides="true"
inkscape:guide-bbox="true"
guidecolor="#000000"
guideopacity="0.49803922"
inkscape:document-rotation="0"
inkscape:snap-global="true">
<inkscape:grid
type="xygrid"
id="grid2985"
empspacing="4"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="1"
spacingy="1"
originx="0"
originy="0"
color="#0000ff"
opacity="0.03137255" />
<sodipodi:guide
orientation="1,0"
position="20,26"
id="guide3060" />
<sodipodi:guide
orientation="1,0"
position="24,26"
id="guide3062" />
<sodipodi:guide
orientation="0,1"
position="36,22"
id="guide3064" />
<sodipodi:guide
orientation="0,1"
position="36,6"
id="guide3066" />
<sodipodi:guide
orientation="1,0"
position="26,0"
id="guide3068" />
<sodipodi:guide
orientation="1,0"
position="18,0"
id="guide3070" />
<sodipodi:guide
orientation="0,1"
position="0,10"
id="guide3074" />
<sodipodi:guide
orientation="0,1"
position="0,8"
id="guide3076" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer"
inkscape:groupmode="layer"
id="layer"
transform="translate(0,-2)">
<g
id="g3759"
style="fill:#1e0036;fill-opacity:1;stroke:none;fill-rule:nonzero;filter:url(#filter3811)">
<path
style="display:none;fill:#1e0036;fill-opacity:1"
d="m 8,6 c 2,2 4,6 4,10 L 16,6 z"
id="path3805"
inkscape:connector-curvature="0"
transform="translate(0,2)"
sodipodi:nodetypes="cccc" />
<path
inkscape:connector-curvature="0"
id="path2989"
d="M 4,4 16,16 16,4 z"
sodipodi:nodetypes="cccc"
style="fill:#1e0036;fill-opacity:1" />
<rect
ry="2"
y="4"
x="12"
height="20"
width="20"
id="rect2987"
style="fill:#1e0036;fill-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

40
src/cheogram/res/values/themes.xml

@ -304,6 +304,22 @@
</item>
</style>
<style name="ConversationsTheme.Obsidian" parent="ConversationsTheme.Dark">
<item name="colorPrimary">#1E0036</item>
<item name="colorPrimaryDark">#1E0036</item>
<item name="colorAccent">@color/yeller</item>
<item name="message_bubble_received_monochrome" type="reference">
@drawable/message_bubble_received_grey
</item>
<item name="message_bubble_sent" type="reference">@drawable/message_bubble_sent_grey</item>
<item name="message_bubble_received_green" type="reference">
@drawable/message_bubble_received_obsidian
</item>
<item name="unread_count">#1E0036</item>
</style>
<style name="ConversationsTheme.Medium" parent="ConversationsTheme">
<item name="TextSizeCaption">14sp</item>
<item name="TextSizeBody1">16sp</item>
@ -328,6 +344,18 @@
<item name="IconSize">20sp</item>
</style>
<style name="ConversationsTheme.Obsidian.Medium" parent="ConversationsTheme.Obsidian">
<item name="TextSizeCaption">14sp</item>
<item name="TextSizeBody1">16sp</item>
<item name="TextSizeBody2">16sp</item>
<item name="TextSizeSubhead">18sp</item>
<item name="TextSizeTitle">22sp</item>
<item name="TextSizeDisplay2">47sp</item>
<item name="TextSizeInput">18sp</item>
<item name="TextSeparation">6sp</item>
<item name="IconSize">20sp</item>
</style>
<style name="ConversationsTheme.Dark.Large" parent="ConversationsTheme.Dark">
<item name="TextSizeCaption">16sp</item>
<item name="TextSizeBody1">18sp</item>
@ -340,6 +368,18 @@
<item name="IconSize">22sp</item>
</style>
<style name="ConversationsTheme.Obsidian.Large" parent="ConversationsTheme.Obsidian">
<item name="TextSizeCaption">16sp</item>
<item name="TextSizeBody1">18sp</item>
<item name="TextSizeBody2">18sp</item>
<item name="TextSizeSubhead">20sp</item>
<item name="TextSizeTitle">24sp</item>
<item name="TextSizeDisplay2">48sp</item>
<item name="TextSizeInput">20sp</item>
<item name="TextSeparation">7sp</item>
<item name="IconSize">22sp</item>
</style>
<style name="ConversationsTheme.Large" parent="ConversationsTheme">
<item name="TextSizeCaption">16sp</item>
<item name="TextSizeBody1">18sp</item>

9
src/main/java/eu/siacs/conversations/utils/ThemeHelper.java

@ -52,14 +52,18 @@ public class ThemeHelper {
public static int find(final Context context) {
final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
final Resources resources = context.getResources();
final String setting = sharedPreferences.getString(SettingsActivity.THEME, resources.getString(R.string.theme));
final boolean dark = isDark(sharedPreferences, resources);
final String fontSize = sharedPreferences.getString("font_size", resources.getString(R.string.default_font_size));
switch (fontSize) {
case "medium":
if ("obsidian".equals(setting)) return R.style.ConversationsTheme_Obsidian_Medium;
return dark ? R.style.ConversationsTheme_Dark_Medium : R.style.ConversationsTheme_Medium;
case "large":
if ("obsidian".equals(setting)) return R.style.ConversationsTheme_Obsidian_Large;
return dark ? R.style.ConversationsTheme_Dark_Large : R.style.ConversationsTheme_Large;
default:
if ("obsidian".equals(setting)) return R.style.ConversationsTheme_Obsidian;
return dark ? R.style.ConversationsTheme_Dark : R.style.ConversationsTheme;
}
}
@ -84,7 +88,7 @@ public class ThemeHelper {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && "automatic".equals(setting)) {
return (resources.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
} else {
return "dark".equals(setting);
return "dark".equals(setting) || "obsidian".equals(setting);
}
}
@ -93,6 +97,9 @@ public class ThemeHelper {
case R.style.ConversationsTheme_Dark:
case R.style.ConversationsTheme_Dark_Large:
case R.style.ConversationsTheme_Dark_Medium:
case R.style.ConversationsTheme_Obsidian:
case R.style.ConversationsTheme_Obsidian_Large:
case R.style.ConversationsTheme_Obsidian_Medium:
return true;
default:
return false;

BIN
src/main/res/drawable-mdpi/message_bubble_received_obsidian.9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

BIN
src/main/res/drawable-xhdpi/message_bubble_received_obsidian.9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
src/main/res/drawable-xxhdpi/message_bubble_received_obsidian.9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/main/res/drawable-xxxhdpi/message_bubble_received_obsidian.9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

2
src/main/res/values-v29/theme-settings.xml

@ -6,11 +6,13 @@
<item>@string/pref_theme_automatic</item>
<item>@string/pref_theme_light</item>
<item>@string/pref_theme_dark</item>
<item>@string/pref_theme_obsidian</item>
</string-array>
<string-array name="themes_values" tools:ignore="InconsistentArrays">
<item>automatic</item>
<item>light</item>
<item>dark</item>
<item>obsidian</item>
</string-array>
</resources>

1
src/main/res/values/strings.xml

@ -574,6 +574,7 @@
<string name="pref_theme_automatic">Automatic</string>
<string name="pref_theme_light">Light</string>
<string name="pref_theme_dark">Dark</string>
<string name="pref_theme_obsidian">Obsidian</string>
<string name="pref_use_green_background">Purple Background</string>
<string name="pref_use_green_background_summary">Use purple background for received messages</string>
<string name="unable_to_connect_to_keychain">Could not connect to OpenKeychain</string>

2
src/main/res/values/theme-settings.xml

@ -5,10 +5,12 @@
<string-array name="themes">
<item>@string/pref_theme_light</item>
<item>@string/pref_theme_dark</item>
<item>@string/pref_theme_obsidian</item>
</string-array>
<string-array name="themes_values">
<item>light</item>
<item>dark</item>
<item>obsidian</item>
</string-array>
</resources>

Loading…
Cancel
Save