Skip to content

armgit / andee

Public Imported from GitHub
0

Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。

feat(ui): trade the ⋯ tool drawer for a 产物 panel of the pages it made

booboosui40df43f4159b
diff --git a/app/src/main/java/net/kuafuai/andee/ScreenBodyService.kt b/app/src/main/java/net/kuafuai/andee/ScreenBodyService.kt
index 816ca54..567bb83 100644
--- a/app/src/main/java/net/kuafuai/andee/ScreenBodyService.kt
+++ b/app/src/main/java/net/kuafuai/andee/ScreenBodyService.kt
@@ -17,7 +17,6 @@ import net.kuafuai.andee.tts.TtsController
import net.kuafuai.andee.ui.EdgeRippleUi
import net.kuafuai.andee.ui.FloatingWindowUi
import net.kuafuai.andee.ui.SettingsUi
-import android.util.DisplayMetrics
import org.json.JSONObject
import java.util.concurrent.atomic.AtomicReference
@@ -45,6 +44,15 @@ class ScreenBodyService : AccessibilityService() {
*/
private var selfCheck: net.kuafuai.andee.ui.SelfCheckUi? = null
+ /** The artifacts panel, when it is up. See [openArtifacts]. */
+ private var artifactsUi: net.kuafuai.andee.ui.ArtifactsUi? = null
+
+ /**
+ * The page entry the user just tapped 继续修改 on, waiting for them to say
+ * what change they want. Cleared once they speak or type, or on stop.
+ */
+ private var pendingArtifact: net.kuafuai.andee.ui.ChatHistory.Entry? = null
+
/**
* The first-run wizard, when it is up.
*
@@ -89,10 +97,6 @@ class ScreenBodyService : AccessibilityService() {
* payload). See [net.kuafuai.andee.net.CallExtensionRegistry].
*/
private val callExtensions = net.kuafuai.andee.net.CallExtensionRegistry()
- private val toolExec = java.util.concurrent.Executors.newSingleThreadExecutor { r ->
- Thread(r, "ScreenTools").apply { isDaemon = true }
- }
- private val stamper = java.text.SimpleDateFormat("yyyyMMdd_HHmmss", java.util.Locale.US)
// Closed by [stopEverything], reopened when the user starts the next turn.
// Cancelling the brain's task is asynchronous, so progress / message frames
@@ -173,13 +177,14 @@ class ScreenBodyService : AccessibilityService() {
override fun onLongPress() {
// Long-press the ball — folded or not — asks for the full card
- // back: the subtitle band and the tool row only exist at full
+ // back: the scrollback and the control bar only exist at full
// size, and tapping is taken by the mic.
dispatcher.expand()
}
- override fun onToolClick(tool: FloatingWindowUi.Tool) {
- runTool(tool)
+ /** Same reasoning as [onSelfCheckClick]: our own surface, no task. */
+ override fun onArtifactsClick() {
+ openArtifacts()
}
override fun onStopClick() {
@@ -258,7 +263,7 @@ class ScreenBodyService : AccessibilityService() {
// below — so a service that comes up folded cannot cover whatever the
// user was doing when they flipped the switch in 设置. That reasoning
// was about *enabling*, and it cost more than it bought. The card is
- // the only thing that shows the scrollback, the tool row and the
+ // the only thing that shows the scrollback, the control bar and the
// minimise control, and a device that came back from a reboot showed
// none of them: just a 168 dp ball in the corner whose one way in (a
// long-press) nothing on screen mentions. The user turned this on to
@@ -707,16 +712,23 @@ class ScreenBodyService : AccessibilityService() {
closeTyping()
// The user is asking for something, so the answer is theirs to see.
acceptBrainOutput = true
- net.kuafuai.andee.ui.ChatHistory.addUser(said)
+ // A 继续修改 waiting for its words: the scrollback gets what they said,
+ // the brain gets that plus the page it is about.
+ val editing = pendingArtifact
+ pendingArtifact = null
+ val forBrain = editing?.let { artifactEditQuery(it, said) } ?: said
+ net.kuafuai.andee.ui.ChatHistory.addUser(
+ if (editing != null) AppLocale.str(this, R.string.artifacts_edit_said, editing.text, said) else said,
+ )
val payload = org.json.JSONObject()
- .put("text", said)
+ .put("text", forBrain)
.put("ts", System.currentTimeMillis())
hubClient?.sendEvent("asr.final", payload)
wsServer?.broadcastEvent("asr.final", payload)
// Same turn, different brain. The local one takes the text directly —
// there is no socket in between, and no event kind it would have to be
// taught (see the meeting callback).
- localBrain?.submit(said)
+ localBrain?.submit(forBrain)
// Task start, and deliberately at the request rather than at the
// reply: from here the device is being worked on, whether that reaches
// us as a tool call or as thirty seconds of thinking. Nobody listening
@@ -1046,7 +1058,6 @@ class ScreenBodyService : AccessibilityService() {
// stream to still exist, and flushes the last segment to disk.
if (::meeting.isInitialized) meeting.shutdown()
if (::audio.isInitialized) audio.release()
- toolExec.shutdownNow()
// shutdown, not shutdownNow: its queue is a few small appends and one
// PNG, and losing them would silently truncate the record.
net.kuafuai.andee.screen.GroundingLog.shutdown()
@@ -1058,6 +1069,8 @@ class ScreenBodyService : AccessibilityService() {
selfCheck?.hide()
selfCheck?.destroy()
selfCheck = null
+ artifactsUi?.hide()
+ artifactsUi = null
// Before the windows go: this one has to put the keyboard back, and a
// service that dies mid-typing would otherwise leave the tablet with
// its keyboard on the user's IME — where every future `type_text`
@@ -1202,6 +1215,73 @@ class ScreenBodyService : AccessibilityService() {
s.start()
}
+ /**
+ * 产物 — the pages the assistant has made. Our own surface, like ✓ and ⚙:
+ * starts no task and lights no glow.
+ */
+ private fun openArtifacts() {
+ if (artifactsUi?.isShown() == true) return
+ val a = net.kuafuai.andee.ui.ArtifactsUi(
+ context = this,
+ onOpen = { e -> e.page?.let { openPageFrom(e, it) } },
+ onEdit = { e -> beginArtifactEdit(e) },
+ )
+ artifactsUi = a
+ a.show()
+ }
+
+ /**
+ * 继续修改: remember which page, then ask the user what to change.
+ *
+ * The change itself arrives as an ordinary turn — said or typed — and
+ * [submitUserTurn] wraps it with the page. Not a turn of its own here,
+ * because until the user says what they want there is nothing to ask the
+ * brain, and a model call that answers "what would you like to change?"
+ * is a sentence the device can write for free.
+ *
+ * Opens the typing field rather than the mic: a page revision is usually a
+ * precise instruction ("把标题改成蓝色"), and the ball is one tap away for
+ * anyone who would rather say it.
+ */
+ private fun beginArtifactEdit(e: net.kuafuai.andee.ui.ChatHistory.Entry) {
+ if (e.page == null) return
+ pendingArtifact = e
+ window.setSubtitle(
+ AppLocale.str(this, R.string.artifacts_edit_prompt, e.text),
+ FloatingWindowUi.SubtitleKind.FINAL,
+ )
+ if (!net.kuafuai.andee.ui.TextInputActivity.isShowing) toggleTyping()
+ }
+
+ /**
+ * What the brain is given for a 继续修改: the user's words, the page they
+ * are about, and that page's current source.
+ *
+ * The source is inlined because neither brain can read a file off this
+ * device — there is no file tool — and a revision written from the title
+ * alone is a new page wearing the old name. Capped, since a page with
+ * base64 images can run to hundreds of KB; past the cap the brain is told
+ * so and rebuilds the rest from what it can see.
+ *
+ * English, like every other device-composed prompt, so the model's own
+ * language rule (§9) decides the reply's language from the user's words.
+ */
+ private fun artifactEditQuery(e: net.kuafuai.andee.ui.ChatHistory.Entry, said: String): String {
+ val html = e.page?.let { runCatching { it.readText() }.getOrNull() }.orEmpty()
+ val cut = html.length > ARTIFACT_SOURCE_MAX
+ return buildString {
+ append(said)
+ append("\n\n(I picked this from the 产物 panel: it is about the page you made earlier titled \"")
+ append(e.text)
+ append("\". Apply my change above to that page and show the full revised page with show_html,")
+ append(" keeping everything I did not ask to change. Its current source follows")
+ if (cut) append(" — truncated at $ARTIFACT_SOURCE_MAX characters; rebuild the missing tail in the same style")
+ append(".)\n\n<<<CURRENT PAGE SOURCE>>>\n")
+ append(if (cut) html.take(ARTIFACT_SOURCE_MAX) else html)
+ append("\n<<<END PAGE SOURCE>>>")
+ }
+ }
+
/**
* The first-run wizard, in a window of its own.
*
@@ -1396,9 +1476,8 @@ class ScreenBodyService : AccessibilityService() {
* Stop the current task. Runs entirely on the caller (UI) thread because
* every local step is non-blocking: [TtsController.stopSpeaking] cuts the
* AudioTrack inline, [AsrController.stop] only queues onto its executor.
- * Deliberately not routed through [toolExec] — that queue may be holding a
- * swipe mid-dispatchGesture, which is seconds of exactly the wait we're
- * trying to abort.
+ * Deliberately synchronous for that reason — an action already inside
+ * `dispatchGesture` is seconds of exactly the wait we're trying to abort.
*
* Three layers, and only the local ones are guaranteed: the brain is asked
* to cancel over the hub socket, and a tool request already dispatched to
@@ -1414,6 +1493,9 @@ class ScreenBodyService : AccessibilityService() {
return
}
acceptBrainOutput = false
+ // A 继续修改 the user walked away from must not attach itself to
+ // whatever they ask next.
+ pendingArtifact = null
tts.stopSpeaking()
if (asr.isActive()) asr.stop()
// Task over from the device's point of view: whatever the brain had
@@ -1444,123 +1526,6 @@ class ScreenBodyService : AccessibilityService() {
}
}
- /**
- * Run a top-bar tool on a background thread (ScreenController.tap/swipe
- * block on dispatchGesture for up to ~2 s and would ANR the UI thread).
- * Result is echoed to the floating window subtitle.
- */
- private fun runTool(tool: FloatingWindowUi.Tool) {
- window.setSubtitle("${AppLocale.str(this, tool.label)}…", FloatingWindowUi.SubtitleKind.PARTIAL)
- toolExec.execute {
- try {
- val result = when (tool) {
- FloatingWindowUi.Tool.SWIPE_UP -> swipe(dx = 0, dy = -1)
- FloatingWindowUi.Tool.SWIPE_DOWN -> swipe(dx = 0, dy = 1)
- FloatingWindowUi.Tool.SWIPE_LEFT -> swipe(dx = -1, dy = 0)
- FloatingWindowUi.Tool.SWIPE_RIGHT -> swipe(dx = 1, dy = 0)
- // actor="user": these bypass the dispatcher, so without it
- // the grounding log would file the user's own navigation
- // under the brain's and the offline pairing would read a
- // human's back-press as the agent correcting itself.
- FloatingWindowUi.Tool.BACK -> screen.globalAction("back", actor = "user")
- FloatingWindowUi.Tool.HOME -> screen.globalAction("home", actor = "user")
- FloatingWindowUi.Tool.UI_TREE -> saveUiTree(screen.dumpUiTree(verbose = true))
- // Through the dispatcher, not ScreenController directly: the
- // overlay has to be blanked or the capture is just our own card.
- FloatingWindowUi.Tool.SCREENSHOT ->
- saveScreenshot(dispatcher.dispatch("screen.screenshot", null) as JSONObject)
- }
- window.setSubtitle(
- "${AppLocale.str(this, tool.label)} · $result",
- FloatingWindowUi.SubtitleKind.FINAL,
- )
- } catch (t: Throwable) {
- net.kuafuai.andee.ui.CardUi.error(
- "${AppLocale.str(this, tool.label)} · ${t.message ?: t.javaClass.simpleName}"
- )
- }
- }
- }
-
- /**
- * Full-screen center swipe, 60% of the axis. dispatchGesture simulates
- * real touch events, which the overlay window would grab first — so we
- * flip the overlay to non-touchable for the duration of the swipe, then
- * restore it. Overlay stays visible either way.
- */
- private fun swipe(dx: Int, dy: Int): JSONObject {
- val dm: DisplayMetrics = resources.displayMetrics
- val cx = dm.widthPixels / 2
- val cy = dm.heightPixels / 2
- val ax = (dm.widthPixels * 0.3f).toInt()
- val ay = (dm.heightPixels * 0.3f).toInt()
- val durationMs = 300L
- window.setTouchable(false)
- // The glow window counts toward the opacity Android checks before it
- // trusts an injected gesture, so it has to step aside too — see
- // EdgeRippleUi's KDoc. Same for a tap marker still on screen.
- ripple.setVisibleForGesture(false)
- marker.setVisibleForGesture(false)
- // updateViewLayout is posted to the UI thread; give it a couple of
- // frames to actually apply before the gesture starts.
- Thread.sleep(50)
- try {
- // Goes straight to the pixel swipe, so swipeNorm's own hook never
- // fires — but the screen still moves under everything the brain
- // was aiming at, and this one was the user's doing.
- net.kuafuai.andee.screen.GroundingLog.noteSwipe(
- nx1 = (cx - dx * ax) * 1000 / dm.widthPixels,
- ny1 = (cy - dy * ay) * 1000 / dm.heightPixels,
- nx2 = (cx + dx * ax) * 1000 / dm.widthPixels,
- ny2 = (cy + dy * ay) * 1000 / dm.heightPixels,
- durationMs = durationMs,
- actor = "user",
- )
- return screen.swipe(cx - dx * ax, cy - dy * ay, cx + dx * ax, cy + dy * ay, durationMs)
- } finally {
- ripple.setVisibleForGesture(true)
- marker.setVisibleForGesture(true)
- window.setTouchable(true)
- }
- }
-
- /**
- * The full UI tree is huge — write to a JSON file under app-external
- * files so you can `adb pull` it, and return a small summary + path.
- * External files (Context.getExternalFilesDir) don't need storage
- * permission and are visible to `adb pull`.
- */
- private fun saveUiTree(tree: JSONObject): JSONObject {
- val dir = java.io.File(getExternalFilesDir(null), "captures").apply { mkdirs() }
- val file = java.io.File(dir, "ui_${stamper.format(java.util.Date())}.json")
- file.writeText(tree.toString(2), Charsets.UTF_8)
- android.util.Log.i("Body", "ui_tree saved: ${file.absolutePath}")
- return JSONObject()
- .put("pkg", tree.optString("pkg"))
- .put("class", tree.optString("class"))
- .put("children", tree.optJSONArray("children")?.length() ?: 0)
- .put("file", file.name)
- .put("bytes", file.length())
- }
-
- /**
- * Save the PNG bytes to disk (skipping the base64 round-trip in the
- * subtitle), and return a small summary + path.
- */
- private fun saveScreenshot(shot: JSONObject): JSONObject {
- val b64 = shot.optString("png_base64", "")
- val bytes = android.util.Base64.decode(b64, android.util.Base64.NO_WRAP)
- val dir = java.io.File(getExternalFilesDir(null), "captures").apply { mkdirs() }
- val file = java.io.File(dir, "screen_${stamper.format(java.util.Date())}.png")
- file.writeBytes(bytes)
- android.util.Log.i("Body", "screenshot saved: ${file.absolutePath}")
- return JSONObject()
- .put("width", shot.optInt("width"))
- .put("height", shot.optInt("height"))
- .put("bytes", bytes.size)
- .put("file", file.name)
- }
-
private fun startWsServer() {
try {
val srv = BodyWsServer(
@@ -2087,6 +2052,17 @@ class ScreenBodyService : AccessibilityService() {
* read aloud.
*/
private val END_MARKER = Regex("""(?i)\[END]""")
+
+ /**
+ * How much of a page's source a 继续修改 hands the brain.
+ *
+ * A generated page is routinely 10–60 KB of inline CSS and JS, which is
+ * nothing to the request; one with a base64 image can be several hundred
+ * KB, which is most of a context window for a picture the brain already
+ * drew and cannot usefully redraw from text. Past this the prompt says
+ * so and the tail is rebuilt rather than quoted.
+ */
+ private const val ARTIFACT_SOURCE_MAX = 60_000
private val instanceRef = AtomicReference<ScreenBodyService?>()
fun get(): ScreenBodyService? = instanceRef.get()
diff --git a/app/src/main/java/net/kuafuai/andee/ui/ArtifactsUi.kt b/app/src/main/java/net/kuafuai/andee/ui/ArtifactsUi.kt
new file mode 100644
index 0000000..3d60a4d
--- /dev/null
+++ b/app/src/main/java/net/kuafuai/andee/ui/ArtifactsUi.kt
@@ -0,0 +1,275 @@
+package net.kuafuai.andee.ui
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.graphics.Color
+import android.graphics.PixelFormat
+import android.view.Gravity
+import android.view.View
+import android.view.WindowManager
+import android.widget.LinearLayout
+import android.widget.ScrollView
+import android.widget.TextView
+import net.kuafuai.andee.R
+import net.kuafuai.andee.i18n.AppLocale
+import java.text.SimpleDateFormat
+import java.util.Date
+
+/**
+ * 产物: the pages the assistant has made, newest first — open, hand back to the
+ * assistant for changes, or delete.
+ *
+ * The list is [ChatHistory.artifacts], not a store of its own: a page is
+ * archived once, by `ui.show_html`, and the scrollback row and this row are
+ * two views of the same file. Deleting here leaves the scrollback row behind
+ * as 已清理, the same end state the 12-page cap produces.
+ *
+ * What the buttons *do* is the service's business — opening has to fold the
+ * card, editing has to reach whichever brain is running — so this class only
+ * reports which entry was picked.
+ *
+ * Same window shape as [NotebookUi]: focusable, hidden from accessibility,
+ * counted by [OwnCard].
+ */
+class ArtifactsUi(
+ private val context: Context,
+ private val onOpen: (ChatHistory.Entry) -> Unit,
+ private val onEdit: (ChatHistory.Entry) -> Unit,
+) {
+
+ private val wm: WindowManager =
+ context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
+
+ private var root: View? = null
+ private var frosted = false
+ private var lctx: Context = context
+
+ /** The row whose 删除 has been tapped once and now reads 确认删除. */
+ private var arming: Long? = null
+
+ fun isShown(): Boolean = root != null
+
+ fun show() {
+ if (root != null) return
+ val p = WindowManager.LayoutParams(
+ cardWidth(), cardHeight(),
+ WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
+ 0,
+ PixelFormat.TRANSLUCENT,
+ ).apply {
+ gravity = Gravity.CENTER
+ }
+ frosted = Glass.frost(context, wm, p)
+ val v = build()
+ runCatching {
+ v.hideFromAccessibility()
+ wm.addView(v, p)
+ root = v
+ OwnCard.shown()
+ Glass.enter(v)
+ }
+ }
+
+ fun hide(then: () -> Unit = {}) {
+ val v = root ?: return
+ root = null
+ Glass.exit(v) {
+ runCatching { wm.removeView(v) }
+ OwnCard.hidden()
+ then()
+ }
+ }
+
+ private fun rebuild() {
+ val old = root ?: return
+ val v = build()
+ runCatching {
+ v.hideFromAccessibility()
+ val p = old.layoutParams as WindowManager.LayoutParams
+ wm.removeView(old)
+ wm.addView(v, p)
+ root = v
+ }
+ }
+
+ private fun cardWidth(): Int {
+ val screen = Glass.usableSize(context).first
+ return minOf(dp(560), screen - dp(2 * GUTTER_DP))
+ }
+
+ private fun cardHeight(): Int {
+ val screen = Glass.usableSize(context).second
+ return minOf(dp(720), screen - dp(2 * GUTTER_DP))
+ }
+
+ // ---- build ----
+
+ private fun build(): View {
+ lctx = AppLocale.wrap(context)
+ val card = LinearLayout(context).apply {
+ orientation = LinearLayout.VERTICAL
+ background = Glass.card(context, dp(28), frosted)
+ clipToOutline = true
+ }
+ card.addView(header(), matchWrap())
+ card.addView(
+ View(context).apply { setBackgroundColor(Color.parseColor(Glass.PANEL_EDGE)) },
+ LinearLayout.LayoutParams(MATCH, dp(1)),
+ )
+
+ val body = LinearLayout(context).apply {
+ orientation = LinearLayout.VERTICAL
+ setPadding(dp(20), dp(16), dp(20), dp(16))
+ }
+ val all = ChatHistory.artifacts()
+ if (all.isEmpty()) {
+ body.addView(emptyState())
+ } else {
+ for (e in all) body.addView(row(e), matchWrap().apply { bottomMargin = dp(10) })
+ body.addView(
+ TextView(context).apply {
+ text = lctx.getString(R.string.artifacts_cap_note)
+ textSize = Glass.Type.MICRO
+ setTextColor(Color.parseColor(Glass.MUTED))
+ gravity = Gravity.CENTER
+ setPadding(0, dp(6), 0, 0)
+ },
+ matchWrap(),
+ )
+ }
+ val scroll = ScrollView(context)
+ scroll.addView(body, matchWrap())
+ card.addView(scroll, LinearLayout.LayoutParams(MATCH, 0, 1f))
+ return card
+ }
+
+ private fun header(): LinearLayout {
+ val h = LinearLayout(context).apply {
+ orientation = LinearLayout.HORIZONTAL
+ gravity = Gravity.CENTER_VERTICAL
+ setPadding(dp(22), dp(18), dp(14), dp(12))
+ }
+ val titles = LinearLayout(context).apply { orientation = LinearLayout.VERTICAL }
+ titles.addView(TextView(context).apply {
+ text = lctx.getString(R.string.artifacts_title)
+ textSize = Glass.Type.HEADLINE
+ setTextColor(Color.parseColor(Glass.TITLE))
+ })
+ titles.addView(TextView(context).apply {
+ text = lctx.getString(R.string.artifacts_subtitle)
+ textSize = Glass.Type.CAPTION
+ setTextColor(Color.parseColor(Glass.SECONDARY))
+ setPadding(0, dp(2), 0, 0)
+ })
+ h.addView(titles, LinearLayout.LayoutParams(0, WRAP, 1f))
+ h.addView(TextView(context).apply {
+ text = "✕"
+ textSize = Glass.Type.CAPTION
+ setTextColor(Color.parseColor(Glass.SECONDARY))
+ gravity = Gravity.CENTER
+ background = Glass.panel(context, dp(16))
+ isClickable = true
+ Glass.pressable(this)
+ setOnClickListener { hide() }
+ layoutParams = LinearLayout.LayoutParams(dp(32), dp(32))
+ })
+ return h
+ }
+
+ @SuppressLint("SetTextI18n")
+ private fun row(e: ChatHistory.Entry): View {
+ val row = LinearLayout(context).apply {
+ orientation = LinearLayout.VERTICAL
+ setPadding(dp(14), dp(12), dp(14), dp(12))
+ background = Glass.panel(context, dp(14))
+ isClickable = true
+ Glass.pressable(this)
+ setOnClickListener { hide { onOpen(e) } }
+ }
+ row.addView(TextView(context).apply {
+ text = e.text
+ textSize = Glass.Type.BODY
+ setTextColor(Color.parseColor(Glass.TITLE))
+ maxLines = 2
+ ellipsize = android.text.TextUtils.TruncateAt.END
+ }, matchWrap())
+
+ val meta = buildString {
+ append(SimpleDateFormat("yyyy-MM-dd HH:mm", AppLocale.localeOf(context)).format(Date(e.ts)))
+ val bytes = e.page?.length() ?: 0L
+ if (bytes > 0) append(" · ${(bytes + 1023) / 1024} KB")
+ }
+ row.addView(TextView(context).apply {
+ text = meta
+ textSize = Glass.Type.MICRO
+ setTextColor(Color.parseColor(Glass.MUTED))
+ setPadding(0, dp(4), 0, dp(10))
+ }, matchWrap())
+
+ val actions = LinearLayout(context).apply {
+ orientation = LinearLayout.HORIZONTAL
+ gravity = Gravity.CENTER_VERTICAL
+ }
+ actions.addView(action(lctx.getString(R.string.artifacts_open), Glass.LABEL) {
+ hide { onOpen(e) }
+ })
+ actions.addView(View(context), LinearLayout.LayoutParams(dp(8), 1))
+ actions.addView(action(lctx.getString(R.string.artifacts_edit), Glass.ACCENT) {
+ hide { onEdit(e) }
+ })
+ actions.addView(View(context), LinearLayout.LayoutParams(0, 1, 1f))
+ val armed = arming == e.id
+ actions.addView(
+ action(
+ lctx.getString(if (armed) R.string.artifacts_delete_confirm else R.string.common_delete),
+ Glass.DANGER,
+ ) {
+ if (arming == e.id) {
+ arming = null
+ ChatHistory.deletePage(e.id)
+ } else {
+ // Two taps, because unlike a memory a page cannot be asked
+ // for again word for word.
+ arming = e.id
+ }
+ rebuild()
+ },
+ )
+ row.addView(actions, matchWrap())
+ return row
+ }
+
+ private fun action(label: String, color: String, onClick: () -> Unit): TextView =
+ TextView(context).apply {
+ text = label
+ textSize = Glass.Type.CAPTION
+ setTextColor(Color.parseColor(color))
+ gravity = Gravity.CENTER
+ setPadding(dp(14), dp(7), dp(14), dp(7))
+ background = Glass.well(context, dp(12))
+ isClickable = true
+ Glass.pressable(this)
+ setOnClickListener { onClick() }
+ layoutParams = LinearLayout.LayoutParams(WRAP, WRAP)
+ }
+
+ private fun emptyState(): TextView = TextView(context).apply {
+ text = lctx.getString(R.string.artifacts_empty)
+ textSize = Glass.Type.BODY
+ setTextColor(Color.parseColor(Glass.SECONDARY))
+ gravity = Gravity.CENTER
+ setLineSpacing(dp(3).toFloat(), 1f)
+ setPadding(dp(20), dp(48), dp(20), dp(48))
+ layoutParams = matchWrap()
+ }
+
+ private fun dp(value: Int): Int = (value * context.resources.displayMetrics.density).toInt()
+
+ private fun matchWrap() = LinearLayout.LayoutParams(MATCH, WRAP)
+
+ private companion object {
+ const val MATCH = LinearLayout.LayoutParams.MATCH_PARENT
+ const val WRAP = LinearLayout.LayoutParams.WRAP_CONTENT
+ const val GUTTER_DP = 20
+ }
+}
diff --git a/app/src/main/java/net/kuafuai/andee/ui/ChatHistory.kt b/app/src/main/java/net/kuafuai/andee/ui/ChatHistory.kt
index 22e9eaa..662c8e5 100644
--- a/app/src/main/java/net/kuafuai/andee/ui/ChatHistory.kt
+++ b/app/src/main/java/net/kuafuai/andee/ui/ChatHistory.kt
@@ -54,15 +54,19 @@ object ChatHistory {
* Two separate caps, because the two costs are unrelated: a line of text is
* a few hundred bytes and the list is only worth scrolling if it goes back
* a while, whereas a generated page is routinely 50–100 KB of inlined CSS,
- * JS and base64 images. Keeping [MAX_ENTRIES] pages would be tens of
- * megabytes of an app-private directory nobody ever looks at.
+ * JS and base64 images — 100 of them is up to ~10 MB, the price of the 产物
+ * panel being a shelf rather than a recent-items strip.
+ *
+ * A live page does not count against [MAX_ENTRIES]. It used to, and then the
+ * page cap was fiction: 80 rows of chatter pushed pages out (file and all)
+ * long before [MAX_PAGES] was reached.
*
* A page evicted from disk leaves its row behind with `page = null`. The
* row stays because "you showed me a 贪吃蛇 at 3pm" is still true and still
* worth scrolling past; it just stops claiming to be re-openable.
*/
private const val MAX_ENTRIES = 80
- private const val MAX_PAGES = 12
+ private const val MAX_PAGES = 100
/**
* How much of a message is kept.
@@ -108,6 +112,27 @@ object ChatHistory {
/** Oldest first — the order the card lays rows out in. */
fun snapshot(): List<Entry> = synchronized(lock) { ArrayList(entries) }
+ /** Pages still on disk, newest first — what the 产物 panel lists. */
+ fun artifacts(): List<Entry> = synchronized(lock) {
+ entries.filter { it.role == Role.PAGE && it.page != null }.reversed()
+ }
+
+ /**
+ * Delete one page's file and keep its row, the same end state eviction
+ * leaves: "you showed me a page at 3pm" stays true after the page is gone.
+ */
+ fun deletePage(id: Long) {
+ synchronized(lock) {
+ val i = entries.indexOfFirst { it.id == id }
+ if (i < 0) return
+ val e = entries[i]
+ e.page?.let { runCatching { it.delete() } }
+ entries[i] = e.copy(page = null)
+ save()
+ }
+ listener?.invoke()
+ }
+
/**
* Delete everything and forget it. For 恢复出厂设置.
*
@@ -180,11 +205,7 @@ object ChatHistory {
/** Caller holds [lock]. */
private fun trim() {
- while (entries.size > MAX_ENTRIES) {
- entries.removeAt(0).page?.let { runCatching { it.delete() } }
- }
- // Newest page kept, oldest dropped. Counted from the end so the walk
- // stops as soon as the budget is spent instead of scanning every row.
+ // Pages first, so one that just lost its file is an ordinary row below.
var pages = 0
for (i in entries.indices.reversed()) {
val e = entries[i]
@@ -195,6 +216,14 @@ object ChatHistory {
entries[i] = e.copy(page = null)
}
}
+ var over = entries.count { it.page == null } - MAX_ENTRIES
+ val it = entries.iterator()
+ while (over > 0 && it.hasNext()) {
+ if (it.next().page == null) {
+ it.remove()
+ over--
+ }
+ }
}
// ---- Persistence ----
@@ -202,7 +231,7 @@ object ChatHistory {
// A plain JSON file rather than SharedPreferences: this is an append-only
// log with a per-row shape, and VoiceConfig's prefs file is the *settings*,
// which are hand-edited and whitelisted (see its ALLOWED_KEYS). Rewriting
- // the whole log on every append is fine at 80 rows and saves having to
+ // the whole log on every append is fine at 180 rows and saves having to
// reason about partial writes.
private fun file(): File? = appContext?.let { File(it.filesDir, "chat_history.json") }
diff --git a/app/src/main/java/net/kuafuai/andee/ui/FloatingWindowUi.kt b/app/src/main/java/net/kuafuai/andee/ui/FloatingWindowUi.kt
index e6b1fc1..cf67b05 100644
--- a/app/src/main/java/net/kuafuai/andee/ui/FloatingWindowUi.kt
+++ b/app/src/main/java/net/kuafuai/andee/ui/FloatingWindowUi.kt
@@ -21,7 +21,6 @@ import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.annotation.DrawableRes
-import androidx.annotation.StringRes
import androidx.core.content.ContextCompat
import net.kuafuai.andee.R
import net.kuafuai.andee.audio.Earcon
@@ -44,7 +43,7 @@ import kotlin.random.Random
*
* Layout (FrameLayout, two stacked areas plus a floating control pill):
* ┌──── ball area (top 40%) ─────────────────┐
- * │ ⋯ ✓ ⚙ ✕ │ ← tools / self-check / gear / close
+ * │ ◈ ✓ ⚙ ✕ │ ← 产物 / self-check / gear / close
* │ │
* │ [round ball] │ ← tap = talk
* │ │ ← double-tap = type
@@ -120,21 +119,6 @@ class FloatingWindowUi(
*/
enum class SubtitleKind { PARTIAL, FINAL }
- /** Screen tools shown as a row of small buttons in the top-right corner. */
- enum class Tool(
- @param:DrawableRes val icon: Int,
- @param:StringRes val label: Int,
- ) {
- SWIPE_UP(R.drawable.ic_swipe_up, R.string.tool_swipe_up),
- SWIPE_DOWN(R.drawable.ic_swipe_down, R.string.tool_swipe_down),
- SWIPE_LEFT(R.drawable.ic_swipe_left, R.string.tool_swipe_left),
- SWIPE_RIGHT(R.drawable.ic_swipe_right, R.string.tool_swipe_right),
- BACK(R.drawable.ic_back, R.string.tool_back),
- HOME(R.drawable.ic_home, R.string.tool_home),
- UI_TREE(R.drawable.ic_tree, R.string.tool_ui_tree),
- SCREENSHOT(R.drawable.ic_screenshot, R.string.tool_screenshot),
- }
-
interface Listeners {
fun onTalkClick()
fun onSettingsClick()
@@ -155,7 +139,9 @@ class FloatingWindowUi(
*/
fun onSelfCheckClick()
fun onLongPress()
- fun onToolClick(tool: Tool)
+
+ /** The 产物 key — the pages the assistant has made. See [ArtifactsUi]. */
+ fun onArtifactsClick()
/**
* `■` is gone from the bar; stop is still here.
@@ -218,7 +204,6 @@ class FloatingWindowUi(
private var params: WindowManager.LayoutParams? = null
private var ball: EmotionBallTextureView? = null
private var topBarView: View? = null
- private var toolsView: View? = null
private var historyView: HistoryListView? = null
/** The ball's gesture vocabulary, pinned along the bottom of the full card. */
@@ -1505,10 +1490,10 @@ class FloatingWindowUi(
* one, from the card's current height.
*
* Called from the ball host's size change and from the cluster's own layout,
- * because the cluster's height is one of the inputs and two things move it:
- * the status-bar inset lands after the first layout, and the tool drawer
- * changes it at runtime. Listening to the cluster rather than hooking each
- * of those call sites keeps it to one place that can be forgotten.
+ * because the cluster's height is one of the inputs and it moves: the
+ * status-bar inset lands after the first layout. Listening to the cluster
+ * rather than hooking that call site keeps it to one place that can be
+ * forgotten.
*
* Main thread only.
*/
@@ -1734,7 +1719,6 @@ class FloatingWindowUi(
// whether the compositor agreed to blur — and [setCompact] calls it
// immediately after this, before the next frame.
topBarView?.visibility = View.VISIBLE
- toolsView?.visibility = View.GONE // tools always start folded away
historyView?.visibility = View.VISIBLE
tipsView?.visibility = View.VISIBLE
backdrop?.visibility = View.VISIBLE
@@ -1804,7 +1788,7 @@ class FloatingWindowUi(
paintCard()
// The card now runs under the status bar ([FLAG_LAYOUT_IN_SCREEN]), so
// the control cluster has to step around it — otherwise the clock and
- // the battery icon sit on top of `⋯` and `✕`, and those are the two
+ // the battery icon sit on top of `◈` and `✕`, and those are the two
// controls the user cannot do without.
insetTopBar()
runCatching { wm.updateViewLayout(v, p) }
@@ -2056,9 +2040,8 @@ class FloatingWindowUi(
)
topBarView = topBar
// The cluster's own bounds are an input to the card's split — see
- // [ballAreaHeight]. Watching it here means the status-bar inset and the
- // tool drawer both re-derive the split without either having to know
- // that it is responsible for it.
+ // [ballAreaHeight]. Watching it here means the status-bar inset lands
+ // without this having to know it is responsible for the split.
topBar.addOnLayoutChangeListener { _, _, top, _, bottom, _, oldTop, _, oldBottom ->
// Also the only place the inset is guaranteed to be *available*:
// `rootWindowInsets` is null until the view is attached, so the
@@ -2073,8 +2056,8 @@ class FloatingWindowUi(
}
/**
- * The control cluster: one pill holding the three things the user actually
- * reaches for, with the eight screen tools folded behind `⋯`.
+ * The control cluster: one pill holding the four things the user actually
+ * reaches for.
*
* Three and not four since typing moved onto the ball's double-tap — see
* [Listeners.onTextInputToggle] for why it belongs there rather than here.
@@ -2084,14 +2067,18 @@ class FloatingWindowUi(
* not changed twice over; only one of the three is different, and it is the
* one that was not earning its slot.
*
- * The bar now reads `⋯ ✓ ⚙ ✕` — one working row (the self-check, next to
- * the gear it is a sibling of) between the two that bracket it: the tools
- * drawer on the left and the dismiss on the right.
- *
- * The tools are developer instruments — swipe four ways, back, home, dump
- * the tree, grab a screenshot. Ten identical monochrome glyphs crammed at
- * dp(2) apart was most of why the card read as unfinished, and none of them
- * is something the user needs within one tap.
+ * The bar now reads `◈ ✓ ⚙ ✕`. `◈` used to be `⋯`, and behind it were ten
+ * developer instruments — swipe four ways, back, home, dump the tree, grab a
+ * screenshot — as a second row of monochrome glyphs. That row is gone
+ * outright, not folded somewhere else: every one of those actions is one the
+ * brain performs on its own (`screen.*`, all of it reachable by talking),
+ * and a hand-driven toolbar sitting over the app being driven was a second,
+ * competing way to operate the same device. What took the slot is 产物 — the
+ * pages the assistant has made, which is the one thing in this bar the user
+ * cannot get at by talking.
+ *
+ * All four keys are `Glass.LABEL` now rather than roughly half of them being
+ * dimmed: the dimmer ones were the drawer's contents and a folded `⋯`.
*/
@SuppressLint("SetTextI18n")
private fun buildTopBar(): View {
@@ -2110,23 +2097,8 @@ class FloatingWindowUi(
gravity = Gravity.CENTER_VERTICAL
}
- // A second row rather than more of the first: twelve dp(36) keys in a
- // line measure ~1500px against a 1200px screen, and the overflow fell
- // off the *right* — expanding the tools pushed `⚙` and `⤡` off-window,
- // making the tool drawer a one-way door out of the card. Stacked, the
- // eight tools are ~990px and the permanent keys never move at all.
- val tools = LinearLayout(context).apply {
- orientation = LinearLayout.HORIZONTAL
- gravity = Gravity.CENTER_VERTICAL
- visibility = View.GONE
- }
- for (tool in Tool.values()) tools.addView(buildToolButton(tool))
- toolsView = tools
-
keys.addView(
- barButton(R.drawable.ic_more, Glass.LABEL, "更多工具") {
- tools.visibility = if (tools.visibility == View.VISIBLE) View.GONE else View.VISIBLE
- }
+ barButton(R.drawable.ic_artifacts, Glass.LABEL, "产物") { listeners.onArtifactsClick() }
)
// ✓ and not ■: the stop button used to sit here, and stop is the one
// action in this bar the ball can already perform — see onStopClick.
@@ -2142,7 +2114,6 @@ class FloatingWindowUi(
keys.addView(barButton(R.drawable.ic_close, Glass.LABEL, "收起") { listeners.onMinimizeClick() })
bar.addView(keys)
- bar.addView(tools)
return bar
}
@@ -2454,57 +2425,6 @@ class FloatingWindowUi(
// ---- Colors / units ----
- /**
- * One tool in the `⋯` drawer: its icon, then its name.
- *
- * The name is new and it is the point. These were eight unlabelled
- * monochrome glyphs — `↑ ↓ ← → ⌫ ⌂ ☰ ◉` — behind a `⋯`, which meant the
- * drawer was a row of symbols a user had to decode by tapping, and the two
- * that are also Android idioms (`⌂` home, `⌫` back) are not the two whose
- * meaning is obvious from the others. A word beside each costs the row its
- * compactness and buys the whole drawer its legibility; the labels are
- * localised, unlike the glyphs they replace.
- */
- private fun buildToolButton(tool: Tool): View {
- // Dimmer than the four permanent keys on purpose: these are developer
- // instruments hidden behind `⋯`, and they sat at the same weight as the
- // permanent keys when they were all one colour.
- val tint = Color.parseColor(Glass.SECONDARY)
- val icon = ContextCompat.getDrawable(context, tool.icon)?.mutate()?.apply { setTint(tint) }
- return LinearLayout(context).apply {
- orientation = LinearLayout.HORIZONTAL
- gravity = Gravity.CENTER_VERTICAL
- setPadding(dp(6), 0, dp(6), 0)
- isClickable = true
- isFocusable = true
- background = Glass.well(context, dp(14))
- contentDescription = AppLocale.str(context, tool.label)
- Glass.pressable(this)
- setOnClickListener { listeners.onToolClick(tool) }
-
- addView(
- View(context).apply {
- background = icon
- layoutParams = LinearLayout.LayoutParams(dp(16), dp(16))
- }
- )
- addView(
- TextView(context).apply {
- text = AppLocale.str(context, tool.label)
- textSize = Glass.Type.MICRO
- setTextColor(tint)
- setPadding(dp(4), 0, 0, 0)
- includeFontPadding = false
- }
- )
-
- layoutParams = LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.WRAP_CONTENT,
- dp(32),
- ).apply { leftMargin = dp(4) }
- }
- }
-
private fun dp(v: Int): Int =
(v * context.resources.displayMetrics.density).toInt()
diff --git a/app/src/main/java/net/kuafuai/andee/ui/HistoryListView.kt b/app/src/main/java/net/kuafuai/andee/ui/HistoryListView.kt
index 705e205..42e99fc 100644
--- a/app/src/main/java/net/kuafuai/andee/ui/HistoryListView.kt
+++ b/app/src/main/java/net/kuafuai/andee/ui/HistoryListView.kt
@@ -102,6 +102,9 @@ class HistoryListView(private val context: Context) : ScrollView(context) {
*/
private val laid = LinkedHashSet<Long>()
+ /** Laid rows drawn as re-openable pages; one losing its file forces a relayout. */
+ private val laidOpen = HashSet<Long>()
+
private val empty = TextView(context).apply {
text = lctx.getString(R.string.history_empty)
textSize = Glass.Type.CAPTION
@@ -202,7 +205,8 @@ class HistoryListView(private val context: Context) : ScrollView(context) {
empty.visibility = if (all.isEmpty()) View.VISIBLE else View.GONE
val ids = all.map { it.id }.toSet()
- if (laid.any { it !in ids }) {
+ val open = all.filter { it.page != null }.map { it.id }.toSet()
+ if (laid.any { it !in ids } || laidOpen.any { it !in open }) {
// A row we laid out is gone from the history — evicted from the
// middle, or the whole list wiped. Cheaper and less error-prone to
// start over than to reconcile. This deliberately does not also
@@ -213,11 +217,13 @@ class HistoryListView(private val context: Context) : ScrollView(context) {
column.addView(empty)
column.addView(live)
laid.clear()
+ laidOpen.clear()
}
// Inserted above the live row rather than appended, so a settled entry
// lands behind the thing that is still in progress.
for (e in all) {
if (laid.add(e.id)) {
+ if (e.page != null) laidOpen.add(e.id)
column.addView(buildRow(e), column.indexOfChild(live))
}
}
@@ -243,6 +249,7 @@ class HistoryListView(private val context: Context) : ScrollView(context) {
lctx = AppLocale.wrap(context)
empty.text = lctx.getString(R.string.history_empty)
laid.clear()
+ laidOpen.clear()
column.removeAllViews()
column.addView(empty)
column.addView(live)
diff --git a/app/src/main/res/drawable/ic_back.xml b/app/src/main/res/drawable/ic_artifacts.xml
similarity index 62%
rename from app/src/main/res/drawable/ic_back.xml
rename to app/src/main/res/drawable/ic_artifacts.xml
index 2a0bdbf..b0d6d1f 100644
--- a/app/src/main/res/drawable/ic_back.xml
+++ b/app/src/main/res/drawable/ic_artifacts.xml
@@ -5,5 +5,5 @@
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
- android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20z"/>
+ android:pathData="M11.99,18.54l-7.37,-5.73L3,14.07l9,7 9,-7 -1.63,-1.27 -7.38,5.74zM12,16l7.36,-5.73L21,9l-9,-7 -9,7 1.63,1.27L12,16z"/>
</vector>
diff --git a/app/src/main/res/drawable/ic_home.xml b/app/src/main/res/drawable/ic_home.xml
deleted file mode 100644
index 8f8c192..0000000
--- a/app/src/main/res/drawable/ic_home.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
-</vector>
diff --git a/app/src/main/res/drawable/ic_more.xml b/app/src/main/res/drawable/ic_more.xml
deleted file mode 100644
index 6420bbf..0000000
--- a/app/src/main/res/drawable/ic_more.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M6,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
-</vector>
diff --git a/app/src/main/res/drawable/ic_screenshot.xml b/app/src/main/res/drawable/ic_screenshot.xml
deleted file mode 100644
index 46b7eab..0000000
--- a/app/src/main/res/drawable/ic_screenshot.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M9,3L7.17,5H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V7c0,-1.1 -0.9,-2 -2,-2h-3.17L15,3H9zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
-</vector>
diff --git a/app/src/main/res/drawable/ic_swipe_down.xml b/app/src/main/res/drawable/ic_swipe_down.xml
deleted file mode 100644
index f46af24..0000000
--- a/app/src/main/res/drawable/ic_swipe_down.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12,20l6,-6h-4L14,6h-4v8L6,14z"/>
-</vector>
diff --git a/app/src/main/res/drawable/ic_swipe_left.xml b/app/src/main/res/drawable/ic_swipe_left.xml
deleted file mode 100644
index 4f15d41..0000000
--- a/app/src/main/res/drawable/ic_swipe_left.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M4,12l6,6v-4h8v-4h-8L10,6z"/>
-</vector>
diff --git a/app/src/main/res/drawable/ic_swipe_right.xml b/app/src/main/res/drawable/ic_swipe_right.xml
deleted file mode 100644
index 62e33cc..0000000
--- a/app/src/main/res/drawable/ic_swipe_right.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M20,12l-6,-6v4h-8v4h8v4z"/>
-</vector>
diff --git a/app/src/main/res/drawable/ic_swipe_up.xml b/app/src/main/res/drawable/ic_swipe_up.xml
deleted file mode 100644
index 9eb7693..0000000
--- a/app/src/main/res/drawable/ic_swipe_up.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12,4l-6,6h4v8h4v-8h4z"/>
-</vector>
diff --git a/app/src/main/res/drawable/ic_tree.xml b/app/src/main/res/drawable/ic_tree.xml
deleted file mode 100644
index 09939dd..0000000
--- a/app/src/main/res/drawable/ic_tree.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M4,4h6v2L6,6v4L4,10zM4,14h2v4h4v2L4,20zM14,4h6v6h-2L18,6h-4zM18,14h2v6h-6v-2h4z"/>
-</vector>
diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml
index b9bd0fd..9499d72 100644
--- a/app/src/main/res/values-en/strings.xml
+++ b/app/src/main/res/values-en/strings.xml
@@ -143,14 +143,15 @@
longer than one they can read at a glance. -->
<string name="window_tips">1tap: talk · 2tap: type · 3tap: stop · swipe: character</string>
- <string name="tool_swipe_up">Up</string>
- <string name="tool_swipe_down">Down</string>
- <string name="tool_swipe_left">Left</string>
- <string name="tool_swipe_right">Right</string>
- <string name="tool_back">Back</string>
- <string name="tool_home">Home</string>
- <string name="tool_ui_tree">Tree</string>
- <string name="tool_screenshot">Shot</string>
+ <string name="artifacts_title">Made for you</string>
+ <string name="artifacts_subtitle">Pages it has built for you</string>
+ <string name="artifacts_open">Open</string>
+ <string name="artifacts_edit">Revise</string>
+ <string name="artifacts_delete_confirm">Really delete</string>
+ <string name="artifacts_empty">Nothing here yet.\nAsk it to build you a page — say, “make me a pomodoro timer”.</string>
+ <string name="artifacts_cap_note">Only the latest 100 are kept</string>
+ <string name="artifacts_edit_prompt">How should “%1$s” change? Say it or type it</string>
+ <string name="artifacts_edit_said">Revise “%1$s”: %2$s</string>
<!-- The factory-reset confirmation list; see config/FactoryReset.kt. -->
<string name="factory_reset_target_keys">the Volcano and DeepSeek keys, and every speech and brain setting</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0ff6d49..8c289cf 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -117,15 +117,18 @@
folded ball reads a horizontal flick as a move instead. -->
<string name="window_tips">点小球说话 · 双击打字 · 三连击停止 · 滑动切换性格</string>
- <!-- The ⋯ drawer's tool names, under each icon. -->
- <string name="tool_swipe_up">上滑</string>
- <string name="tool_swipe_down">下滑</string>
- <string name="tool_swipe_left">左滑</string>
- <string name="tool_swipe_right">右滑</string>
- <string name="tool_back">返回</string>
- <string name="tool_home">桌面</string>
- <string name="tool_ui_tree">元素树</string>
- <string name="tool_screenshot">截图</string>
+ <!-- 产物: the pages the assistant has made. See ui/ArtifactsUi.kt. -->
+ <string name="artifacts_title">产物</string>
+ <string name="artifacts_subtitle">它为你做的网页</string>
+ <string name="artifacts_open">打开</string>
+ <string name="artifacts_edit">继续修改</string>
+ <string name="artifacts_delete_confirm">确认删除</string>
+ <string name="artifacts_empty">还没有产物。\n让它给你做个网页试试,比如「做个番茄钟」。</string>
+ <string name="artifacts_cap_note">只保留最近 100 个</string>
+ <!-- Shown on the card after 继续修改, while it waits for the change. -->
+ <string name="artifacts_edit_prompt">要怎么改「%1$s」?说出来或打字告诉我</string>
+ <!-- The scrollback row for the user's change request. -->
+ <string name="artifacts_edit_said">修改「%1$s」:%2$s</string>
<!-- The 恢复出厂设置 confirmation list: one line per thing wiped.
Kept beside config/FactoryReset.kt, which walks them in this order. -->