GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Keep the keyboard up when switching agents in the composer · anomalyco/opencode-android@1cb057f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs/parity
    • composer.md
  • feature/composer/src/main
    • kotlin/ai/opencode/feature/composer
      • AgentPicker.kt
    • res
      • values-am
        • strings.xml
      • values-az
        • strings.xml
      • values-bg
        • strings.xml
      • values-bn
        • strings.xml
      • values-bs
        • strings.xml
      • values-ca
        • strings.xml
      • values-cs
        • strings.xml
      • values-da
        • strings.xml
      • values-de
        • strings.xml
      • values-dz
        • strings.xml
      • values-el
        • strings.xml
      • values-es
        • strings.xml
      • values-et
        • strings.xml
      • values-fi
        • strings.xml
      • values-fo
        • strings.xml
      • values-fr
        • strings.xml
      • values-hi
        • strings.xml
      • values-hr
        • strings.xml
      • values-hu
        • strings.xml
      • values-hy
        • strings.xml
      • values-in
        • strings.xml
      • values-is
        • strings.xml
      • values-it
        • strings.xml
      • values-ja
        • strings.xml
      • values-ka
        • strings.xml
      • values-km
        • strings.xml
      • values-ko
        • strings.xml
      • values-lo
        • strings.xml
      • values-lt
        • strings.xml
      • values-lv
        • strings.xml
      • values-mk
        • strings.xml
      • values-mn
        • strings.xml
      • values-ms
        • strings.xml
      • values-my
        • strings.xml
      • values-nb
        • strings.xml
      • values-ne
        • strings.xml
      • values-nl
        • strings.xml
      • values-pl
        • strings.xml
      • values-pt-rBR
        • strings.xml
      • values-ro
        • strings.xml
      • values-ru
        • strings.xml
      • values-si
        • strings.xml
      • values-sk
        • strings.xml
      • values-sl
        • strings.xml
      • values-sq
        • strings.xml
      • values-sr
        • strings.xml
      • values-sv
        • strings.xml
      • values-tg
        • strings.xml
      • values-th
        • strings.xml
      • values-tk
        • strings.xml
      • values-tr
        • strings.xml
      • values-uk
        • strings.xml
      • values-uz
        • strings.xml
      • values-vi
        • strings.xml
      • values-zh-rCN
        • strings.xml
      • values-zh-rTW
        • strings.xml
      • values
        • strings.xml

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/parity/composer.md‎

Copy file name to clipboardExpand all lines: docs/parity/composer.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Status values: `todo`, `partial: <what is missing>`, `done`, `n/a: <reason and w
1010

1111
| iOS file | Lines | Kotlin file(s) | Status | Notes |
1212
| --- | ---: | --- | --- | --- |
13-
| `OpenCode/Composer/AgentPicker.swift` | 149 | `AgentPicker.kt` | done | `AgentPickerSharedKeys` (`defaultAgentID` appStorage `default-agent` ""; `sessionAgents` file `session-agents.json`; `knownPrimaryAgents` file `primary-agents.json`); `choosable`/`displayName` already on `:server`'s `OpenCodeAutocompleteAgent`, `shortDescription` here. `ComposerAgentChip`/`AgentChip` (M3 `DropdownMenu`, “Loading Agents…”, one “Agent” section, checkmark rows with the first sentence, “Choose agent” + value, refresh on mount), `DefaultAgentSection` (“Default Agent”, “Server Default”, unlisted saved agent stays choosable, footer). `@Shared(.experimental(.agentSelection))` → `isEnabled` parameter (ExperimentalFeature lives in Settings). Keys are declared in `:core` (`defaultAgentID`) and `:server` (`sessionAgents`, `knownPrimaryAgents`); `AgentPickerSharedKeys` forwards to them Sync f657969b: only a comment changed (Default Agent moved to Settings › Sessions, 302b95e7). Sync ae029f85 (86ca6803, e16d3e8e): `ComposerAgentChip`/`AgentChip(targetDrop)` lower the whole menu as iOS does: the Box (and so the dropdown's anchor) drops by `targetDrop` (session passes `ComposerLayoutMetrics.pickerTargetDrop`) and the chip's ink moves back up by the same amount, so its target ends at the glass's bottom edge. |
13+
| `OpenCode/Composer/AgentPicker.swift` | 149 | `AgentPicker.kt` | done | `AgentPickerSharedKeys` (`defaultAgentID` appStorage `default-agent` ""; `sessionAgents` file `session-agents.json`; `knownPrimaryAgents` file `primary-agents.json`); `choosable`/`displayName` already on `:server`'s `OpenCodeAutocompleteAgent`. `ComposerAgentChip`/`AgentChip` (M3 `DropdownMenu`, “Loading Agents…”, “Choose agent” + value, refresh on mount), `DefaultAgentSection` (“Default Agent”, “Server Default”, unlisted saved agent stays choosable, footer). Android differs on purpose: the composer's agent menu is a non-focusable popup so the keyboard, draft and cursor stay put while switching, back closes it before the keyboard, and rows show only the agent's name with a trailing checkmark (no section title or description), as the desktop's agent select does. `@Shared(.experimental(.agentSelection))` → `isEnabled` parameter (ExperimentalFeature lives in Settings). Keys are declared in `:core` (`defaultAgentID`) and `:server` (`sessionAgents`, `knownPrimaryAgents`); `AgentPickerSharedKeys` forwards to them Sync f657969b: only a comment changed (Default Agent moved to Settings › Sessions, 302b95e7). Sync ae029f85 (86ca6803, e16d3e8e): `ComposerAgentChip`/`AgentChip(targetDrop)` lower the whole menu as iOS does: the Box (and so the dropdown's anchor) drops by `targetDrop` (session passes `ComposerLayoutMetrics.pickerTargetDrop`) and the chip's ink moves back up by the same amount, so its target ends at the glass's bottom edge. |
1414
| `OpenCode/Composer/AttachmentCameraLenses.swift` | 234 | `AttachmentCameraLenses.kt` | done | `CameraDeviceDescription`, `CameraZoomModel` (lens labels relative to the wide lens, native 2× crop, 10× cap, front 2×), `CameraZoomState` (mutable class + `copy()`), `AttachmentCameraFlash`. CameraX zoom ratios map into it in `AttachmentCaptureSession.describe` (ratio base = min zoom, physical lenses by intrinsic zoom). |
1515
| `OpenCode/Composer/AttachmentCameraView.swift` | 988 | `AttachmentCameraView.kt` | done | CameraX (`ProcessCameraProvider`, `Preview` → `CameraXViewfinder`, `ImageCapture` to an in-memory JPEG with EXIF, front unmirrored). Back camera default, front switch, pinch (cumulative scale), lens buttons ramp at 2^6/s (coroutine; CameraX has no ramp), TalkBack adjustable via `setProgress`, tap focus/long-press (500 ms) AE/AF Lock (`disableAutoCancel`), flash Off/Auto/On back only, controls inert when it can’t capture, camera-state errors → interruption/stopped copy, CAMERA permission via the activity (`requestPermissionsAndAwait`), Open Settings / Try Again. Subject-area-change focus reset → CameraX tap auto-cancel. `#if DEBUG` lab fixture n/a. Android fix (photo review): a lens/zoom query that throws after the camera bound (CameraX's physical-camera `intrinsicZoomRatio` is unsupported on Samsung's logical camera) no longer marks a running camera unavailable; the telephoto comes from Camera2 focal lengths then, rounded to its nominal whole number (3, not 2.7). The shutter is Android camera apps' 72 dp ring (iOS 58 pt), its face sized after the tap target (sized before it, the empty Box collapsed to its padding). Sync 01eef583 (258a9424): the AE/AF Lock badge on `MotionTransition.micro`, the lens buttons on `microIn`, the focus square in from 1.4× (`MotionReduce.scale`, a plain fade under Reduce Motion) on `microIn` enter/exit. |
1616
| `OpenCode/Composer/AttachmentFileType.swift` | 116 | `core/.../files/AttachmentFileType.kt` | done | Moved to `:core` by the system area (the share target needs it); the composer uses it from there (its own copy was removed on merge). |
Collapse file

‎feature/composer/src/main/kotlin/ai/opencode/feature/composer/AgentPicker.kt‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/kotlin/ai/opencode/feature/composer/AgentPicker.kt
+59-44Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ import ai.opencode.core.ui.OpenCodeIconSize
88
import ai.opencode.core.ui.OpenCodeTextStyles
99
import ai.opencode.core.ui.OpenCodeTheme
1010
import ai.opencode.core.ui.SFSymbol
11+
import ai.opencode.feature.composer.plusmenu.findActivity
1112
import ai.opencode.server.model.AgentDisplayName
1213
import ai.opencode.server.model.OpenCodeAutocompleteAgent
14+
import android.os.SystemClock
15+
import android.window.OnBackInvokedCallback
16+
import android.window.OnBackInvokedDispatcher
1317
import androidx.compose.foundation.clickable
1418
import androidx.compose.foundation.layout.Arrangement
1519
import androidx.compose.foundation.layout.Box
@@ -24,21 +28,24 @@ import androidx.compose.material3.DropdownMenu
2428
import androidx.compose.material3.DropdownMenuItem
2529
import androidx.compose.material3.Text
2630
import androidx.compose.runtime.Composable
31+
import androidx.compose.runtime.DisposableEffect
2732
import androidx.compose.runtime.LaunchedEffect
2833
import androidx.compose.runtime.collectAsState
2934
import androidx.compose.runtime.getValue
35+
import androidx.compose.runtime.mutableLongStateOf
3036
import androidx.compose.runtime.mutableStateOf
3137
import androidx.compose.runtime.remember
38+
import androidx.compose.runtime.rememberUpdatedState
3239
import androidx.compose.runtime.setValue
3340
import androidx.compose.ui.Alignment
3441
import androidx.compose.ui.Modifier
3542
import androidx.compose.ui.draw.alpha
43+
import androidx.compose.ui.platform.LocalContext
3644
import androidx.compose.ui.platform.testTag
3745
import androidx.compose.ui.res.stringResource
3846
import androidx.compose.ui.semantics.Role
3947
import androidx.compose.ui.semantics.clearAndSetSemantics
4048
import androidx.compose.ui.semantics.contentDescription
41-
import androidx.compose.ui.semantics.heading
4249
import androidx.compose.ui.semantics.role
4350
import androidx.compose.ui.semantics.selected
4451
import androidx.compose.ui.semantics.semantics
@@ -47,6 +54,7 @@ import androidx.compose.ui.text.font.FontWeight
4754
import androidx.compose.ui.text.style.TextOverflow
4855
import androidx.compose.ui.unit.Dp
4956
import androidx.compose.ui.unit.dp
57+
import androidx.compose.ui.window.PopupProperties
5058

5159
// Agent Selection (experimental `agentSelection`): choose the primary agent (Build, Plan,
5260
// or a custom one) from the composer.
@@ -65,16 +73,6 @@ object AgentPickerSharedKeys {
6573
val knownPrimaryAgents = ai.opencode.server.ServerSharedKeys.knownPrimaryAgents
6674
}
6775

68-
/** The description's first sentence, for a menu's subtitle. */
69-
val OpenCodeAutocompleteAgent.shortDescription: String?
70-
get() {
71-
val text = description?.trim()?.takeIf { it.isNotEmpty() } ?: return null
72-
// The first non-empty run before a dot, or the whole text when none.
73-
val rest = text.trimStart('.')
74-
val sentence = if (rest.isEmpty()) text else rest.substringBefore('.')
75-
return sentence.trim()
76-
}
77-
7876
/**
7977
* The agent chip beside the model chip, only while Agent Selection is on ([isEnabled]). [isFolded]
8078
* hides it as the composer folds.
@@ -120,16 +118,21 @@ fun AgentChip(
120118
targetDrop: Dp = 0.dp,
121119
) {
122120
var open by remember { mutableStateOf(false) }
121+
var closedAt by remember { mutableLongStateOf(0L) }
123122
// Mounted as the composer expands: the list is fresh before it opens.
124123
LaunchedEffect(Unit) { onOpen() }
125124
val chooseAgentDescription = stringResource(R.string.composer_agent_choose_description)
126125
val secondary = OpenCodeTheme.colors.secondaryText
126+
AgentMenuBackHandler(enabled = open) { open = false }
127127
// The whole menu moves its target down and its ink back up, so the menu drops from the lowered
128128
// target too.
129129
Box(modifier.offset(y = targetDrop)) {
130130
Row(
131131
Modifier
132-
.clickable(enabled = enabled, role = Role.Button) { open = true }
132+
.clickable(enabled = enabled, role = Role.Button) {
133+
// A tap on the chip while the menu is open has already closed it as an outside tap.
134+
if (SystemClock.uptimeMillis() - closedAt > 500) open = !open
135+
}
133136
.heightIn(min = 48.dp)
134137
.clearAndSetSemantics {
135138
contentDescription = chooseAgentDescription
@@ -145,46 +148,58 @@ fun AgentChip(
145148
Text(name, style = style, color = secondary, maxLines = 1, overflow = TextOverflow.Ellipsis)
146149
OpenCodeIcon(SFSymbol.ChevronDown, null, size = 12.dp, tint = secondary)
147150
}
148-
DropdownMenu(expanded = open, onDismissRequest = { open = false }) {
151+
DropdownMenu(
152+
expanded = open,
153+
onDismissRequest = {
154+
open = false
155+
closedAt = SystemClock.uptimeMillis()
156+
},
157+
properties = PopupProperties(focusable = false),
158+
) {
149159
if (agents.isEmpty()) {
150160
DropdownMenuItem(text = { Text(stringResource(R.string.composer_agent_loading)) }, onClick = {}, enabled = false)
151-
} else {
152-
// One “Agent” section (menu order fixed, as `.menuOrder(.fixed)`).
153-
Text(
154-
stringResource(R.string.composer_agent_section_title),
155-
style = OpenCodeTextStyles.footnote,
156-
color = secondary,
157-
modifier = Modifier.padding(horizontal = 16.dp, vertical = 6.dp).semantics { heading() },
161+
}
162+
for (agent in agents) {
163+
val isOn = agent.id == currentID
164+
DropdownMenuItem(
165+
text = {
166+
Text(
167+
agent.displayName,
168+
style = OpenCodeTextStyles.body,
169+
fontWeight = if (isOn) FontWeight.Medium else null,
170+
maxLines = 1,
171+
overflow = TextOverflow.Ellipsis,
172+
)
173+
},
174+
trailingIcon = {
175+
Box(Modifier.width(24.dp)) {
176+
if (isOn) OpenCodeIcon(SFSymbol.Checkmark, null, size = OpenCodeIconSize.small)
177+
}
178+
},
179+
modifier = Modifier.semantics { selected = isOn },
180+
onClick = {
181+
open = false
182+
onPick(agent.id)
183+
},
158184
)
159-
for (agent in agents) {
160-
val isOn = agent.id == currentID
161-
DropdownMenuItem(
162-
text = {
163-
Column {
164-
Text(agent.displayName, style = OpenCodeTextStyles.body)
165-
agent.shortDescription?.let {
166-
Text(it, style = OpenCodeTextStyles.footnote, color = secondary)
167-
}
168-
}
169-
},
170-
// A menu's toggle draws the checkmark and a subtitle.
171-
leadingIcon = {
172-
Box(Modifier.width(24.dp)) {
173-
if (isOn) OpenCodeIcon(SFSymbol.Checkmark, null, size = OpenCodeIconSize.small)
174-
}
175-
},
176-
modifier = Modifier.semantics { selected = isOn },
177-
onClick = {
178-
open = false
179-
onPick(agent.id)
180-
},
181-
)
182-
}
183185
}
184186
}
185187
}
186188
}
187189

190+
// The menu's popup doesn't take focus, so back goes to the activity; overlay priority runs it before the keyboard's.
191+
@Composable
192+
private fun AgentMenuBackHandler(enabled: Boolean, onBack: () -> Unit) {
193+
val activity = LocalContext.current.findActivity() ?: return
194+
val currentOnBack by rememberUpdatedState(onBack)
195+
DisposableEffect(activity, enabled) {
196+
if (!enabled) return@DisposableEffect onDispose { }
197+
val callback = OnBackInvokedCallback { currentOnBack() }
198+
activity.onBackInvokedDispatcher.registerOnBackInvokedCallback(OnBackInvokedDispatcher.PRIORITY_OVERLAY, callback)
199+
onDispose { activity.onBackInvokedDispatcher.unregisterOnBackInvokedCallback(callback) }
200+
}
201+
}
202+
188203
/**
189204
* Settings › Composer › Default Agent, the agent new sessions start with, only while Agent
190205
* Selection is on. Reads [AgentPickerSharedKeys.defaultAgentID] and
Collapse file

‎feature/composer/src/main/res/values-am/strings.xml‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/res/values-am/strings.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- Agent picker -->
44
<string name="composer_agent_choose_description">ወኪሉን ይምረጡ</string>
55
<string name="composer_agent_loading">ወኪሎችን በመጫን ላይ…</string>
6-
<string name="composer_agent_section_title">ወኪል</string>
76
<string name="composer_agent_server_default">የአገልጋዩ ነባሪ</string>
87
<string name="composer_agent_default_title">ነባሪ ወኪል</string>
98
<string name="composer_agent_default_footer">አዲስ ክፍለ ጊዜዎች በዚህ ወኪል ይጀምራሉ። እያንዳንዱ ክፍለ ጊዜ የመረጡትን ወኪል ያስታውሳል።</string>
Collapse file

‎feature/composer/src/main/res/values-az/strings.xml‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/res/values-az/strings.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- Agent picker -->
44
<string name="composer_agent_choose_description">Agent seçin</string>
55
<string name="composer_agent_loading">Agentlər yüklənir…</string>
6-
<string name="composer_agent_section_title">Agent</string>
76
<string name="composer_agent_server_default">Serverin standartı</string>
87
<string name="composer_agent_default_title">Standart agent</string>
98
<string name="composer_agent_default_footer">Yeni sessiyalar bu agentlə başlayır. Hər sessiya seçdiyiniz agenti yadda saxlayır.</string>
Collapse file

‎feature/composer/src/main/res/values-bg/strings.xml‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/res/values-bg/strings.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- Agent picker -->
44
<string name="composer_agent_choose_description">Изберете агент</string>
55
<string name="composer_agent_loading">Зареждане на агенти…</string>
6-
<string name="composer_agent_section_title">Агент</string>
76
<string name="composer_agent_server_default">По подразбиране за сървъра</string>
87
<string name="composer_agent_default_title">Агент по подразбиране</string>
98
<string name="composer_agent_default_footer">Новите сесии започват с този агент. Всяка сесия запомня кой сте избрали.</string>
Collapse file

‎feature/composer/src/main/res/values-bn/strings.xml‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/res/values-bn/strings.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- Agent picker -->
44
<string name="composer_agent_choose_description">এজেন্ট নির্বাচন করুন</string>
55
<string name="composer_agent_loading">এজেন্ট লোড হচ্ছে…</string>
6-
<string name="composer_agent_section_title">এজেন্ট</string>
76
<string name="composer_agent_server_default">সার্ভারের ডিফল্ট</string>
87
<string name="composer_agent_default_title">ডিফল্ট এজেন্ট</string>
98
<string name="composer_agent_default_footer">নতুন সেশন এই এজেন্ট দিয়ে শুরু হয়। প্রতিটি সেশনে আপনার বেছে নেওয়া এজেন্ট মনে রাখা হয়।</string>
Collapse file

‎feature/composer/src/main/res/values-bs/strings.xml‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/res/values-bs/strings.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- Agent picker -->
44
<string name="composer_agent_choose_description">Odaberi agenta</string>
55
<string name="composer_agent_loading">Učitavanje agenata…</string>
6-
<string name="composer_agent_section_title">Agent</string>
76
<string name="composer_agent_server_default">Podrazumijevano na serveru</string>
87
<string name="composer_agent_default_title">Podrazumijevani agent</string>
98
<string name="composer_agent_default_footer">Nove sesije počinju s ovim agentom. Svaka sesija pamti agenta kojeg odabereš.</string>
Collapse file

‎feature/composer/src/main/res/values-ca/strings.xml‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/res/values-ca/strings.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- Agent picker -->
44
<string name="composer_agent_choose_description">Trieu un agent</string>
55
<string name="composer_agent_loading">S\'estan carregant els agents…</string>
6-
<string name="composer_agent_section_title">Agent</string>
76
<string name="composer_agent_server_default">Per defecte del servidor</string>
87
<string name="composer_agent_default_title">Agent per defecte</string>
98
<string name="composer_agent_default_footer">Les sessions noves comencen amb aquest agent. Cada sessió recorda el que tries.</string>
Collapse file

‎feature/composer/src/main/res/values-cs/strings.xml‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/res/values-cs/strings.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- Agent picker -->
44
<string name="composer_agent_choose_description">Vyberte agenta</string>
55
<string name="composer_agent_loading">Načítání agentů…</string>
6-
<string name="composer_agent_section_title">Agent</string>
76
<string name="composer_agent_server_default">Výchozí na serveru</string>
87
<string name="composer_agent_default_title">Výchozí agent</string>
98
<string name="composer_agent_default_footer">Nové relace začínají s tímto agentem. Každá relace si pamatuje vaši volbu.</string>
Collapse file

‎feature/composer/src/main/res/values-da/strings.xml‎

Copy file name to clipboardExpand all lines: feature/composer/src/main/res/values-da/strings.xml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<!-- Agent picker -->
44
<string name="composer_agent_choose_description">Vælg agent</string>
55
<string name="composer_agent_loading">Indlæser agenter…</string>
6-
<string name="composer_agent_section_title">Agent</string>
76
<string name="composer_agent_server_default">Serverens standard</string>
87
<string name="composer_agent_default_title">Standardagent</string>
98
<string name="composer_agent_default_footer">Nye sessioner starter med denne agent. Hver session husker den, du vælger.</string>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.