Added flags "Show seconds" and "Use theme color" for clock widgets (#673)

* Added flags for use seconds and use theme color for clock widget, and "Display" clock style.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* Separator in "Display" clock changed to vector for consistency.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* "Use theme color" is now false by default.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* Added padding for all clocks.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* FIX: "Show seconds" was default true on VM, glitching the clock widget when first loaded.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* Clock time is now provided for a variable component as needed, splitting the current time provider by two.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* Compact mode is also considered for second/minute provider.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* Yet another tweak to Orbit clock colors.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* Separator flicker is now synced with second change for Display clock.

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>

* Update libraries

* Update IDEA Kotlin file

* Disable seconds by default

* Swap order of clock widget preferences

* Invert themed orbit clock colors

* Rename display clock style to 7 segment

* Make watch face names localizable

---------

Signed-off-by: Guillermo Villafuerte <gvillafu@comunidad.unam.mx>
Co-authored-by: MM20 <15646950+MM2-0@users.noreply.github.com>
This commit is contained in:
Guillermo Villafuerte
2024-03-29 14:54:38 +01:00
committed by GitHub
co-authored by MM20
parent dae97d47fb
commit 1a20458904
20 changed files with 1163 additions and 482 deletions
+12
View File
@@ -600,6 +600,8 @@
<string name="preference_clockwidget_layout">Layout</string>
<string name="preference_clockwidget_layout_vertical">Default</string>
<string name="preference_clockwidget_layout_horizontal">Compact</string>
<string name="preference_clock_widget_show_seconds">Show seconds</string>
<string name="preference_clock_widget_use_theme_color">Use theme color</string>
<string name="preference_clock_widget_fill_height">Fill screen height</string>
<string name="preference_clock_widget_fill_height_summary">Insert extra space above the clock to fill the entire screen height</string>
<string name="preference_clock_widget_color">Color</string>
@@ -900,4 +902,14 @@
<string name="unavailable_searchable">This item does not exist anymore.</string>
<string name="preference_search_bar_separate_work_profile">Separate work profile apps</string>
<string name="preference_search_bar_separate_work_profile_summary">Shows work profile apps in a separate tab</string>
<string name="clock_style_digital1">Bold</string>
<string name="clock_style_digital2">Simple</string>
<string name="clock_style_orbit">Orbit</string>
<string name="clock_style_binary">Binary</string>
<string name="clock_style_analog">Hands</string>
<string name="clock_style_segment">7 segment</string>
<string name="clock_style_empty">No clock</string>
<string name="clock_variant_standard">Standard</string>
<string name="clock_variant_outlined">Outlined</string>
</resources>
@@ -27,6 +27,8 @@ data class LauncherSettingsData(
val clockWidgetCompact: Boolean = false,
val clockWidgetStyle: ClockWidgetStyle = ClockWidgetStyle.Digital1(),
val clockWidgetColors: ClockWidgetColors = ClockWidgetColors.Auto,
val clockWidgetShowSeconds: Boolean = false,
val clockWidgetUseThemeColor: Boolean = false,
val clockWidgetAlarmPart: Boolean = true,
val clockWidgetBatteryPart: Boolean = true,
val clockWidgetMusicPart: Boolean = true,
@@ -189,7 +191,6 @@ sealed interface ClockWidgetStyle {
@Serializable
enum class Variant {
Default,
MDY,
OnePlus,
}
}
@@ -210,6 +211,10 @@ sealed interface ClockWidgetStyle {
@SerialName("binary")
data object Binary : ClockWidgetStyle
@Serializable
@SerialName("segment")
data object Segment : ClockWidgetStyle
@Serializable
@SerialName("empty")
data object Empty : ClockWidgetStyle
@@ -76,7 +76,7 @@ class Migration1(
LegacySettings.ClockWidgetSettings.ClockStyle.AnalogClock -> ClockWidgetStyle.Analog
LegacySettings.ClockWidgetSettings.ClockStyle.EmptyClock -> ClockWidgetStyle.Empty
LegacySettings.ClockWidgetSettings.ClockStyle.DigitalClock1_MDY -> ClockWidgetStyle.Digital1(
variant = ClockWidgetStyle.Digital1.Variant.MDY
variant = ClockWidgetStyle.Digital1.Variant.Default
)
LegacySettings.ClockWidgetSettings.ClockStyle.DigitalClock1_Outlined -> ClockWidgetStyle.Digital1(
@@ -96,12 +96,30 @@ class ClockWidgetSettings internal constructor(
}
}
val color
get() = launcherDataStore.data.map { it.clockWidgetColors }
fun setColor(color: ClockWidgetColors) {
launcherDataStore.update {
it.copy(clockWidgetColors = color)
}
}
val color
get() = launcherDataStore.data.map { it.clockWidgetColors }
val showSeconds
get() = launcherDataStore.data.map { it.clockWidgetShowSeconds }
fun setShowSeconds(enabled: Boolean) {
launcherDataStore.update {
it.copy(clockWidgetShowSeconds = enabled)
}
}
val useThemeColor
get() = launcherDataStore.data.map { it.clockWidgetUseThemeColor }
fun setUseThemeColor(enabled: Boolean) {
launcherDataStore.update {
it.copy(clockWidgetUseThemeColor = enabled)
}
}
}