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、支持任意模型,记忆和密码绝不离开设备。

fix(ui): drop the signboard before the ball perches; report a voice failure once

booboosui2e40a9ace761
diff --git a/app/src/main/java/net/kuafuai/andee/BodyCoreService.kt b/app/src/main/java/net/kuafuai/andee/BodyCoreService.kt
index 356cc5a..9ef5040 100644
--- a/app/src/main/java/net/kuafuai/andee/BodyCoreService.kt
+++ b/app/src/main/java/net/kuafuai/andee/BodyCoreService.kt
@@ -527,7 +527,10 @@ class BodyCoreService : Service() {
}
asr = AsrController(
this, audio, window,
- onTranscript = { submitUserTurn(it, "voice") },
+ onTranscript = {
+ voiceFailureReported = false
+ submitUserTurn(it, "voice")
+ },
onError = { msg -> reportVoiceFailure(msg) },
)
@@ -950,6 +953,8 @@ class BodyCoreService : Service() {
// app — precisely the state `type_text` fails in.
closeTyping()
acceptBrainOutput = true
+ // A deliberate press that fails is owed its explanation again.
+ voiceFailureReported = false
asr.toggle()
}
@@ -1117,6 +1122,10 @@ class BodyCoreService : Service() {
net.kuafuai.andee.ui.ImeSwitch.ensureHumanDefault(this)
}
+ /** A voice failure was already shown; the auto follow-up mic would otherwise repeat it after every answer. */
+ @Volatile
+ private var voiceFailureReported = false
+
/**
* Voice failed, and the user has to be told *and* offered the way out.
*
@@ -1135,6 +1144,8 @@ class BodyCoreService : Service() {
*/
private fun reportVoiceFailure(msg: String) {
android.util.Log.w("Body", "voice failed: $msg")
+ if (voiceFailureReported) return
+ voiceFailureReported = true
net.kuafuai.andee.ui.ChatHistory.addError(
AppLocale.str(this, R.string.svc_voice_error_line, msg)
)
@@ -1788,6 +1799,7 @@ class BodyCoreService : Service() {
context = this,
onDismiss = {
settings = null
+ voiceFailureReported = false
if (rebuiltByReset) {
rebuiltByReset = false
} else {
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 a456ed4..73d7904 100644
--- a/app/src/main/java/net/kuafuai/andee/ui/FloatingWindowUi.kt
+++ b/app/src/main/java/net/kuafuai/andee/ui/FloatingWindowUi.kt
@@ -1238,6 +1238,7 @@ class FloatingWindowUi(
fun setWorking(on: Boolean) {
ui.post {
if (perchedByTask == on) return@post
+ if (on) dropSignboardBeforePerch()
perchedByTask = on
applyPerch()
syncWorking()
@@ -1260,6 +1261,7 @@ class FloatingWindowUi(
fun setPagePerched(on: Boolean) {
ui.post {
if (perchedByPage == on) return@post
+ if (on) dropSignboardBeforePerch()
perchedByPage = on
applyPerch()
syncWorking()
@@ -1317,6 +1319,13 @@ class FloatingWindowUi(
}
}
+ /** While a signboard is up the window is card-sized, so a perch slide would drag the whole card into the corner. */
+ private fun dropSignboardBeforePerch() {
+ if (!compact || signboard == null) return
+ signboardEvictor?.invoke()
+ if (signboard != null) hideSignboard()
+ }
+
/** A signboard is up — the ball waits, attending, instead of idling. */
fun setHolding(on: Boolean) {
ui.post {