Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.graphics.Bitmap
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -64,8 +65,13 @@ internal fun AppRow(
),
secondary = secondary,
showLinkArrow = true,
// The slot is always present, so a row doesn't shift sideways while its icon loads.
leading = {
icon?.let { Image(it.asImageBitmap(), contentDescription = null, modifier = Modifier.size(SidekitTheme.spacing.iconSize)) }
if (icon != null) {
Image(icon.asImageBitmap(), contentDescription = null, modifier = Modifier.size(SidekitTheme.spacing.iconSize))
} else {
Box(Modifier.size(SidekitTheme.spacing.iconSize))
}
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ internal fun AppsScreen(vm: AppsViewModel, back: () -> Unit) {
SidekitList(padding, state = list) {
item { AppSearchField(query) { vm.query.value = it } }
item { SidekitCard { SidekitText(selected?.let { "${it.label} selected. Press Options for app info or uninstall." } ?: "Tap to open · hold an app for Options", style = SidekitTheme.typography.label, maxLines = Int.MAX_VALUE) } }
(message ?: state.error)?.let { item { SidekitCard(onClick = { message = null }) { SidekitText(it, style = SidekitTheme.typography.label, maxLines = Int.MAX_VALUE) } } }
val banner = message ?: state.error
banner?.let { item { SidekitCard(onClick = { message = null }) { SidekitText(it, style = SidekitTheme.typography.label, maxLines = Int.MAX_VALUE) } } }
if (!state.loaded && state.error == null) item { SidekitItem("Loading apps…") }
if (state.loaded && state.apps.isEmpty()) item { SidekitItem("No matching apps") }
// listFade needs the row's real list index: search field and hint, plus the banner if shown.
val rowsStart = 2 + if (banner != null) 1 else 0
itemsIndexed(state.apps, key = { _, it -> it.key }) { index, target ->
AppRow(
target,
vm.repository,
Modifier.listFade(list, index + 2),
Modifier.listFade(list, index + rowsStart),
secondary = if (target.user != Process.myUserHandle()) "Work profile" else null,
onClick = {
selected = target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import hrln.interactive.sidekit.R
import hrln.interactive.sidekit.apps.apps.matchesApp
import hrln.interactive.sidekit.apps.settings.*
import hrln.interactive.sidekit.apps.sideport.registry.PortedApp
import hrln.interactive.sidekit.apps.sideport.registry.PortedApps
Expand Down Expand Up @@ -173,7 +174,8 @@ fun LauncherScreen(
LaunchedEffect(searching) { if (searching) runCatching { searchFocus.requestFocus() } }
val clear = SideAction.square("search.clear", SidekitIcon.Close, "Clear app search", ::clearSearch)
val entries = home.ifEmpty { defaultHome() }
val visible = entries.filter { it.id !in hiddenApps && it.label.contains(text, ignoreCase = true) }
// Same matcher as the Apps list, so a T9 query finds the same apps in both places.
val visible = entries.filter { it.id !in hiddenApps && matchesApp(it.label, text) }
BackHandler { clearSearch() }

SidekitScaffold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum class SubApp(val label: String, val icon: SidekitIcon, val designed: Boolea
Banking("Banking", SidekitIcon.AccountBalanceWallet),
Settings("Settings", SidekitIcon.Settings),
WebBrowser("Web browser", SidekitIcon.TravelExplore),
Apps("Apps", SidekitIcon.DeployedCode),
Apps("Apps", SidekitIcon.Apps),
Camera("Camera", SidekitIcon.PhotoCamera),
Sideweather("Sideweather", SidekitIcon.PartlyCloudyDay),
Calendar("Calendar", SidekitIcon.CalendarMonth),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum class SidekitIcon(@DrawableRes val drawable: Int) {
Album(R.drawable.sk_ic_album),
AndroidCell4Bar(R.drawable.sk_ic_android_cell_4_bar),
AndroidWifi3Bar(R.drawable.sk_ic_android_wifi_3_bar),
Apps(R.drawable.sk_ic_apps),
ArrowLeftAlt(R.drawable.sk_ic_arrow_left_alt),
ArrowRightAlt(R.drawable.sk_ic_arrow_right_alt),
ArrowUpward(R.drawable.sk_ic_arrow_upward),
Expand Down
9 changes: 9 additions & 0 deletions sidekit/src/main/res/drawable/sk_ic_apps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Material Symbols Rounded, filled: apps (Apache 2.0) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp"
android:viewportWidth="960" android:viewportHeight="960">
<group android:translateY="960.0">
<path android:fillColor="@android:color/white" android:pathData="M240-160q-33 0-56.5-23.5T160-240q0-33 23.5-56.5T240-320q33 0 56.5 23.5T320-240q0 33-23.5 56.5T240-160Zm240 0q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm240 0q-33 0-56.5-23.5T640-240q0-33 23.5-56.5T720-320q33 0 56.5 23.5T800-240q0 33-23.5 56.5T720-160ZM240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400ZM240-640q-33 0-56.5-23.5T160-720q0-33 23.5-56.5T240-800q33 0 56.5 23.5T320-720q0 33-23.5 56.5T240-640Zm240 0q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Zm240 0q-33 0-56.5-23.5T640-720q0-33 23.5-56.5T720-800q33 0 56.5 23.5T800-720q0 33-23.5 56.5T720-640Z" />
</group>
</vector>
Loading