Assistant entry points: share sheet (new or last chat), widget, shortcuts, headset button
CI / check (push) Canceled after 0s

- Share: a sheet over the sharing app shows what came in, takes an optional request, and sends
  to a new chat or the last assistant chat; files uploaded first; a new chat becomes the last.
- Home-screen widget (RemoteViews, nothing from the account): Ask, Speak, last chat.
- Launcher shortcuts published from code (the debug build's package differs): Ask, Speak, Last.
- ACTION_VOICE_COMMAND / VOICE_SEARCH_HANDS_FREE open the sheet listening; locked: unlock first.
- Quick Settings tile: STATE_INACTIVE (never greyed out), TOGGLEABLE_TILE false.
- fetch-tokens.py also writes values{,-night}/tokens.xml for what Compose cannot draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-11-10 16:05:11 +00:00
1 parent 9b700ee42c
commit 77e1539e8f
38 files changed
+964 -135

No files matched your search

@@ -10,6 +10,7 @@ import eu.llembas.android.assist.SheetStop
import eu.llembas.android.assist.settle
import eu.llembas.android.assist.usePhoneRecognizer
import eu.llembas.android.auth.Prefs
import eu.llembas.android.share.shareMessage
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
@@ -87,4 +88,12 @@ class AssistTest {
assertFalse(usePhoneRecognizer(Prefs.VOICE_LEMBAS, phoneHas = true, instanceStt = true))
assertTrue(usePhoneRecognizer(Prefs.VOICE_LEMBAS, phoneHas = true, instanceStt = false))
}
@Test
fun aShareSendsTheRequestBeforeWhatWasShared() {
assertEquals("Summarise it.\n\n---\n\nhttps://example.org", shareMessage(" Summarise it. ", "https://example.org\n", "Have a look."))
assertEquals("Have a look.\n\n---\n\nSome text", shareMessage("", "Some text", "Have a look."))
// Files only: the request alone, the files go as attachments.
assertEquals("Have a look.", shareMessage(" ", "", "Have a look."))
}
}
@@ -44,6 +44,8 @@ import eu.llembas.android.assist.Connection
import eu.llembas.android.assist.LastAssist
import eu.llembas.android.auth.Instance
import eu.llembas.android.auth.Prefs
import eu.llembas.android.share.ShareState
import eu.llembas.android.share.SharedFile
import eu.llembas.android.ui.chat.ChatState
import eu.llembas.android.ui.chat.Draft
import eu.llembas.android.ui.home.ChatsState
@@ -411,6 +413,18 @@ object Fakes {
error = "Home cannot be reached.",
)
// A share from another app.
val shareLink = ShareState(
text = "The Long Road: a walker's guide to waybread\nhttps://example.org/waybread",
last = LastAssist("c1", "Packing for the road", 0),
)
val shareFiles = ShareState(
files = listOf(SharedFile("map-of-the-road.jpg", image = true), SharedFile("provisions.pdf", image = false)),
last = LastAssist("c1", "Packing for the road", 0),
error = "Home cannot be reached.",
)
// Scheduled: shaped as the server's contract fixtures are (contract/schedule*.json).
private fun rule(text: String) = LembasJson.parseToJsonElement(text).jsonObject
@@ -1,10 +1,14 @@
@file:OptIn(ExperimentalRoborazziApi::class)
package eu.llembas.android.shots
import android.view.LayoutInflater
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
@@ -16,10 +20,20 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import com.github.takahirom.roborazzi.ExperimentalRoborazziApi
import com.github.takahirom.roborazzi.RoborazziComposeOptions
import com.github.takahirom.roborazzi.captureRoboImage
import com.github.takahirom.roborazzi.inspectionMode
import com.github.takahirom.roborazzi.size
import eu.llembas.android.R
import eu.llembas.android.assist.AssistActions
import eu.llembas.android.assist.AssistSheetContent
import eu.llembas.android.assist.AssistSheetFrame
import eu.llembas.android.assist.AssistUiState
import eu.llembas.android.share.ShareActions
import eu.llembas.android.share.ShareSheetContent
import eu.llembas.android.share.ShareState
import eu.llembas.android.ui.chat.ActivityActions
import eu.llembas.android.ui.chat.ActivityContent
import eu.llembas.android.ui.chat.CardSheet
@@ -66,6 +80,8 @@ private object NoSettingsActions : SettingsActions
private object NoAssistActions : AssistActions
private object NoShareActions : ShareActions
/**
* The app's screens with made-up data ([Fakes]), as a phone shows them: each in Shire and
* Moria, at a large phone's size and, where things crowd, a small one's and with large type.
@@ -287,6 +303,49 @@ class ScreenShots {
shoot("28-memory", Phone.Small, fontScale = 1.5f) { MemoryContent(Fakes.memory, NoMemoryActions) }
shoot("28-memory-none") { MemoryContent(MemoryState(), NoMemoryActions) }
}
/** "Ask LLeMbas" from another app's share menu: a link, and a picture with a file. */
@Test
fun share() {
val over: (ShareState) -> @Composable () -> Unit = { state ->
{
Box(Modifier.fillMaxSize()) {
ChatContent(Fakes.transcript, NoChatActions, agent = false)
AssistSheetFrame(onDismiss = {}) { handle, _ -> ShareSheetContent(state, NoShareActions, handle) }
}
}
}
shoot("30-share-link", content = over(Fakes.shareLink))
shoot("30-share-link", Phone.Small, fontScale = 1.5f, content = over(Fakes.shareLink))
shoot("31-share-files", content = over(Fakes.shareFiles))
}
/** The home-screen widget, as the launcher inflates it (light; [widgetNight] is dark). */
@Test
fun widget() = shootWidget("light")
@Test
@Config(qualifiers = "+night")
fun widgetNight() = shootWidget("dark")
private fun shootWidget(theme: String) {
for (phone in listOf(Phone.Large, Phone.Small)) {
captureRoboImage(
filePath = "build/screenshots/${phone.tag}-32-widget-$theme.png",
roborazziComposeOptions = RoborazziComposeOptions {
size(phone.widthDp, 120)
inspectionMode(true)
},
) {
Box(Modifier.fillMaxSize().padding(16.dp), contentAlignment = Alignment.Center) {
AndroidView(
factory = { context -> LayoutInflater.from(context).inflate(R.layout.widget_ask, null) },
modifier = Modifier.fillMaxWidth().height(64.dp),
)
}
}
}
}
}
/**