Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Android Widgets: one palette of state colours for every Widget

Claude0de7af185f04
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/GlanceWidget.kt b/android/app/src/main/kotlin/com/coucou/android/app/GlanceWidget.kt
index 20d32502..c2a8c65e 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/GlanceWidget.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/GlanceWidget.kt
@@ -10,6 +10,7 @@ import android.widget.RemoteViews
import com.coucou.android.R
import com.coucou.android.core.Glance
import com.coucou.android.core.WidgetTone
+import com.coucou.android.core.look
import com.coucou.android.core.mood
/**
@@ -55,13 +56,14 @@ class GlanceWidget : AppWidgetProvider() {
private fun render(context: Context, g: Glance, size: WidgetHub.Size): RemoteViews {
val v = RemoteViews(context.packageName, R.layout.widget_glance)
- val tone = WidgetTone.of(g.tone)
+ val tone = g.look()
WidgetHub.paint(v, R.id.widget_root, R.id.glance_tint, tone)
val mood = g.mood()
- v.setImageViewBitmap(R.id.glance_mochi, MochiBitmap.of(mood, WidgetHub.px(context, 64), glow = true))
+ v.setImageViewBitmap(R.id.glance_mochi, MochiBitmap.of(mood, WidgetHub.px(context, 64), glow = true, tone = tone))
v.setContentDescription(R.id.glance_mochi, context.getString(R.string.widget_mochi_description, mood.key))
+ v.setViewVisibility(R.id.glance_offline, if (g.connected) View.GONE else View.VISIBLE)
v.setTextViewText(R.id.glance_headline, g.headline)
if (g.waiting > 0) {
v.setTextViewText(R.id.glance_badge, g.waiting.toString())
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/ListWidget.kt b/android/app/src/main/kotlin/com/coucou/android/app/ListWidget.kt
index 1e77da37..5d09c8cf 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/ListWidget.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/ListWidget.kt
@@ -47,7 +47,7 @@ class ListWidget : AppWidgetProvider() {
v.setViewVisibility(R.id.list_header, View.GONE)
v.setViewVisibility(R.id.list_rows, View.GONE)
v.setViewVisibility(R.id.list_empty, View.VISIBLE)
- v.setImageViewBitmap(R.id.list_empty_face, MochiBitmap.of(c.mood, WidgetHub.px(context, 96), glow = true))
+ v.setImageViewBitmap(R.id.list_empty_face, MochiBitmap.of(c.mood, WidgetHub.px(context, 96), glow = true, tone = c.look))
v.setContentDescription(R.id.list_empty_face, context.getString(R.string.widget_mochi_description, c.mood.key))
v.setImageViewResource(R.id.list_empty_icon, if (c.connected) R.drawable.widget_dot else R.drawable.ic_widget_offline)
v.setInt(R.id.list_empty_icon, "setColorFilter", c.look.argb)
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/MochiBigWidget.kt b/android/app/src/main/kotlin/com/coucou/android/app/MochiBigWidget.kt
index 79cfdb0a..c226763e 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/MochiBigWidget.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/MochiBigWidget.kt
@@ -51,15 +51,20 @@ class MochiBigWidget : AppWidgetProvider() {
val small = size == WidgetHub.Size.SMALL
// Left: Mochi with his glow, then the agent and its state word.
- v.setImageViewBitmap(R.id.big_mochi, MochiBitmap.of(c.mood, WidgetHub.px(context, if (large) 170 else if (small) 120 else 140), glow = true))
+ v.setImageViewBitmap(R.id.big_mochi, MochiBitmap.of(c.mood, WidgetHub.px(context, if (large) 170 else if (small) 120 else 140), glow = true, tone = c.look))
v.setContentDescription(R.id.big_mochi, context.getString(R.string.widget_mochi_description, (top?.stateWord ?: c.headline).lowercase()))
+ // Not connected: the "not connected" icon instead of the dot, and the headline instead of an agent.
+ v.setViewVisibility(R.id.big_offline, if (c.connected) View.GONE else View.VISIBLE)
if (top != null) {
v.setViewVisibility(R.id.big_row, View.VISIBLE)
+ v.setViewVisibility(R.id.big_dot, View.VISIBLE)
v.setInt(R.id.big_dot, "setColorFilter", top.tone.argb)
v.setTextViewText(R.id.big_name, top.name)
v.setTextViewText(R.id.big_state, top.stateWord)
} else {
- v.setViewVisibility(R.id.big_row, View.GONE)
+ v.setViewVisibility(R.id.big_row, if (c.connected) View.GONE else View.VISIBLE)
+ v.setViewVisibility(R.id.big_dot, View.GONE)
+ v.setTextViewText(R.id.big_name, c.headline)
v.setTextViewText(R.id.big_state, c.emptyLine.orEmpty())
}
v.setViewVisibility(R.id.big_state, View.VISIBLE)
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/MochiBitmap.kt b/android/app/src/main/kotlin/com/coucou/android/app/MochiBitmap.kt
index 6e79ef86..bda1cd03 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/MochiBitmap.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/MochiBitmap.kt
@@ -27,26 +27,29 @@ object MochiBitmap {
private const val SEED = 7
private const val SETTLE_FRAMES = 60
private const val FRAME_SEC = 1.0 / 60
- private const val KEEP = 12
+ private const val KEEP = 16
/** How strong the glow is at its centre; a muted state glows less. */
private const val GLOW_ALPHA = 0.55f
private const val GLOW_ALPHA_MUTED = 0.32f
- private data class Key(val state: BotState, val size: Int, val glow: Boolean)
+ private data class Key(val state: BotState, val size: Int, val glow: Boolean, val tone: WidgetTone)
private val cache = object : LinkedHashMap<Key, Bitmap>(16, 0.75f, true) {
override fun removeEldestEntry(eldest: MutableMap.MutableEntry<Key, Bitmap>) = size > KEEP
}
- /** Mochi in [state], [sizePx] pixels square. The same instance comes back while it is kept. */
+ /**
+ * Mochi in [state], [sizePx] pixels square. The glow is in [tone], the colour of the card he sits on (by default the one of his own
+ * state), so the Widget and its Mochi always share one colour. The same instance comes back while it is kept.
+ */
@Synchronized
- fun of(state: BotState, sizePx: Int, glow: Boolean = false): Bitmap {
- val key = Key(state, sizePx, glow)
- return cache.getOrPut(key) { draw(state, sizePx, glow) }
+ fun of(state: BotState, sizePx: Int, glow: Boolean = false, tone: WidgetTone = WidgetTone.of(state)): Bitmap {
+ val key = Key(state, sizePx, glow, tone)
+ return cache.getOrPut(key) { draw(state, sizePx, glow, tone) }
}
- private fun draw(state: BotState, sizePx: Int, glow: Boolean): Bitmap {
+ private fun draw(state: BotState, sizePx: Int, glow: Boolean, tone: WidgetTone): Bitmap {
var ms = 0.0
val engine = MochiEngine({ ms }, Random(SEED)).apply { setState(state, force = true) }
repeat(SETTLE_FRAMES) {
@@ -56,9 +59,8 @@ object MochiBitmap {
val image = ImageBitmap(sizePx, sizePx)
CanvasDrawScope().draw(Density(1f), LayoutDirection.Ltr, Canvas(image), Size(sizePx.toFloat(), sizePx.toFloat())) {
if (glow) {
- val tone = WidgetTone.of(state)
val centre = Offset(sizePx / 2f, sizePx / 2f)
- val light = Color(tone.argb).copy(alpha = if (tone == WidgetTone.MUTED) GLOW_ALPHA_MUTED else GLOW_ALPHA)
+ val light = Color(tone.argb).copy(alpha = if (tone == WidgetTone.MUTED || tone == WidgetTone.IDLE) GLOW_ALPHA_MUTED else GLOW_ALPHA)
drawCircle(Brush.radialGradient(listOf(light, Color.Transparent), centre, sizePx / 2f), sizePx / 2f, centre)
}
drawMochi(engine, ms / 1000)
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/MoodWidget.kt b/android/app/src/main/kotlin/com/coucou/android/app/MoodWidget.kt
index 6a7146a8..c20a0f69 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/MoodWidget.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/MoodWidget.kt
@@ -19,8 +19,9 @@ class MoodWidget : AppWidgetProvider() {
fun views(context: Context, c: WidgetContent): RemoteViews {
val v = RemoteViews(context.packageName, R.layout.widget_mood)
WidgetHub.paint(v, R.id.mood_root, R.id.mood_tint, c.look)
- v.setImageViewBitmap(R.id.mood_face, MochiBitmap.of(c.mood, WidgetHub.px(context, 64), glow = true))
+ v.setImageViewBitmap(R.id.mood_face, MochiBitmap.of(c.mood, WidgetHub.px(context, 64), glow = true, tone = c.look))
v.setContentDescription(R.id.mood_face, context.getString(R.string.widget_mochi_description, (c.top?.stateWord ?: c.headline).lowercase()))
+ v.setViewVisibility(R.id.mood_offline, if (c.connected) View.GONE else View.VISIBLE)
val top = c.top
v.setOnClickPendingIntent(
R.id.mood_root,
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/SoloWidget.kt b/android/app/src/main/kotlin/com/coucou/android/app/SoloWidget.kt
index 4f625ac5..8c60821e 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/SoloWidget.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/SoloWidget.kt
@@ -33,7 +33,7 @@ class SoloWidget : AppWidgetProvider() {
val large = size == WidgetHub.Size.LARGE
val small = size == WidgetHub.Size.SMALL
- v.setImageViewBitmap(R.id.solo_mochi, MochiBitmap.of(c.mood, WidgetHub.px(context, if (large) 150 else if (small) 72 else 104), glow = true))
+ v.setImageViewBitmap(R.id.solo_mochi, MochiBitmap.of(c.mood, WidgetHub.px(context, if (large) 150 else if (small) 72 else 104), glow = true, tone = c.look))
val word = top?.stateWord ?: c.headline
v.setContentDescription(R.id.solo_mochi, context.getString(R.string.widget_mochi_description, word.lowercase()))
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/TodayWidget.kt b/android/app/src/main/kotlin/com/coucou/android/app/TodayWidget.kt
index 90af1c91..ed2c0d30 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/TodayWidget.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/TodayWidget.kt
@@ -27,7 +27,7 @@ class TodayWidget : AppWidgetProvider() {
fun views(context: Context, c: WidgetContent): RemoteViews {
val v = RemoteViews(context.packageName, R.layout.widget_today)
WidgetHub.paint(v, R.id.today_root, R.id.today_tint, c.todayLook)
- v.setImageViewBitmap(R.id.today_face, MochiBitmap.of(c.todayMood, WidgetHub.px(context, 72), glow = true))
+ v.setImageViewBitmap(R.id.today_face, MochiBitmap.of(c.todayMood, WidgetHub.px(context, 72), glow = true, tone = c.todayLook))
v.setContentDescription(R.id.today_face, context.getString(R.string.widget_mochi_description, c.todayMood.key))
v.setTextViewText(R.id.today_count, c.today.toString())
v.setContentDescription(R.id.today_root, context.getString(R.string.widget_today_cd, c.today))
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/WaitingAlertWidget.kt b/android/app/src/main/kotlin/com/coucou/android/app/WaitingAlertWidget.kt
index f4d8cef7..f2a409c0 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/WaitingAlertWidget.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/WaitingAlertWidget.kt
@@ -21,8 +21,9 @@ class WaitingAlertWidget : AppWidgetProvider() {
fun views(context: Context, c: WidgetContent): RemoteViews {
val v = RemoteViews(context.packageName, R.layout.widget_alert)
WidgetHub.paint(v, R.id.alert_root, R.id.alert_tint, c.look)
- v.setImageViewBitmap(R.id.alert_face, MochiBitmap.of(c.mood, WidgetHub.px(context, 84), glow = true))
+ v.setImageViewBitmap(R.id.alert_face, MochiBitmap.of(c.mood, WidgetHub.px(context, 84), glow = true, tone = c.look))
v.setContentDescription(R.id.alert_face, context.getString(R.string.widget_mochi_description, c.mood.key))
+ v.setViewVisibility(R.id.alert_offline, if (c.connected) View.GONE else View.VISIBLE)
val waiting = c.waiting > 0
v.setViewVisibility(R.id.alert_count, if (waiting) View.VISIBLE else View.GONE)
v.setViewVisibility(R.id.alert_calm, if (waiting) View.GONE else View.VISIBLE)
diff --git a/android/app/src/main/kotlin/com/coucou/android/app/WidgetHub.kt b/android/app/src/main/kotlin/com/coucou/android/app/WidgetHub.kt
index b361bd87..ead2e98b 100644
--- a/android/app/src/main/kotlin/com/coucou/android/app/WidgetHub.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/app/WidgetHub.kt
@@ -84,14 +84,24 @@ object WidgetHub {
/** dp to pixels on this screen, at least 1. */
fun px(context: Context, dp: Int): Int = (dp * context.resources.displayMetrics.density).roundToInt().coerceAtLeast(1)
- /** The card and its gradient for a tone: an orange border while something waits, else the plain border; the tone's tint over it. */
+ /** The card (a 1dp border in the state's colour) and its gradient for a tone: the one place a Widget turns a state into colours. */
fun paint(v: RemoteViews, root: Int, tint: Int, tone: WidgetTone) {
- v.setInt(root, "setBackgroundResource", if (tone == WidgetTone.ATTENTION) R.drawable.widget_card_attention else R.drawable.widget_card)
+ v.setInt(root, "setBackgroundResource", cardOf(tone))
v.setInt(tint, "setBackgroundResource", tintOf(tone))
}
+ private fun cardOf(tone: WidgetTone): Int = when (tone) {
+ WidgetTone.MUTED -> R.drawable.widget_card_muted
+ WidgetTone.IDLE -> R.drawable.widget_card_idle
+ WidgetTone.WORKING -> R.drawable.widget_card_working
+ WidgetTone.ATTENTION -> R.drawable.widget_card_attention
+ WidgetTone.DONE -> R.drawable.widget_card_done
+ WidgetTone.TROUBLE -> R.drawable.widget_card_trouble
+ }
+
private fun tintOf(tone: WidgetTone): Int = when (tone) {
WidgetTone.MUTED -> R.drawable.widget_tint_muted
+ WidgetTone.IDLE -> R.drawable.widget_tint_idle
WidgetTone.WORKING -> R.drawable.widget_tint_working
WidgetTone.ATTENTION -> R.drawable.widget_tint_attention
WidgetTone.DONE -> R.drawable.widget_tint_done
diff --git a/android/app/src/main/kotlin/com/coucou/android/core/WidgetData.kt b/android/app/src/main/kotlin/com/coucou/android/core/WidgetData.kt
index 46766179..eb207c17 100644
--- a/android/app/src/main/kotlin/com/coucou/android/core/WidgetData.kt
+++ b/android/app/src/main/kotlin/com/coucou/android/core/WidgetData.kt
@@ -11,11 +11,22 @@ import com.coucou.android.mochi.Rgb
import kotlin.math.roundToInt
/**
- * How loud a widget looks: the colour of its dot, badge, glow and gradient. Taken from the app's own state colours
- * ([MochiConst]), so a Widget and Mochi on Home always agree. Waiting is orange, working blue, done green.
+ * The one palette of every Widget: the colour of the glow behind Mochi, the card's gradient and 1dp border, the status dot, the badge
+ * and the button tiles. Each tone has its colour in res/values/colors.xml (`widget_tone_<name>`, `widget_tint_<name>`,
+ * `widget_border_<name>`), and a test keeps the two in step; no Widget picks a colour of its own for a state.
+ *
+ * - [DONE] green: finished, Mochi's happy face.
+ * - [WORKING] blue.
+ * - [ATTENTION] orange: waiting for the user (an approval or a question).
+ * - [IDLE] soft grey: calm, "All calm", "No agents running".
+ * - [MUTED] muted grey, with the "not connected" icon: the computer is not there.
+ * - [TROUBLE] red: an agent stopped on an error or a limit.
+ *
+ * Taken from the app's own state colours ([MochiConst]), so a Widget and Mochi on Home always agree.
*/
enum class WidgetTone(val rgb: Rgb) {
MUTED(MochiConst.C_SLEEPING),
+ IDLE(Rgb(0.722, 0.741, 0.780)),
WORKING(MochiConst.C_WORKING),
ATTENTION(MochiConst.C_APPROVAL),
DONE(MochiConst.C_FINISHED),
@@ -28,22 +39,13 @@ enum class WidgetTone(val rgb: Rgb) {
companion object {
private fun c(v: Double) = (v.coerceIn(0.0, 1.0) * 255).roundToInt()
- /** The tone of a [Glance] (the summary widget, the tile and the notification share these five). */
- fun of(tone: GlanceTone): WidgetTone = when (tone) {
- GlanceTone.CALM -> MUTED
- GlanceTone.OK -> DONE
- GlanceTone.BUSY -> WORKING
- GlanceTone.ATTENTION -> ATTENTION
- GlanceTone.TROUBLE -> TROUBLE
- }
-
/** The tone of one agent's state; a computer that is not connected is always muted. */
fun of(state: BotState, connected: Boolean = true): WidgetTone = if (!connected) MUTED else when (state) {
BotState.APPROVAL, BotState.QUESTION -> ATTENTION
BotState.WORKING, BotState.THINKING, BotState.SEARCHING -> WORKING
BotState.FINISHED -> DONE
BotState.ERROR, BotState.RATELIMIT, BotState.DIZZY -> TROUBLE
- BotState.IDLE, BotState.SLEEPING -> MUTED
+ BotState.IDLE, BotState.SLEEPING -> IDLE
}
}
}
@@ -130,14 +132,18 @@ data class WidgetContent(
/** Mochi's face on the Today widget: pleased once something finished today, calm before. */
val todayMood: BotState get() = if (today > 0) BotState.FINISHED else BotState.IDLE
- /** The Today widget glows green once something finished today. */
- val todayLook: WidgetTone get() = if (today > 0) WidgetTone.DONE else WidgetTone.MUTED
+ /** The Today widget glows green once something finished today, soft grey before. */
+ val todayLook: WidgetTone get() = if (today > 0) WidgetTone.DONE else WidgetTone.IDLE
- /** The look of the whole widget: orange while something waits for you, else the top agent's tone, muted when nothing runs. */
+ /**
+ * The look of the whole widget. Not connected: muted. Something waits for you: orange. Otherwise the most urgent agent's tone, and
+ * the tiles are already in the order of [GlanceBuilder.rank] (waiting, then trouble, working, happy, idle): the top one decides.
+ * Connected with nothing to list: idle grey.
+ */
val look: WidgetTone get() = when {
!connected -> WidgetTone.MUTED
waiting > 0 -> WidgetTone.ATTENTION
- else -> top?.let { WidgetTone.of(it.state) } ?: WidgetTone.MUTED
+ else -> top?.let { WidgetTone.of(it.state) } ?: WidgetTone.IDLE
}
/** The state Mochi is drawn in: the top agent's, else calm when connected and asleep when not. */
@@ -162,6 +168,13 @@ enum class WidgetSample(val key: String) {
}
}
+/** The look of the summary widget, by the same rule as [WidgetContent.look]: its lines are already in the order of urgency. */
+fun Glance.look(): WidgetTone = when {
+ !connected -> WidgetTone.MUTED
+ waiting > 0 -> WidgetTone.ATTENTION
+ else -> lines.firstOrNull()?.let { WidgetTone.of(it.state) } ?: WidgetTone.IDLE
+}
+
/** The state of Mochi's face on the summary widget: the most urgent agent's, else calm when connected and asleep when not. */
fun Glance.mood(): BotState = lines.firstOrNull()?.state ?: if (connected) BotState.IDLE else BotState.SLEEPING
diff --git a/android/app/src/main/res/drawable/widget_badge_bg.xml b/android/app/src/main/res/drawable/widget_badge_bg.xml
index d4dfdefb..523b89ff 100644
--- a/android/app/src/main/res/drawable/widget_badge_bg.xml
+++ b/android/app/src/main/res/drawable/widget_badge_bg.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
+<!-- The "N waiting" badge: the waiting tone, from the shared palette. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
- <solid android:color="#FFFF9F0A" />
+ <solid android:color="@color/widget_tone_attention" />
<corners android:radius="10dp" />
</shape>
diff --git a/android/app/src/main/res/drawable/widget_bg.xml b/android/app/src/main/res/drawable/widget_bg.xml
deleted file mode 100644
index 8e68d251..00000000
--- a/android/app/src/main/res/drawable/widget_bg.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
- <solid android:color="#F21C1C1E" />
- <corners android:radius="22dp" />
-</shape>
diff --git a/android/app/src/main/res/drawable/widget_card_attention.xml b/android/app/src/main/res/drawable/widget_card_attention.xml
index 81e4f87c..e1155719 100644
--- a/android/app/src/main/res/drawable/widget_card_attention.xml
+++ b/android/app/src/main/res/drawable/widget_card_attention.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- The card while something waits for you: the same shape with an orange border. -->
+<!-- The card of a Widget in the "attention" tone: the shared card with a 1dp border in the state's colour. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/widget_card" />
- <stroke android:width="2dp" android:color="@color/widget_tone_attention" />
+ <stroke android:width="@dimen/widget_border_width" android:color="@color/widget_border_attention" />
<corners android:radius="@dimen/widget_radius" />
</shape>
diff --git a/android/app/src/main/res/drawable/widget_card_done.xml b/android/app/src/main/res/drawable/widget_card_done.xml
new file mode 100644
index 00000000..69f6a5ff
--- /dev/null
+++ b/android/app/src/main/res/drawable/widget_card_done.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The card of a Widget in the "done" tone: the shared card with a 1dp border in the state's colour. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="@color/widget_card" />
+ <stroke android:width="@dimen/widget_border_width" android:color="@color/widget_border_done" />
+ <corners android:radius="@dimen/widget_radius" />
+</shape>
diff --git a/android/app/src/main/res/drawable/widget_card_idle.xml b/android/app/src/main/res/drawable/widget_card_idle.xml
new file mode 100644
index 00000000..467f1bcd
--- /dev/null
+++ b/android/app/src/main/res/drawable/widget_card_idle.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The card of a Widget in the "idle" tone: the shared card with a 1dp border in the state's colour. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="@color/widget_card" />
+ <stroke android:width="@dimen/widget_border_width" android:color="@color/widget_border_idle" />
+ <corners android:radius="@dimen/widget_radius" />
+</shape>
diff --git a/android/app/src/main/res/drawable/widget_card_muted.xml b/android/app/src/main/res/drawable/widget_card_muted.xml
new file mode 100644
index 00000000..82f65f13
--- /dev/null
+++ b/android/app/src/main/res/drawable/widget_card_muted.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The card of a Widget in the "muted" tone: the shared card with a 1dp border in the state's colour. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="@color/widget_card" />
+ <stroke android:width="@dimen/widget_border_width" android:color="@color/widget_border_muted" />
+ <corners android:radius="@dimen/widget_radius" />
+</shape>
diff --git a/android/app/src/main/res/drawable/widget_card_trouble.xml b/android/app/src/main/res/drawable/widget_card_trouble.xml
new file mode 100644
index 00000000..fb03330c
--- /dev/null
+++ b/android/app/src/main/res/drawable/widget_card_trouble.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The card of a Widget in the "trouble" tone: the shared card with a 1dp border in the state's colour. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="@color/widget_card" />
+ <stroke android:width="@dimen/widget_border_width" android:color="@color/widget_border_trouble" />
+ <corners android:radius="@dimen/widget_radius" />
+</shape>
diff --git a/android/app/src/main/res/drawable/widget_card_working.xml b/android/app/src/main/res/drawable/widget_card_working.xml
new file mode 100644
index 00000000..d863320e
--- /dev/null
+++ b/android/app/src/main/res/drawable/widget_card_working.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The card of a Widget in the "working" tone: the shared card with a 1dp border in the state's colour. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="@color/widget_card" />
+ <stroke android:width="@dimen/widget_border_width" android:color="@color/widget_border_working" />
+ <corners android:radius="@dimen/widget_radius" />
+</shape>
diff --git a/android/app/src/main/res/drawable/widget_preview_image_alert.xml b/android/app/src/main/res/drawable/widget_preview_image_alert.xml
index 20540393..5e783be8 100644
--- a/android/app/src/main/res/drawable/widget_preview_image_alert.xml
+++ b/android/app/src/main/res/drawable/widget_preview_image_alert.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The picture the Widget picker shows on Android 11 (no previewLayout there): the card, its gradient and Mochi in the state of the sample. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/widget_card" />
+ <item android:drawable="@drawable/widget_card_attention" />
<item
android:left="1dp"
android:top="1dp"
diff --git a/android/app/src/main/res/drawable/widget_preview_image_big.xml b/android/app/src/main/res/drawable/widget_preview_image_big.xml
index e2acd65b..dfa53312 100644
--- a/android/app/src/main/res/drawable/widget_preview_image_big.xml
+++ b/android/app/src/main/res/drawable/widget_preview_image_big.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The picture the Widget picker shows on Android 11 (no previewLayout there): the card, its gradient and Mochi in the state of the sample. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/widget_card" />
+ <item android:drawable="@drawable/widget_card_working" />
<item
android:left="1dp"
android:top="1dp"
diff --git a/android/app/src/main/res/drawable/widget_preview_image_glance.xml b/android/app/src/main/res/drawable/widget_preview_image_glance.xml
index 368b1f9d..d294a91a 100644
--- a/android/app/src/main/res/drawable/widget_preview_image_glance.xml
+++ b/android/app/src/main/res/drawable/widget_preview_image_glance.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The picture the Widget picker shows on Android 11 (no previewLayout there): the card, its gradient and Mochi in the state of the sample. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/widget_card" />
+ <item android:drawable="@drawable/widget_card_working" />
<item
android:left="1dp"
android:top="1dp"
diff --git a/android/app/src/main/res/drawable/widget_preview_image_list.xml b/android/app/src/main/res/drawable/widget_preview_image_list.xml
index 56460bc5..5d751ed0 100644
--- a/android/app/src/main/res/drawable/widget_preview_image_list.xml
+++ b/android/app/src/main/res/drawable/widget_preview_image_list.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The picture the Widget picker shows on Android 11 (no previewLayout there): the card, its gradient and Mochi in the state of the sample. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/widget_card" />
+ <item android:drawable="@drawable/widget_card_attention" />
<item
android:left="1dp"
android:top="1dp"
diff --git a/android/app/src/main/res/drawable/widget_preview_image_mood.xml b/android/app/src/main/res/drawable/widget_preview_image_mood.xml
index dea5c2a5..3ce877f7 100644
--- a/android/app/src/main/res/drawable/widget_preview_image_mood.xml
+++ b/android/app/src/main/res/drawable/widget_preview_image_mood.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The picture the Widget picker shows on Android 11 (no previewLayout there): the card, its gradient and Mochi in the state of the sample. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/widget_card" />
+ <item android:drawable="@drawable/widget_card_done" />
<item
android:left="1dp"
android:top="1dp"
diff --git a/android/app/src/main/res/drawable/widget_preview_image_pill.xml b/android/app/src/main/res/drawable/widget_preview_image_pill.xml
index eaf9d610..982d0597 100644
--- a/android/app/src/main/res/drawable/widget_preview_image_pill.xml
+++ b/android/app/src/main/res/drawable/widget_preview_image_pill.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The picture the Widget picker shows on Android 11 (no previewLayout there): the card, its gradient and Mochi in the state of the sample. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/widget_card" />
+ <item android:drawable="@drawable/widget_card_working" />
<item
android:left="1dp"
android:top="1dp"
diff --git a/android/app/src/main/res/drawable/widget_preview_image_solo.xml b/android/app/src/main/res/drawable/widget_preview_image_solo.xml
index 20540393..5e783be8 100644
--- a/android/app/src/main/res/drawable/widget_preview_image_solo.xml
+++ b/android/app/src/main/res/drawable/widget_preview_image_solo.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The picture the Widget picker shows on Android 11 (no previewLayout there): the card, its gradient and Mochi in the state of the sample. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/widget_card" />
+ <item android:drawable="@drawable/widget_card_attention" />
<item
android:left="1dp"
android:top="1dp"
diff --git a/android/app/src/main/res/drawable/widget_preview_image_today.xml b/android/app/src/main/res/drawable/widget_preview_image_today.xml
index 5bad248a..3ba2d92e 100644
--- a/android/app/src/main/res/drawable/widget_preview_image_today.xml
+++ b/android/app/src/main/res/drawable/widget_preview_image_today.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- The picture the Widget picker shows on Android 11 (no previewLayout there): the card, its gradient and Mochi in the state of the sample. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:drawable="@drawable/widget_card" />
+ <item android:drawable="@drawable/widget_card_done" />
<item
android:left="1dp"
android:top="1dp"
diff --git a/android/app/src/main/res/drawable/widget_tint_idle.xml b/android/app/src/main/res/drawable/widget_tint_idle.xml
new file mode 100644
index 00000000..f71f96c0
--- /dev/null
+++ b/android/app/src/main/res/drawable/widget_tint_idle.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The gradient over a card in the "idle" tone: soft grey fading into the card. -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <gradient
+ android:angle="315"
+ android:startColor="@color/widget_tint_idle"
+ android:endColor="#00000000" />
+ <corners android:radius="@dimen/widget_radius" />
+</shape>
diff --git a/android/app/src/main/res/layout/widget_alert.xml b/android/app/src/main/res/layout/widget_alert.xml
index a757492e..fcdecd94 100644
--- a/android/app/src/main/res/layout/widget_alert.xml
+++ b/android/app/src/main/res/layout/widget_alert.xml
@@ -29,6 +29,14 @@
android:contentDescription="@string/widget_alert_label"
android:scaleType="fitCenter" />
+ <ImageView
+ android:id="@+id/alert_offline"
+ android:layout_width="18dp"
+ android:layout_height="18dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_offline"
+ android:visibility="gone" />
+
<TextView
android:id="@+id/alert_count"
android:layout_width="match_parent"
@@ -36,7 +44,7 @@
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
- android:textColor="@color/widget_tone_attention"
+ android:textColor="@color/widget_tone_attention_text"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone" />
diff --git a/android/app/src/main/res/layout/widget_big.xml b/android/app/src/main/res/layout/widget_big.xml
index 1ab5af7d..8c1d0db3 100644
--- a/android/app/src/main/res/layout/widget_big.xml
+++ b/android/app/src/main/res/layout/widget_big.xml
@@ -54,6 +54,15 @@
android:orientation="horizontal"
android:visibility="gone">
+ <ImageView
+ android:id="@+id/big_offline"
+ android:layout_width="18dp"
+ android:layout_height="18dp"
+ android:layout_marginEnd="2dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_offline"
+ android:visibility="gone" />
+
<ImageView
android:id="@+id/big_dot"
android:layout_width="@dimen/widget_dot"
@@ -515,7 +524,7 @@
android:minWidth="22dp"
android:paddingStart="6dp"
android:paddingEnd="6dp"
- android:textColor="#FF1C1C1E"
+ android:textColor="@color/widget_on_tone"
android:textSize="@dimen/widget_text_secondary"
android:textStyle="bold"
android:visibility="gone" />
diff --git a/android/app/src/main/res/layout/widget_glance.xml b/android/app/src/main/res/layout/widget_glance.xml
index 571d617c..e283330b 100644
--- a/android/app/src/main/res/layout/widget_glance.xml
+++ b/android/app/src/main/res/layout/widget_glance.xml
@@ -43,6 +43,15 @@
android:gravity="center_vertical"
android:orientation="horizontal">
+ <ImageView
+ android:id="@+id/glance_offline"
+ android:layout_width="16dp"
+ android:layout_height="16dp"
+ android:layout_marginEnd="6dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_offline"
+ android:visibility="gone" />
+
<TextView
android:id="@+id/glance_headline"
android:layout_width="0dp"
@@ -65,7 +74,7 @@
android:minWidth="22dp"
android:paddingStart="6dp"
android:paddingEnd="6dp"
- android:textColor="#FF1C1C1E"
+ android:textColor="@color/widget_on_tone"
android:textSize="@dimen/widget_text_secondary"
android:textStyle="bold"
android:visibility="gone" />
diff --git a/android/app/src/main/res/layout/widget_list.xml b/android/app/src/main/res/layout/widget_list.xml
index 3e4810b8..7d2f74c7 100644
--- a/android/app/src/main/res/layout/widget_list.xml
+++ b/android/app/src/main/res/layout/widget_list.xml
@@ -60,7 +60,7 @@
android:minWidth="22dp"
android:paddingStart="6dp"
android:paddingEnd="6dp"
- android:textColor="#FF1C1C1E"
+ android:textColor="@color/widget_on_tone"
android:textSize="@dimen/widget_text_secondary"
android:textStyle="bold"
android:visibility="gone" />
diff --git a/android/app/src/main/res/layout/widget_mood.xml b/android/app/src/main/res/layout/widget_mood.xml
index 4d010c01..8751c82d 100644
--- a/android/app/src/main/res/layout/widget_mood.xml
+++ b/android/app/src/main/res/layout/widget_mood.xml
@@ -21,4 +21,14 @@
android:contentDescription="@string/widget_mood_label"
android:padding="4dp"
android:scaleType="fitCenter" />
+
+ <ImageView
+ android:id="@+id/mood_offline"
+ android:layout_width="14dp"
+ android:layout_height="14dp"
+ android:layout_gravity="bottom|end"
+ android:layout_margin="3dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_offline"
+ android:visibility="gone" />
</FrameLayout>
diff --git a/android/app/src/main/res/layout/widget_preview_alert.xml b/android/app/src/main/res/layout/widget_preview_alert.xml
index 53d7323b..5240c7ff 100644
--- a/android/app/src/main/res/layout/widget_preview_alert.xml
+++ b/android/app/src/main/res/layout/widget_preview_alert.xml
@@ -35,7 +35,7 @@
android:gravity="center"
android:maxLines="1"
android:text="@string/widget_sample_two_waiting"
- android:textColor="@color/widget_tone_attention"
+ android:textColor="@color/widget_tone_attention_text"
android:textSize="20sp"
android:textStyle="bold" />
diff --git a/android/app/src/main/res/layout/widget_preview_big.xml b/android/app/src/main/res/layout/widget_preview_big.xml
index c4818343..7a26981d 100644
--- a/android/app/src/main/res/layout/widget_preview_big.xml
+++ b/android/app/src/main/res/layout/widget_preview_big.xml
@@ -6,7 +6,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/widget_card">
+ android:background="@drawable/widget_card_working">
<FrameLayout
android:layout_width="match_parent"
diff --git a/android/app/src/main/res/layout/widget_preview_glance.xml b/android/app/src/main/res/layout/widget_preview_glance.xml
index 35c1968d..10e97348 100644
--- a/android/app/src/main/res/layout/widget_preview_glance.xml
+++ b/android/app/src/main/res/layout/widget_preview_glance.xml
@@ -5,7 +5,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/widget_card">
+ android:background="@drawable/widget_card_working">
<FrameLayout
android:layout_width="match_parent"
diff --git a/android/app/src/main/res/layout/widget_preview_list.xml b/android/app/src/main/res/layout/widget_preview_list.xml
index f2737b97..c7db487a 100644
--- a/android/app/src/main/res/layout/widget_preview_list.xml
+++ b/android/app/src/main/res/layout/widget_preview_list.xml
@@ -5,7 +5,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/widget_card">
+ android:background="@drawable/widget_card_attention">
<FrameLayout
android:layout_width="match_parent"
@@ -57,7 +57,7 @@
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:text="@string/widget_sample_one"
- android:textColor="#FF1C1C1E"
+ android:textColor="@color/widget_on_tone"
android:textSize="@dimen/widget_text_secondary"
android:textStyle="bold" />
</LinearLayout>
diff --git a/android/app/src/main/res/layout/widget_preview_mood.xml b/android/app/src/main/res/layout/widget_preview_mood.xml
index 7c757b20..029549df 100644
--- a/android/app/src/main/res/layout/widget_preview_mood.xml
+++ b/android/app/src/main/res/layout/widget_preview_mood.xml
@@ -5,7 +5,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/widget_card">
+ android:background="@drawable/widget_card_done">
<FrameLayout
android:layout_width="match_parent"
diff --git a/android/app/src/main/res/layout/widget_preview_pill.xml b/android/app/src/main/res/layout/widget_preview_pill.xml
index 0ae78d31..2aaca5bb 100644
--- a/android/app/src/main/res/layout/widget_preview_pill.xml
+++ b/android/app/src/main/res/layout/widget_preview_pill.xml
@@ -5,7 +5,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/widget_card">
+ android:background="@drawable/widget_card_working">
<FrameLayout
android:layout_width="match_parent"
diff --git a/android/app/src/main/res/layout/widget_preview_solo.xml b/android/app/src/main/res/layout/widget_preview_solo.xml
index 057df344..441999f3 100644
--- a/android/app/src/main/res/layout/widget_preview_solo.xml
+++ b/android/app/src/main/res/layout/widget_preview_solo.xml
@@ -5,7 +5,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/widget_card">
+ android:background="@drawable/widget_card_attention">
<FrameLayout
android:layout_width="match_parent"
@@ -74,7 +74,7 @@
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:text="@string/widget_sample_one"
- android:textColor="#FF1C1C1E"
+ android:textColor="@color/widget_on_tone"
android:textSize="@dimen/widget_text_secondary"
android:textStyle="bold" />
</FrameLayout>
diff --git a/android/app/src/main/res/layout/widget_preview_today.xml b/android/app/src/main/res/layout/widget_preview_today.xml
index 958646ca..d8587d30 100644
--- a/android/app/src/main/res/layout/widget_preview_today.xml
+++ b/android/app/src/main/res/layout/widget_preview_today.xml
@@ -5,7 +5,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/widget_card">
+ android:background="@drawable/widget_card_done">
<FrameLayout
android:layout_width="match_parent"
diff --git a/android/app/src/main/res/layout/widget_solo.xml b/android/app/src/main/res/layout/widget_solo.xml
index be8d9c99..0e46f352 100644
--- a/android/app/src/main/res/layout/widget_solo.xml
+++ b/android/app/src/main/res/layout/widget_solo.xml
@@ -108,7 +108,7 @@
android:minWidth="22dp"
android:paddingStart="6dp"
android:paddingEnd="6dp"
- android:textColor="#FF1C1C1E"
+ android:textColor="@color/widget_on_tone"
android:textSize="@dimen/widget_text_secondary"
android:textStyle="bold"
android:visibility="gone" />
diff --git a/android/app/src/main/res/values-notnight/colors.xml b/android/app/src/main/res/values-notnight/colors.xml
index 68b8c167..78eed132 100644
--- a/android/app/src/main/res/values-notnight/colors.xml
+++ b/android/app/src/main/res/values-notnight/colors.xml
@@ -7,4 +7,6 @@
<color name="widget_text_soft">#D91C1C1E</color>
<color name="widget_text_secondary">#B31C1C1E</color>
<color name="widget_button">#14000000</color>
+ <!-- The orange as text on the light card needs a deeper shade to be readable. -->
+ <color name="widget_tone_attention_text">#FFA4570A</color>
</resources>
diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml
index 22e9418b..29c05ee0 100644
--- a/android/app/src/main/res/values/colors.xml
+++ b/android/app/src/main/res/values/colors.xml
@@ -11,6 +11,7 @@
<!-- The state palette: the same colours as Mochi's states (MochiConst) and WidgetTone. -->
<color name="widget_tone_muted">#FF94A2B8</color>
+ <color name="widget_tone_idle">#FFB8BDC7</color>
<color name="widget_tone_working">#FF3B9EFF</color>
<color name="widget_tone_attention">#FFF5A524</color>
<color name="widget_tone_done">#FF34D499</color>
@@ -18,8 +19,22 @@
<!-- The gradient of a card: the tone at 15 to 25 % alpha, fading into the card. -->
<color name="widget_tint_muted">#2694A2B8</color>
+ <color name="widget_tint_idle">#26B8BDC7</color>
<color name="widget_tint_working">#333B9EFF</color>
<color name="widget_tint_attention">#40F5A524</color>
<color name="widget_tint_done">#3334D499</color>
<color name="widget_tint_trouble">#33F4505E</color>
+
+ <!-- The 1dp border of a card: the tone at 60 % alpha, so the state shows on the edge too. -->
+ <color name="widget_border_muted">#9994A2B8</color>
+ <color name="widget_border_idle">#99B8BDC7</color>
+ <color name="widget_border_working">#993B9EFF</color>
+ <color name="widget_border_attention">#99F5A524</color>
+ <color name="widget_border_done">#9934D499</color>
+ <color name="widget_border_trouble">#99F4505E</color>
+
+ <!-- Text and glyphs drawn on the badge or on a tone colour. -->
+ <color name="widget_on_tone">#FF1C1C1E</color>
+ <!-- The tone as text colour: the tone itself on the dark card; in day mode a deeper one (see values-notnight). -->
+ <color name="widget_tone_attention_text">#FFF5A524</color>
</resources>