-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpatch_awidget.diff
More file actions
33 lines (32 loc) · 1.89 KB
/
patch_awidget.diff
File metadata and controls
33 lines (32 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- app/src/main/java/com/leanbitlab/lwidget/AwidgetProvider.kt
+++ app/src/main/java/com/leanbitlab/lwidget/AwidgetProvider.kt
@@ -377,10 +377,28 @@
val primaryColor = resolveColor(textColorPrimaryIdx, true, useLightTheme)
val secondaryColor = resolveColor(textColorSecondaryIdx, false, useLightTheme)
+ val dateColorIdx = prefs.getInt("date_color_idx", 0)
+
// Slightly distinct colors for date and next alarm
val dateColor = if (useDynamicColors && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
// Warm accent for date
context.getColor(if (useLightTheme) android.R.color.system_accent2_700 else android.R.color.system_accent2_100)
} else {
- if (useLightTheme) android.graphics.Color.parseColor("#AA555544") else android.graphics.Color.parseColor("#BBDDDDCC")
+ when (dateColorIdx) {
+ 2 -> {
+ android.graphics.Color.rgb(
+ prefs.getInt("date_color_r", 255),
+ prefs.getInt("date_color_g", 255),
+ prefs.getInt("date_color_b", 255)
+ )
+ }
+ 1 -> {
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
+ context.getColor(android.R.color.system_accent2_500)
+ } else {
+ android.graphics.Color.YELLOW
+ }
+ }
+ else -> if (useLightTheme) android.graphics.Color.parseColor("#AA555544") else android.graphics.Color.parseColor("#BBDDDDCC")
+ }
}
val alarmColor = if (useDynamicColors && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {