Skip to content

Commit f0170ca

Browse files
Android: collapse sidebar search behind header action (#116956)
* feat(android): collapse sidebar search * test(android): cover sidebar search toggle Co-authored-by: IWhatsskill <[email protected]> * chore(android): refresh sidebar i18n inventory Co-authored-by: IWhatsskill <[email protected]> * test(android): restore sidebar test clock Co-authored-by: IWhatsskill <[email protected]> * test(android): remove stateful sidebar UI test Co-authored-by: IWhatsskill <[email protected]> --------- Co-authored-by: IWhatsskill <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
1 parent 652a47e commit f0170ca

3 files changed

Lines changed: 61 additions & 25 deletions

File tree

‎apps/.i18n/native-source.json‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10291,143 +10291,143 @@
1029110291
},
1029210292
{
1029310293
"kind": "ui-call",
10294-
"line": 63,
10294+
"line": 52,
1029510295
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarComponents.kt",
1029610296
"source": "Search sessions",
1029710297
"surface": "android",
1029810298
"id": "native.android.0c2501a6c5ddca09"
1029910299
},
1030010300
{
1030110301
"kind": "ui-call",
10302-
"line": 75,
10302+
"line": 78,
1030310303
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarComponents.kt",
1030410304
"source": "Clear session search",
1030510305
"surface": "android",
1030610306
"id": "native.android.590e8e370944beee"
1030710307
},
1030810308
{
1030910309
"kind": "ui-call",
10310-
"line": 224,
10310+
"line": 227,
1031110311
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarComponents.kt",
1031210312
"source": "Working",
1031310313
"surface": "android",
1031410314
"id": "native.android.5409a13f0c35e1ae"
1031510315
},
1031610316
{
1031710317
"kind": "ui-call",
10318-
"line": 225,
10318+
"line": 228,
1031910319
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarComponents.kt",
1032010320
"source": "Needs attention",
1032110321
"surface": "android",
1032210322
"id": "native.android.ba8628561f3d7c81"
1032310323
},
1032410324
{
1032510325
"kind": "ui-call",
10326-
"line": 226,
10326+
"line": 229,
1032710327
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarComponents.kt",
1032810328
"source": "Selected",
1032910329
"surface": "android",
1033010330
"id": "native.android.7371ad8f117e08ff"
1033110331
},
1033210332
{
1033310333
"kind": "ui-call",
10334-
"line": 73,
10334+
"line": 78,
1033510335
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1033610336
"source": "Home",
1033710337
"surface": "android",
1033810338
"id": "native.android.4e2f2b168d8402e5"
1033910339
},
1034010340
{
1034110341
"kind": "ui-call",
10342-
"line": 74,
10342+
"line": 79,
1034310343
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1034410344
"source": "Overview",
1034510345
"surface": "android",
1034610346
"id": "native.android.411af820e8607155"
1034710347
},
1034810348
{
1034910349
"kind": "ui-call",
10350-
"line": 75,
10350+
"line": 80,
1035110351
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1035210352
"source": "Usage",
1035310353
"surface": "android",
1035410354
"id": "native.android.82ebfe54bfbfd385"
1035510355
},
1035610356
{
1035710357
"kind": "ui-call",
10358-
"line": 76,
10358+
"line": 81,
1035910359
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1036010360
"source": "Automations",
1036110361
"surface": "android",
1036210362
"id": "native.android.24fff115bd302167"
1036310363
},
1036410364
{
1036510365
"kind": "ui-call",
10366-
"line": 77,
10366+
"line": 82,
1036710367
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1036810368
"source": "Threads",
1036910369
"surface": "android",
1037010370
"id": "native.android.cf5241cd358243fd"
1037110371
},
1037210372
{
1037310373
"kind": "ui-named-argument",
10374-
"line": 216,
10374+
"line": 224,
1037510375
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1037610376
"source": "OpenClaw",
1037710377
"surface": "android",
1037810378
"id": "native.android.aa57a340615c6acc"
1037910379
},
1038010380
{
1038110381
"kind": "ui-call",
10382-
"line": 225,
10382+
"line": 250,
1038310383
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1038410384
"source": "Open Settings",
1038510385
"surface": "android",
1038610386
"id": "native.android.0a6327687ccfbfdb"
1038710387
},
1038810388
{
1038910389
"kind": "ui-call",
10390-
"line": 234,
10390+
"line": 259,
1039110391
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1039210392
"source": "Hide Sidebar",
1039310393
"surface": "android",
1039410394
"id": "native.android.a52860ece0b7e03c"
1039510395
},
1039610396
{
1039710397
"kind": "ui-call",
10398-
"line": 249,
10398+
"line": 282,
1039910399
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1040010400
"source": "Agents",
1040110401
"surface": "android",
1040210402
"id": "native.android.e2d9151fcb89115a"
1040310403
},
1040410404
{
1040510405
"kind": "ui-call",
10406-
"line": 261,
10406+
"line": 294,
1040710407
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1040810408
"source": "More Agents",
1040910409
"surface": "android",
1041010410
"id": "native.android.8561b4bd41836a1d"
1041110411
},
1041210412
{
1041310413
"kind": "ui-call",
10414-
"line": 291,
10414+
"line": 324,
1041510415
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1041610416
"source": "Pages",
1041710417
"surface": "android",
1041810418
"id": "native.android.a96adb01ce2f2dbe"
1041910419
},
1042010420
{
1042110421
"kind": "ui-call",
10422-
"line": 301,
10422+
"line": 334,
1042310423
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1042410424
"source": "Recent sessions",
1042510425
"surface": "android",
1042610426
"id": "native.android.a5eca2d258c332b5"
1042710427
},
1042810428
{
1042910429
"kind": "ui-call",
10430-
"line": 304,
10430+
"line": 337,
1043110431
"path": "apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt",
1043210432
"source": "No recent sessions",
1043310433
"surface": "android",

‎apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarComponents.kt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ import androidx.compose.ui.text.style.TextOverflow
4848
import androidx.compose.ui.unit.dp
4949
import androidx.compose.ui.unit.sp
5050

51+
@Composable
52+
internal fun sidebarSearchLabel(): String = nativeString("Search sessions")
53+
5154
@Composable
5255
internal fun SidebarSearchField(
5356
query: String,
@@ -60,7 +63,7 @@ internal fun SidebarSearchField(
6063
onValueChange = onQueryChange,
6164
modifier = modifier.fillMaxWidth().testTag("sidebar-search"),
6265
singleLine = true,
63-
label = { Text(nativeString("Search sessions")) },
66+
label = { Text(sidebarSearchLabel()) },
6467
leadingIcon = {
6568
Icon(
6669
imageVector = Icons.Default.Search,

‎apps/android/app/src/main/java/ai/openclaw/app/ui/SidebarContent.kt‎

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import androidx.compose.material.icons.Icons
2727
import androidx.compose.material.icons.filled.Close
2828
import androidx.compose.material.icons.filled.Home
2929
import androidx.compose.material.icons.filled.KeyboardArrowDown
30+
import androidx.compose.material.icons.filled.Search
3031
import androidx.compose.material.icons.filled.Settings
3132
import androidx.compose.material.icons.filled.Storage
3233
import androidx.compose.material.icons.outlined.AccessTime
@@ -39,6 +40,7 @@ import androidx.compose.material3.Icon
3940
import androidx.compose.material3.IconButton
4041
import androidx.compose.material3.Text
4142
import androidx.compose.runtime.Composable
43+
import androidx.compose.runtime.LaunchedEffect
4244
import androidx.compose.runtime.getValue
4345
import androidx.compose.runtime.mutableStateOf
4446
import androidx.compose.runtime.remember
@@ -47,9 +49,12 @@ import androidx.compose.runtime.setValue
4749
import androidx.compose.ui.Alignment
4850
import androidx.compose.ui.Modifier
4951
import androidx.compose.ui.draw.clip
52+
import androidx.compose.ui.focus.FocusRequester
53+
import androidx.compose.ui.focus.focusRequester
5054
import androidx.compose.ui.graphics.Color
5155
import androidx.compose.ui.graphics.luminance
5256
import androidx.compose.ui.graphics.vector.ImageVector
57+
import androidx.compose.ui.platform.LocalFocusManager
5358
import androidx.compose.ui.platform.testTag
5459
import androidx.compose.ui.semantics.clearAndSetSemantics
5560
import androidx.compose.ui.semantics.semantics
@@ -187,7 +192,10 @@ internal fun OpenClawSidebar(
187192
val palette = sidebarPalette()
188193
val roster = sidebarAgentRoster(agents, selectedAgentId)
189194
var query by rememberSaveable { mutableStateOf("") }
195+
var isSearchActive by rememberSaveable { mutableStateOf(false) }
190196
var agentsExpanded by remember { mutableStateOf(false) }
197+
val searchFocusRequester = remember { FocusRequester() }
198+
val focusManager = LocalFocusManager.current
191199
val recentSessions = sidebarRecentSessions(sessions, query)
192200
val connectionLabel = gatewayStatusLabel(connection)
193201

@@ -219,6 +227,23 @@ internal fun OpenClawSidebar(
219227
modifier = Modifier.weight(1f),
220228
maxLines = 1,
221229
)
230+
IconButton(
231+
onClick = {
232+
isSearchActive = !isSearchActive
233+
if (!isSearchActive) {
234+
query = ""
235+
focusManager.clearFocus()
236+
}
237+
},
238+
modifier = Modifier.size(48.dp).testTag("sidebar-search-toggle"),
239+
) {
240+
Icon(
241+
imageVector = Icons.Default.Search,
242+
contentDescription = sidebarSearchLabel(),
243+
tint = palette.text,
244+
modifier = Modifier.size(20.dp),
245+
)
246+
}
222247
IconButton(onClick = onOpenSettings, modifier = Modifier.size(48.dp)) {
223248
Icon(
224249
imageVector = Icons.Default.Settings,
@@ -239,12 +264,20 @@ internal fun OpenClawSidebar(
239264
}
240265
}
241266

242-
SidebarSearchField(
243-
query = query,
244-
onQueryChange = { query = it },
245-
palette = palette,
246-
modifier = Modifier.padding(top = 4.dp, bottom = 12.dp),
247-
)
267+
if (isSearchActive) {
268+
LaunchedEffect(searchFocusRequester) {
269+
searchFocusRequester.requestFocus()
270+
}
271+
SidebarSearchField(
272+
query = query,
273+
onQueryChange = { query = it },
274+
palette = palette,
275+
modifier =
276+
Modifier
277+
.focusRequester(searchFocusRequester)
278+
.padding(top = 4.dp, bottom = 12.dp),
279+
)
280+
}
248281

249282
SidebarSectionTitle(nativeString("Agents"), palette)
250283
roster.selected?.let { selected ->

0 commit comments

Comments
 (0)