Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
refactor: centralize mic action handling in CallChatWindow and increase assistive ball peek margin
Rishabh Bajpai8e8add952a4d
diff --git a/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt b/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.ktindex e942de9..9057194 100644--- a/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt+++ b/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt@@ -723,7 +723,7 @@ class AssistiveBallOverlay(context: Context) {// Edge-peek behaviour: when idle the ball docks off an edge, leaving// only a thin, semi-transparent sliver; interaction reveals the full ball.- const val PEEK_DP = 12+ const val PEEK_DP = 14const val PEEK_ALPHA = 0.35fconst val DOCK_MARGIN_DP = 16const val AUTO_DOCK_DELAY_MS = 2500Ldiff --git a/app/src/main/java/com/gotcha/ui/CallChatWindow.kt b/app/src/main/java/com/gotcha/ui/CallChatWindow.ktindex cf7b64a..c82d372 100644--- a/app/src/main/java/com/gotcha/ui/CallChatWindow.kt+++ b/app/src/main/java/com/gotcha/ui/CallChatWindow.kt@@ -129,19 +129,16 @@ class CallChatWindow(context: Context) {actionBtn?.visibility = View.VISIBLE(actionBtn as? TextView)?.text = "\uD83C\uDFA4"actionBtn?.alpha = 1f- actionBtn?.setOnClickListener { onStartMic() }}CallState.LISTENING -> {actionBtn?.visibility = View.VISIBLE(actionBtn as? TextView)?.text = "\u23F9"actionBtn?.alpha = 1f- actionBtn?.setOnClickListener { onStopMic() }}CallState.THINKING, CallState.SPEAKING -> {actionBtn?.visibility = View.VISIBLE(actionBtn as? TextView)?.text = "\uD83D\uDED1"actionBtn?.alpha = 1f- actionBtn?.setOnClickListener { onInterrupt() }}else -> {actionBtn?.visibility = View.GONE@@ -318,14 +315,22 @@ class CallChatWindow(context: Context) {if (x >= child.left && x <= child.right &&y >= child.top && y <= child.bottom) {- if (child == actionBtn) {- actionBtn?.callOnClick()- }+ if (child == actionBtn) performMicAction()break}}}+ /** Fire the action bound to the mic button for the current call state. */+ private fun performMicAction() {+ when (currentState) {+ CallState.READY, CallState.WAITING_USER -> onStartMic()+ CallState.LISTENING -> onStopMic()+ CallState.THINKING, CallState.SPEAKING -> onInterrupt()+ else -> { /* no-op when hidden */ }+ }+ }+@Suppress("CyclomaticComplexMethod")private fun containerTouchListener() = View.OnTouchListener { _, event ->when (event.action) {