Skip to content

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.

feat: the ball's menu uses icons rather than emoji (stage 5)

Durganshu Mishra07c3a4ffb9c9
diff --git a/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt b/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt
index a6b3de6..7f5bcda 100644
--- a/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt
+++ b/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt
@@ -206,7 +206,10 @@ class AssistiveBallOverlay(context: Context) {
}
container.addView(scroll)
if (showClose) {
- container.addView(tapButton("Close", colors) { hideCard() })
+ // Not a menu row: nothing to line up with, so it stays centred.
+ container.addView(
+ tapButton("Close", colors, iconRes = null, asMenuRow = false) { hideCard() }
+ )
}
try {
windowManager.addView(container, cardLayoutParams(container))
@@ -296,19 +299,19 @@ class AssistiveBallOverlay(context: Context) {
orientation = LinearLayout.VERTICAL
}
appNavRow.addView(
- tapButton("📱 Open App", colors) {
+ tapButton("Open App", colors, R.drawable.ic_overlay_open_app) {
removeMenu()
onOpenApp()
}
)
appNavRow.addView(
- tapButton("📸 Screenshot", colors) {
+ tapButton("Screenshot", colors, R.drawable.ic_overlay_screenshot) {
removeMenu()
onTakeScreenshot()
}
)
appNavRow.addView(
- tapButton("🔍 Lens", colors) {
+ tapButton("Lens", colors, R.drawable.ic_overlay_lens) {
removeMenu()
onStartLens()
}
@@ -450,14 +453,42 @@ class AssistiveBallOverlay(context: Context) {
EntityType.GENERIC_TEXT -> "📋"
}
- private fun tapButton(label: String, colors: OverlaySkin, onClick: () -> Unit): TextView {
+ /**
+ * A row in the ball's menu.
+ *
+ * [iconRes] is a vector, never an emoji: emoji are drawn by whichever font
+ * the OEM shipped, at whatever weight and in whatever colour that vendor
+ * chose, so they are the one element in the menu guaranteed not to match
+ * the app. Rows without one keep the text on the same column as rows with
+ * one, so the menu reads as a list rather than as two lists.
+ */
+ private fun tapButton(
+ label: String,
+ colors: OverlaySkin,
+ iconRes: Int? = null,
+ asMenuRow: Boolean = true,
+ onClick: () -> Unit
+ ): TextView {
+ val iconPx = dp(MENU_ICON_DP)
+ val iconGutter = iconPx + dp(MENU_ICON_GAP_DP)
return TextView(appContext).apply {
text = label
typeface = colors.sans
textSize = colors.bodySp
setTextColor(colors.buttonText)
- gravity = Gravity.CENTER
- setPadding(dp(14), dp(8), dp(14), dp(8))
+ gravity = if (asMenuRow) Gravity.CENTER_VERTICAL or Gravity.START else Gravity.CENTER
+ if (!asMenuRow) {
+ setPadding(dp(14), dp(8), dp(14), dp(8))
+ } else if (iconRes != null) {
+ val icon = androidx.core.content.ContextCompat.getDrawable(appContext, iconRes)
+ icon?.setBounds(0, 0, iconPx, iconPx)
+ icon?.setTint(colors.buttonText)
+ setCompoundDrawablesRelative(icon, null, null, null)
+ compoundDrawablePadding = dp(MENU_ICON_GAP_DP)
+ setPadding(dp(14), dp(8), dp(14), dp(8))
+ } else {
+ setPadding(dp(14) + iconGutter, dp(8), dp(14), dp(8))
+ }
background = GradientDrawable().apply {
cornerRadius = dp(colors.buttonRadiusDp.toInt()).toFloat()
setColor(colors.buttonBg)
@@ -841,6 +872,11 @@ class AssistiveBallOverlay(context: Context) {
const val BALL_MARK_INSET_DP = 9
const val MENU_WIDTH_DP = 290
+
+ /** Sized against bodyMedium, so the row reads as icon-then-label. */
+ const val MENU_ICON_DP = 18
+ const val MENU_ICON_GAP_DP = 12
+
const val LONG_PRESS_START_MS = 2000L
const val LONG_PRESS_END_MS = 2000L
const val DISMISS_TARGET_SIZE_DP = 64
diff --git a/app/src/main/res/drawable/ic_overlay_lens.xml b/app/src/main/res/drawable/ic_overlay_lens.xml
new file mode 100644
index 0000000..4b99bed
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overlay_lens.xml
@@ -0,0 +1,15 @@
+<!--
+ Material "search", replacing a 🔍 emoji — the same glyph the emoji was
+ standing in for, at the app's weight instead of the font vendor's.
+ Tinted at runtime from the skin — see AssistiveBallOverlay.tapButton.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="#FFFFFFFF">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z" />
+</vector>
diff --git a/app/src/main/res/drawable/ic_overlay_open_app.xml b/app/src/main/res/drawable/ic_overlay_open_app.xml
new file mode 100644
index 0000000..d2cd6bb
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overlay_open_app.xml
@@ -0,0 +1,17 @@
+<!--
+ Material "open_in_new". The ball's menu used to label this entry with a 📱
+ emoji, which renders as a different phone on every OEM and in a different
+ weight from every icon in the app.
+
+ Tinted at runtime from the skin — see AssistiveBallOverlay.tapButton.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="#FFFFFFFF">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z" />
+</vector>
diff --git a/app/src/main/res/drawable/ic_overlay_screenshot.xml b/app/src/main/res/drawable/ic_overlay_screenshot.xml
new file mode 100644
index 0000000..e6f7d17
--- /dev/null
+++ b/app/src/main/res/drawable/ic_overlay_screenshot.xml
@@ -0,0 +1,17 @@
+<!--
+ Material "photo_camera", replacing a 📸 emoji.
+ Tinted at runtime from the skin — see AssistiveBallOverlay.tapButton.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="#FFFFFFFF">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
+</vector>