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: Mochi Big without the speech bubble, in two sides

Claude22e124e38525
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 5a84a665..7c2f0614 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
@@ -1,10 +1,10 @@
package com.coucou.android.app
+import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.Context
import android.util.SizeF
-import android.util.TypedValue
import android.view.View
import android.widget.RemoteViews
import com.coucou.android.R
@@ -13,31 +13,31 @@ import com.coucou.android.core.WidgetContent
import com.coucou.android.core.WidgetTone
/**
- * The Mochi Big widget: a large Mochi with a glow and a speech bubble that says who is doing what in plain words
- * ([WidgetContent.bubble]: a name and a state, never a command or a file). Drawn by [WidgetHub] when something changes
- * (updatePeriodMillis = 0). A tap on the card opens the top agent, or the app. Below the status line are buttons (Home, Chat, Settings, Recent, the top agent, Pair again): none when the card is small, one row of four, then two rows; they only open things.
+ * The Mochi Big widget (4x4). The top is in two sides. On the left, Mochi with his glow and his badge, then the agent's name and
+ * state word, so the state reads without a sentence. On the right, the plan usage, or one calm message when it is off or the computer
+ * is not there. Under them, rounded buttons that only open a screen of the app (Home, Chat, Settings, Recent, the top agent, Pair
+ * again): none when the card is small, one row of four from the medium size, two rows of three when large. They are tinted orange
+ * while something waits. Drawn by [WidgetHub] when something changes (updatePeriodMillis = 0). A tap on the card opens the top agent,
+ * or the app. Nothing here changes anything.
*/
class MochiBigWidget : AppWidgetProvider() {
override fun onUpdate(context: Context, manager: AppWidgetManager, ids: IntArray) =
WidgetHub.refresh(context, manager, ids) { c, w -> views(c, w) }
companion object {
- // Height in dp, so that Mochi keeps at least 40% of the card: under 290 no buttons, from 290 one row of four, from 400 two rows.
+ // Height in dp: under 290 no buttons, from 290 one row of four, from 400 two rows of three.
private val MEDIUM_AT = SizeF(0f, 290f)
private val LARGE_AT = SizeF(0f, 400f)
- private class Tile(val view: Int, val screen: LaunchScreen?)
-
- // Home, Chat, Settings, Recent; then the top agent (a session, not a screen) and Pair again.
- private val TILES = listOf(
- Tile(R.id.big_tile_home, LaunchScreen.HOME),
- Tile(R.id.big_tile_chat, LaunchScreen.CHAT),
- Tile(R.id.big_tile_settings, LaunchScreen.SETTINGS),
- Tile(R.id.big_tile_recent, LaunchScreen.RECENT),
- Tile(R.id.big_tile_session, null),
- Tile(R.id.big_tile_pair, LaunchScreen.PAIR),
+ /** The six buttons, in order; null is the top agent (a session, not a screen). */
+ private val BUTTONS: List<LaunchScreen?> = listOf(
+ LaunchScreen.HOME, LaunchScreen.CHAT, LaunchScreen.SETTINGS, LaunchScreen.RECENT, null, LaunchScreen.PAIR,
)
+ // The same buttons in the two arrangements: the first four in the single row, all six in the two rows of three.
+ private val ROW_TILES = listOf(R.id.big_m_home, R.id.big_m_chat, R.id.big_m_settings, R.id.big_m_recent)
+ private val GRID_TILES = listOf(R.id.big_l_home, R.id.big_l_chat, R.id.big_l_settings, R.id.big_l_recent, R.id.big_l_session, R.id.big_l_pair)
+
fun views(context: Context, c: WidgetContent): RemoteViews =
WidgetHub.responsive(MEDIUM_AT, LARGE_AT) { size -> render(context, c, size) }
@@ -48,11 +48,9 @@ class MochiBigWidget : AppWidgetProvider() {
val large = size == WidgetHub.Size.LARGE
val small = size == WidgetHub.Size.SMALL
- v.setTextViewText(R.id.big_bubble, c.bubble)
- v.setTextViewTextSize(R.id.big_bubble, TypedValue.COMPLEX_UNIT_SP, if (large) 19f else if (small) 14f else 16f)
- v.setImageViewBitmap(R.id.big_mochi, MochiBitmap.of(c.mood, WidgetHub.px(context, if (large) 240 else if (small) 110 else 180), glow = true))
+ // 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.setContentDescription(R.id.big_mochi, context.getString(R.string.widget_mochi_description, (top?.stateWord ?: c.headline).lowercase()))
-
if (top != null) {
v.setViewVisibility(R.id.big_row, View.VISIBLE)
v.setInt(R.id.big_dot, "setColorFilter", top.tone.argb)
@@ -60,20 +58,22 @@ class MochiBigWidget : AppWidgetProvider() {
v.setTextViewText(R.id.big_state, top.stateWord)
} else {
v.setViewVisibility(R.id.big_row, View.GONE)
+ v.setTextViewText(R.id.big_state, c.emptyLine.orEmpty())
}
+ v.setViewVisibility(R.id.big_state, View.VISIBLE)
- // The buttons: none when small, one row of four by default, two rows when tall. They only open things.
+ bindUsage(v, context, c)
+
+ // Buttons: none when small, one row of four by default, two rows of three when large. They only open things.
v.setViewVisibility(R.id.big_buttons, if (small) View.GONE else View.VISIBLE)
- v.setViewVisibility(R.id.big_buttons_b, if (large) View.VISIBLE else View.GONE)
+ v.setViewVisibility(R.id.big_buttons_m, if (large) View.GONE else View.VISIBLE)
+ v.setViewVisibility(R.id.big_buttons_l, if (large) View.VISIBLE else View.GONE)
val tile = if (c.look == WidgetTone.ATTENTION) R.drawable.widget_tile_bg_attention else R.drawable.widget_tile_bg
- TILES.forEachIndexed { i, t ->
- v.setInt(t.view, "setBackgroundResource", tile)
- val open = when {
- t.screen != null -> WidgetHub.openScreen(context, WidgetHub.CODE_BIG_BUTTON + i, t.screen)
- top != null -> WidgetHub.openSession(context, WidgetHub.CODE_BIG_BUTTON + i, top.pillId)
- else -> WidgetHub.openScreen(context, WidgetHub.CODE_BIG_BUTTON + i, LaunchScreen.HOME) // no agent yet: the app
+ for (tiles in listOf(ROW_TILES, GRID_TILES)) {
+ tiles.forEachIndexed { i, id ->
+ v.setInt(id, "setBackgroundResource", tile)
+ v.setOnClickPendingIntent(id, buttonIntent(context, c, i))
}
- v.setOnClickPendingIntent(t.view, open)
}
if (c.waiting > 0) {
@@ -89,5 +89,32 @@ class MochiBigWidget : AppWidgetProvider() {
)
return v
}
+
+ /** What button [i] opens. Both arrangements use the same code for the same button, so no two buttons share one. */
+ private fun buttonIntent(context: Context, c: WidgetContent, i: Int): PendingIntent {
+ val screen = BUTTONS[i]
+ val top = c.top
+ return when {
+ screen != null -> WidgetHub.openScreen(context, WidgetHub.CODE_BIG_BUTTON + i, screen)
+ top != null -> WidgetHub.openSession(context, WidgetHub.CODE_BIG_BUTTON + i, top.pillId)
+ else -> WidgetHub.openScreen(context, WidgetHub.CODE_BIG_BUTTON + i, LaunchScreen.HOME) // no agent yet: the app
+ }
+ }
+
+ /** The right side. A calm message, never an empty area: the computer is not there, or plan usage is off. */
+ private fun bindUsage(v: RemoteViews, context: Context, c: WidgetContent) {
+ v.setViewVisibility(R.id.big_usage_a, View.GONE)
+ v.setViewVisibility(R.id.big_usage_b, View.GONE)
+ v.setViewVisibility(R.id.big_off, View.VISIBLE)
+ if (!c.connected) {
+ v.setTextViewText(R.id.big_off_title, context.getString(R.string.widget_big_not_connected))
+ v.setTextViewText(R.id.big_off_line, c.emptyLine.orEmpty())
+ v.setOnClickPendingIntent(R.id.big_right, WidgetHub.openApp(context, WidgetHub.CODE_BIG_USAGE_APP))
+ } else {
+ v.setTextViewText(R.id.big_off_title, context.getString(R.string.widget_big_usage_off))
+ v.setTextViewText(R.id.big_off_line, context.getString(R.string.widget_big_usage_off_line))
+ v.setOnClickPendingIntent(R.id.big_right, WidgetHub.openScreen(context, WidgetHub.CODE_BIG_USAGE_SETTINGS, LaunchScreen.SETTINGS))
+ }
+ }
}
}
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 59da9a8c..b361bd87 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
@@ -163,4 +163,8 @@ object WidgetHub {
const val CODE_PILL_BUTTON = 0x5A00
const val CODE_BIG_BUTTON = 0x5B00
const val CODE_GLANCE = 0x5C00
+
+ /** Mochi Big's usage side: Settings when plan usage is off, the app otherwise. */
+ const val CODE_BIG_USAGE_SETTINGS = 0x5D00
+ const val CODE_BIG_USAGE_APP = 0x5E00
}
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 13fcab46..e4d612e6 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
@@ -98,24 +98,6 @@ data class WidgetContent(
else -> "No agents running"
}
- /** What Mochi says in his speech bubble: the agent's name and its state, nothing about what it is doing. */
- val bubble: String get() {
- val t = top ?: return emptyLine.orEmpty()
- if (waiting > 1) return "$waiting things are waiting for you"
- return when (t.state) {
- BotState.APPROVAL -> "${t.name} is waiting for you"
- BotState.QUESTION -> "${t.name} has a question"
- BotState.WORKING -> "${t.name} is working"
- BotState.THINKING -> "${t.name} is thinking"
- BotState.SEARCHING -> "${t.name} is searching"
- BotState.FINISHED -> "${t.name} is done"
- BotState.ERROR -> "${t.name} stopped on an error"
- BotState.RATELIMIT -> "${t.name} hit a limit"
- BotState.DIZZY -> "${t.name} needs a look"
- BotState.IDLE, BotState.SLEEPING -> "${t.name} is idle"
- }
- }
-
/** The Waiting Alert's line: "2 waiting" in orange, or a calm word. */
val alertLine: String get() = when {
!connected -> "Not connected"
diff --git a/android/app/src/main/res/layout/widget_big.xml b/android/app/src/main/res/layout/widget_big.xml
index 5533d871..1ab5af7d 100644
--- a/android/app/src/main/res/layout/widget_big.xml
+++ b/android/app/src/main/res/layout/widget_big.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- The Mochi Big widget: a large Mochi with a glow, a speech bubble that says who is doing what in plain words (never a command or a file), and the agent's name and state. Plain RemoteViews. -->
+<!-- The Mochi Big widget (4x4). Top, in two sides: on the left Mochi with his glow and badge, then the agent's name and state word;
+ on the right the plan usage (up to two rows with a big percentage and a thin bar) or one calm message when it is off or the computer is
+ not there. Under them, rounded buttons that only open a screen of the app: one row of four at the medium size, two rows of three
+ when large, none when small. Until the first update it shows a calm Mochi and a short line. Plain RemoteViews. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/big_root"
android:layout_width="match_parent"
@@ -16,264 +19,487 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="12dp">
- <TextView
- android:id="@+id/big_bubble"
- android:text="@string/widget_initial_line"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/widget_bubble"
- android:ellipsize="end"
- android:gravity="center"
- android:maxLines="2"
- android:paddingStart="16dp"
- android:paddingTop="8dp"
- android:paddingEnd="16dp"
- android:paddingBottom="8dp"
- android:textColor="@color/widget_bubble_text"
- android:textSize="@dimen/widget_text_name"
- android:textStyle="bold" />
-
- <ImageView
- android:layout_width="20dp"
- android:layout_height="10dp"
- android:importantForAccessibility="no"
- android:src="@drawable/widget_bubble_tail" />
-
- <ImageView
- android:id="@+id/big_mochi"
- android:src="@drawable/preview_mochi_idle"
+ <LinearLayout
+ android:id="@+id/big_top"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
- android:contentDescription="@string/widget_big_label"
- android:scaleType="fitCenter" />
-
- <LinearLayout
- android:id="@+id/big_row"
- android:visibility="gone"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
android:orientation="horizontal">
- <ImageView
- android:id="@+id/big_dot"
- android:tint="@color/widget_tone_muted"
- android:layout_width="@dimen/widget_dot"
- android:layout_height="@dimen/widget_dot"
- android:importantForAccessibility="no"
- android:src="@drawable/widget_dot" />
-
- <TextView
- android:id="@+id/big_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:ellipsize="end"
- android:maxLines="1"
- android:textColor="@color/widget_text"
- android:textSize="@dimen/widget_text_name"
- android:textStyle="bold" />
-
- <TextView
- android:id="@+id/big_state"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:ellipsize="end"
- android:maxLines="1"
- android:textColor="@color/widget_text_secondary"
- android:textSize="@dimen/widget_text_state" />
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/big_buttons"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:orientation="vertical"
- android:visibility="gone">
-
<LinearLayout
- android:id="@+id/big_buttons_a"
- android:layout_width="match_parent"
- android:layout_height="@dimen/widget_tile_height"
- android:orientation="horizontal">
-
- <LinearLayout
- android:id="@+id/big_tile_home"
+ android:id="@+id/big_left"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_marginStart="3dp"
- android:layout_marginEnd="3dp"
- android:layout_weight="1"
- android:background="@drawable/widget_tile_bg"
- android:gravity="center"
+ android:layout_weight="45"
+ android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
- android:layout_width="22dp"
- android:layout_height="22dp"
- android:importantForAccessibility="no"
- android:src="@drawable/ic_widget_home" />
+ android:id="@+id/big_mochi"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:contentDescription="@string/widget_big_label"
+ android:scaleType="fitCenter"
+ android:src="@drawable/preview_mochi_idle" />
- <TextView
+ <LinearLayout
+ android:id="@+id/big_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:ellipsize="end"
- android:maxLines="1"
- android:text="@string/widget_btn_home"
- android:textColor="@color/widget_text"
- android:textSize="@dimen/widget_text_secondary" />
- </LinearLayout>
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:visibility="gone">
- <LinearLayout
- android:id="@+id/big_tile_chat"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_marginStart="3dp"
- android:layout_marginEnd="3dp"
- android:layout_weight="1"
- android:background="@drawable/widget_tile_bg"
- android:gravity="center"
- android:orientation="vertical">
+ <ImageView
+ android:id="@+id/big_dot"
+ android:layout_width="@dimen/widget_dot"
+ android:layout_height="@dimen/widget_dot"
+ android:importantForAccessibility="no"
+ android:src="@drawable/widget_dot"
+ android:tint="@color/widget_tone_muted" />
- <ImageView
- android:layout_width="22dp"
- android:layout_height="22dp"
- android:importantForAccessibility="no"
- android:src="@drawable/ic_widget_chat" />
+ <TextView
+ android:id="@+id/big_name"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="6dp"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_name"
+ android:textStyle="bold" />
+ </LinearLayout>
<TextView
- android:layout_width="wrap_content"
+ android:id="@+id/big_state"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
+ android:gravity="center"
android:maxLines="1"
- android:text="@string/widget_btn_chat"
- android:textColor="@color/widget_text"
- android:textSize="@dimen/widget_text_secondary" />
+ android:textColor="@color/widget_text_secondary"
+ android:textSize="@dimen/widget_text_state"
+ android:visibility="gone" />
</LinearLayout>
<LinearLayout
- android:id="@+id/big_tile_settings"
+ android:id="@+id/big_right"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_marginStart="3dp"
- android:layout_marginEnd="3dp"
- android:layout_weight="1"
- android:background="@drawable/widget_tile_bg"
- android:gravity="center"
+ android:layout_marginStart="8dp"
+ android:layout_weight="55"
+ android:gravity="center_vertical"
android:orientation="vertical">
- <ImageView
- android:layout_width="22dp"
- android:layout_height="22dp"
- android:importantForAccessibility="no"
- android:src="@drawable/ic_widget_settings" />
+ <LinearLayout
+ android:id="@+id/big_usage_a"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="0dp"
+ android:orientation="vertical"
+ android:visibility="gone">
<TextView
- android:layout_width="wrap_content"
+ android:id="@+id/big_usage_a_label"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
- android:text="@string/widget_btn_settings"
- android:textColor="@color/widget_text"
+ android:textColor="@color/widget_text_secondary"
android:textSize="@dimen/widget_text_secondary" />
- </LinearLayout>
- <LinearLayout
- android:id="@+id/big_tile_recent"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_marginStart="3dp"
- android:layout_marginEnd="3dp"
- android:layout_weight="1"
- android:background="@drawable/widget_tile_bg"
- android:gravity="center"
- android:orientation="vertical">
+ <TextView
+ android:id="@+id/big_usage_a_pct"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_big"
+ android:textStyle="bold" />
<ImageView
- android:layout_width="22dp"
- android:layout_height="22dp"
+ android:id="@+id/big_usage_a_bar"
+ android:layout_width="match_parent"
+ android:layout_height="6dp"
+ android:layout_marginTop="2dp"
android:importantForAccessibility="no"
- android:src="@drawable/ic_widget_recent" />
+ android:scaleType="fitXY" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_usage_b"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:orientation="vertical"
+ android:visibility="gone">
<TextView
- android:layout_width="wrap_content"
+ android:id="@+id/big_usage_b_label"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
- android:text="@string/widget_btn_recent"
- android:textColor="@color/widget_text"
+ android:textColor="@color/widget_text_secondary"
android:textSize="@dimen/widget_text_secondary" />
+
+ <TextView
+ android:id="@+id/big_usage_b_pct"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:maxLines="1"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_big"
+ android:textStyle="bold" />
+
+ <ImageView
+ android:id="@+id/big_usage_b_bar"
+ android:layout_width="match_parent"
+ android:layout_height="6dp"
+ android:layout_marginTop="2dp"
+ android:importantForAccessibility="no"
+ android:scaleType="fitXY" />
</LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_off"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/big_off_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="2"
+ android:text="@string/widget_initial_title"
+ android:textColor="@color/widget_text_soft"
+ android:textSize="@dimen/widget_text_note"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/big_off_line"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="2dp"
+ android:ellipsize="end"
+ android:maxLines="2"
+ android:text="@string/widget_initial_line"
+ android:textColor="@color/widget_text_secondary"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
</LinearLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_buttons"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:orientation="vertical"
+ android:visibility="gone">
<LinearLayout
- android:id="@+id/big_buttons_b"
+ android:id="@+id/big_buttons_m"
android:layout_width="match_parent"
android:layout_height="@dimen/widget_tile_height"
- android:layout_marginTop="6dp"
- android:orientation="horizontal"
- android:visibility="gone">
+ android:orientation="horizontal">
- <LinearLayout
- android:id="@+id/big_tile_session"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_marginStart="3dp"
- android:layout_marginEnd="3dp"
- android:layout_weight="1"
- android:background="@drawable/widget_tile_bg"
- android:gravity="center"
- android:orientation="vertical">
+ <LinearLayout
+ android:id="@+id/big_m_home"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
- <ImageView
- android:layout_width="22dp"
- android:layout_height="22dp"
- android:importantForAccessibility="no"
- android:src="@drawable/ic_widget_session" />
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_home" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:ellipsize="end"
- android:maxLines="1"
- android:text="@string/widget_btn_session"
- android:textColor="@color/widget_text"
- android:textSize="@dimen/widget_text_secondary" />
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_home"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_m_chat"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_chat" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_chat"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_m_settings"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_settings" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_settings"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_m_recent"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_recent" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_recent"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
</LinearLayout>
<LinearLayout
- android:id="@+id/big_tile_pair"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_marginStart="3dp"
- android:layout_marginEnd="3dp"
- android:layout_weight="1"
- android:background="@drawable/widget_tile_bg"
- android:gravity="center"
- android:orientation="vertical">
+ android:id="@+id/big_buttons_l"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:visibility="gone">
- <ImageView
- android:layout_width="22dp"
- android:layout_height="22dp"
- android:importantForAccessibility="no"
- android:src="@drawable/ic_widget_pair" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/widget_tile_height"
+ android:orientation="horizontal">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:ellipsize="end"
- android:maxLines="1"
- android:text="@string/widget_btn_pair"
- android:textColor="@color/widget_text"
- android:textSize="@dimen/widget_text_secondary" />
- </LinearLayout>
+ <LinearLayout
+ android:id="@+id/big_l_home"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_home" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_home"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_l_chat"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_chat" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_chat"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_l_settings"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_settings" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_settings"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/widget_tile_height"
+ android:layout_marginTop="6dp"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:id="@+id/big_l_recent"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_recent" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_recent"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_l_session"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_session" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_session"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/big_l_pair"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginStart="3dp"
+ android:layout_marginEnd="3dp"
+ android:layout_weight="1"
+ android:background="@drawable/widget_tile_bg"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <ImageView
+ android:layout_width="22dp"
+ android:layout_height="22dp"
+ android:importantForAccessibility="no"
+ android:src="@drawable/ic_widget_pair" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:text="@string/widget_btn_pair"
+ android:textColor="@color/widget_text"
+ android:textSize="@dimen/widget_text_secondary" />
+ </LinearLayout>
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
diff --git a/android/app/src/main/res/values/dimens.xml b/android/app/src/main/res/values/dimens.xml
index b506f326..3e0c4325 100644
--- a/android/app/src/main/res/values/dimens.xml
+++ b/android/app/src/main/res/values/dimens.xml
@@ -11,6 +11,7 @@
<dimen name="widget_tile_height">52dp</dimen>
<dimen name="widget_dot">10dp</dimen>
<dimen name="widget_icon">18dp</dimen>
+ <dimen name="widget_text_big">28sp</dimen>
<dimen name="widget_text_name">16sp</dimen>
<dimen name="widget_text_state">13sp</dimen>
<dimen name="widget_text_secondary">12sp</dimen>
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 8988161c..42b50321 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -32,6 +32,9 @@
<string name="widget_mood_description">Just Mochi\'s face, in your agents\' mood.</string>
<string name="widget_today_unit">done today</string>
<string name="widget_usage_off">Turn on plan usage in the app</string>
+ <string name="widget_big_usage_off">Plan usage is off</string>
+ <string name="widget_big_usage_off_line">Turn it on in the app</string>
+ <string name="widget_big_not_connected">Not connected</string>
<string name="widget_ring_cd">%1$s plan usage, %2$d percent used</string>
<string name="widget_today_cd">%1$d agent tasks finished today</string>
<string name="widget_pill_cd">%1$s, %2$s</string>
diff --git a/android/app/src/test/kotlin/com/coucou/android/WidgetDataTest.kt b/android/app/src/test/kotlin/com/coucou/android/WidgetDataTest.kt
index fce6f32b..8b2952ab 100644
--- a/android/app/src/test/kotlin/com/coucou/android/WidgetDataTest.kt
+++ b/android/app/src/test/kotlin/com/coucou/android/WidgetDataTest.kt
@@ -115,28 +115,7 @@ class WidgetDataTest {
assertEquals(com.coucou.android.core.WidgetTone.DONE, t[1].tone)
}
- // ── The speech bubble, the alert, the ring and the day's count ──────────────────────────────────
-
- @Test fun theBubbleSaysWhoAndHowNeverWhat() {
- fun bubble(state: BotState, approvals: Int = 0) = build(listOf(s("agent_codex", state, status = "editing secret.txt")), approvals).bubble
- assertEquals("Codex is working", bubble(BotState.WORKING))
- assertEquals("Codex is thinking", bubble(BotState.THINKING))
- assertEquals("Codex is searching", bubble(BotState.SEARCHING))
- assertEquals("Codex is waiting for you", bubble(BotState.APPROVAL, approvals = 1))
- assertEquals("Codex has a question", bubble(BotState.QUESTION))
- assertEquals("Codex is done", bubble(BotState.FINISHED))
- assertEquals("Codex stopped on an error", bubble(BotState.ERROR))
- assertEquals("Codex hit a limit", bubble(BotState.RATELIMIT))
- assertEquals("Codex needs a look", bubble(BotState.DIZZY))
- assertEquals("Codex is idle", bubble(BotState.IDLE))
- for (st in BotState.values()) assertFalse(bubble(st).contains("secret"))
- }
-
- @Test fun theBubbleCountsWhatWaitsAndSpeaksWhenThereIsNoAgent() {
- assertEquals("3 things are waiting for you", build(listOf(s("agent_codex", BotState.APPROVAL)), approvals = 3).bubble)
- assertEquals("No agents running", build(emptyList()).bubble)
- assertEquals("Waiting for your computer", build(emptyList(), link = LinkState.DISCONNECTED).bubble)
- }
+ // ── The alert, the ring and the day's count ──────────────────────────────────
@Test fun theAlertIsCalmUntilSomethingWaits() {
assertEquals("All calm", build(emptyList()).alertLine)
diff --git a/android/app/src/test/kotlin/com/coucou/android/WidgetSampleTest.kt b/android/app/src/test/kotlin/com/coucou/android/WidgetSampleTest.kt
index 28bae42b..af87e31c 100644
--- a/android/app/src/test/kotlin/com/coucou/android/WidgetSampleTest.kt
+++ b/android/app/src/test/kotlin/com/coucou/android/WidgetSampleTest.kt
@@ -33,7 +33,6 @@ class WidgetSampleTest {
assertTrue(c.connected)
assertTrue(c.tiles.isEmpty())
assertEquals("No agents running", c.emptyLine)
- assertEquals("No agents running", c.bubble)
assertEquals(BotState.IDLE, c.mood)
assertEquals("All calm", c.alertLine)
assertNull("plan usage is off, so the ring asks for the switch", c.ring)
@@ -43,7 +42,6 @@ class WidgetSampleTest {
val c = sample(WidgetSample.WORKING)
assertEquals(WidgetTone.WORKING, c.look)
assertEquals("Claude Code", c.top!!.name)
- assertEquals("Claude Code is working", c.bubble)
assertEquals(3, c.tiles.size)
assertEquals(0, c.waiting)
assertEquals("Claude", c.ring!!.plan)
@@ -58,7 +56,6 @@ class WidgetSampleTest {
assertEquals(1, c.waiting)
assertEquals("1 waiting", c.alertLine)
assertEquals("Claude Code", c.alertSub)
- assertEquals("Claude Code is waiting for you", c.bubble)
assertEquals(BotState.APPROVAL, c.mood)
assertEquals("a request on top, then the others by urgency", listOf("Claude Code", "Codex", "Gemini CLI"), c.tiles.map { it.name })
assertEquals(WidgetTone.TROUBLE, c.ring!!.tone)
@@ -67,7 +64,6 @@ class WidgetSampleTest {
@Test fun done() {
val c = sample(WidgetSample.DONE)
assertEquals(WidgetTone.DONE, c.look)
- assertEquals("Claude Code is done", c.bubble)
assertEquals(5, c.today)
assertEquals(BotState.FINISHED, c.todayMood)
assertEquals(WidgetTone.DONE, c.todayLook)
@@ -79,7 +75,6 @@ class WidgetSampleTest {
assertEquals(5, all.toSet().size)
for (c in all) {
assertTrue(c.headline.isNotBlank())
- assertTrue(c.bubble.isNotBlank())
assertTrue(c.alertLine.isNotBlank())
assertTrue(c.alertSub.isNotBlank())
assertTrue(c.tiles.size <= WidgetData.MAX_ROWS)
diff --git a/android/i18n/app-strings.json b/android/i18n/app-strings.json
index a354f360..241ac3ee 100644
--- a/android/i18n/app-strings.json
+++ b/android/i18n/app-strings.json
@@ -32,6 +32,9 @@
"widget_mood_description": "Just Mochi's face, in your agents' mood.",
"widget_today_unit": "done today",
"widget_usage_off": "Turn on plan usage in the app",
+ "widget_big_usage_off": "Plan usage is off",
+ "widget_big_usage_off_line": "Turn it on in the app",
+ "widget_big_not_connected": "Not connected",
"widget_ring_cd": "%1$s plan usage, %2$d percent used",
"widget_today_cd": "%1$d agent tasks finished today",
"widget_pill_cd": "%1$s, %2$s",