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

+46 -3
View File
@@ -2,14 +2,19 @@
"""The server's colours, as the app's Compose theme.
scripts/fetch-tokens.py <server-ref> read tokens.css at that ref (a tag such as v1.7.0),
write Tokens.kt and tokens.lock.json
scripts/fetch-tokens.py verify: Tokens.kt matches tokens.lock.json
write Tokens.kt, the colour resources and tokens.lock.json
scripts/fetch-tokens.py verify: they match tokens.lock.json
The server is a git checkout, LLeMbas beside this repository by default (LEMBAS_SERVER names
another). Only the colour tokens of the two themes are read -- `moria` (declared on `:root`) and
`shire` -- and each becomes a `Palette` in Kotlin. The lock records the ref, the commit and the
SHA-256 of the generated file, as LLeMbas Desktop's `tokens.lock.json` does: the file in the tree
says which server version the look comes from, and CI refuses a copy that drifted.
What Compose cannot draw -- the home-screen widget, the shortcuts' icons -- takes the same colours
as Android resources: `values/tokens.xml` from `shire` and `values-night/tokens.xml` from `moria`,
a few of the tokens as `@color/token_<name>`, so a widget follows the phone's dark mode in the
app's own colours.
"""
from __future__ import annotations
@@ -27,6 +32,10 @@ SERVER = Path(os.environ.get("LEMBAS_SERVER", ROOT.parent / "LLeMbas"))
SOURCE = "src/lembas/web/static/css/tokens.css"
OUT = ROOT / "app/src/main/java/eu/llembas/android/ui/theme/Tokens.kt"
LOCK = ROOT / "tokens.lock.json"
RES = ROOT / "app/src/main/res"
# The tokens a resource reads, and which theme each folder takes.
RES_NAMES = ("bg", "surface", "surface-raised", "border", "ink", "ink-muted", "accent", "accent-ink", "accent-soft")
RES_THEMES = {"values": "shire", "values-night": "moria"}
# The tokens the app uses, in the order they are written. A token missing from a theme is an
# error rather than a default: a palette that silently fell back would look right and be wrong.
@@ -75,6 +84,32 @@ def camel(name: str) -> str:
return head + "".join(p.capitalize() for p in rest)
def android_colour(value: str) -> str:
"""#AARRGGBB, as a resource writes it."""
return "#" + argb(value)[2:]
def theme_values(css: str, theme: str) -> dict[str, str]:
return dict(re.findall(r"--([a-z0-9-]+)\s*:\s*([^;]+);", block(css, THEMES[theme])))
def generate_res(css: str, ref: str, theme: str) -> str:
values = theme_values(css, theme)
lines = [
'<?xml version="1.0" encoding="utf-8"?>',
f"<!-- Generated by scripts/fetch-tokens.py from the LLeMbas server's tokens.css at {ref} ({theme}). Do not edit. -->",
"<resources>",
*[f' <color name="token_{n.replace("-", "_")}">{android_colour(values[n])}</color>' for n in RES_NAMES],
"</resources>",
"",
]
return "\n".join(lines)
def res_files() -> dict[str, Path]:
return {folder: RES / folder / "tokens.xml" for folder in RES_THEMES}
def generate(css: str, ref: str) -> str:
lines = [
"// Generated by scripts/fetch-tokens.py from the LLeMbas server's tokens.css at "
@@ -105,6 +140,9 @@ def main() -> None:
lock = json.loads(LOCK.read_text())
if sha(OUT) != lock["sha256"]:
sys.exit(f"fetch-tokens: {OUT.name} does not match {LOCK.name} (server {lock['tag']})")
for folder, path in res_files().items():
if not path.exists() or sha(path) != lock.get("res", {}).get(folder):
sys.exit(f"fetch-tokens: {folder}/tokens.xml does not match {LOCK.name} (server {lock['tag']})")
print(f"fetch-tokens: {OUT.name} matches {LOCK.name} (server {lock['tag']})")
return
ref = sys.argv[1]
@@ -118,8 +156,13 @@ def main() -> None:
).stdout
OUT.parent.mkdir(parents=True, exist_ok=True)
OUT.write_text(generate(css, ref), encoding="utf-8")
res = {}
for folder, path in res_files().items():
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(generate_res(css, ref, RES_THEMES[folder]), encoding="utf-8")
res[folder] = sha(path)
LOCK.write_text(
json.dumps({"tag": ref, "commit": commit, "sha256": sha(OUT)}, indent=2) + "\n"
json.dumps({"tag": ref, "commit": commit, "sha256": sha(OUT), "res": res}, indent=2) + "\n"
)
print(f"fetch-tokens: wrote {OUT.relative_to(ROOT)} from {ref} ({commit[:12]})")
+5
View File
@@ -429,6 +429,11 @@ STRINGS: dict[str, str] = {
# Share
"share_sending": "Sending to LLeMbas…",
"share_default_prompt": "Have a look at this.",
"share_ask_hint": "What should LLeMbas do with it? (optional)",
"widget_hint": "Ask anything",
"widget_speak": "Speak",
"widget_description": "Ask by voice or text, or carry on the last assistant chat. Shows nothing from your account.",
"shortcut_last": "Last chat",
}
+48 -8
View File
@@ -152,9 +152,11 @@
"settings_about": "O aplikaci",
"settings_assistant": "Asistent",
"settings_instances": "Instance",
"share_ask_hint": "Co s tím má LLeMbas udělat? (nepovinné)",
"share_default_prompt": "Podívejte se na tohle.",
"share_label": "Zeptat se LLeMbas",
"share_sending": "Odesílá se do LLeMbas…",
"shortcut_last": "Poslední chat",
"shown": "Zobrazeno",
"signin_address": "Adresa instance",
"signin_code_intro": "Otevřete instanci v prohlížeči, přihlaste se a schvalte tento kód:",
@@ -221,7 +223,10 @@
"voice_input_lembas_line": "Převod řeči na text vaší instance, přes server. Nahrávka jde na vaši instanci a nikam jinam.",
"voice_input_phone": "Telefon (Google nebo systémový)",
"voice_input_phone_line": "Vlastní rozpoznávání řeči v telefonu. Slova se objevují, jak mluvíte; nahrávka jde tam, kam ji to rozpoznávání pošle.",
"voice_input_phone_none": "Tento telefon nemá vlastní rozpoznávání řeči."
"voice_input_phone_none": "Tento telefon nemá vlastní rozpoznávání řeči.",
"widget_description": "Ptejte se hlasem nebo textem, nebo pokračujte v poslední konverzaci s asistentem. Neukazuje nic z vašeho účtu.",
"widget_hint": "Zeptejte se na cokoli",
"widget_speak": "Mluvit"
},
"de": {
"about_version": "LLeMbas für Android %1$s",
@@ -377,9 +382,11 @@
"settings_about": "Über",
"settings_assistant": "Assistent",
"settings_instances": "Instanzen",
"share_ask_hint": "Was soll LLeMbas damit tun? (optional)",
"share_default_prompt": "Schauen Sie sich das an.",
"share_label": "LLeMbas fragen",
"share_sending": "Wird an LLeMbas gesendet…",
"shortcut_last": "Letzter Chat",
"shown": "Angezeigt",
"signin_address": "Adresse der Instanz",
"signin_code_intro": "Öffnen Sie die Instanz im Browser, melden Sie sich an und bestätigen Sie diesen Code:",
@@ -446,7 +453,10 @@
"voice_input_lembas_line": "Die Spracherkennung Ihrer Instanz, über den Server. Die Aufnahme geht an Ihre Instanz und nirgendwo sonst hin.",
"voice_input_phone": "Telefon (Google oder das System)",
"voice_input_phone_line": "Die eigene Spracherkennung des Telefons. Die Wörter erscheinen beim Sprechen; die Aufnahme geht dorthin, wohin diese Erkennung sie schickt.",
"voice_input_phone_none": "Dieses Telefon hat keine eigene Spracherkennung."
"voice_input_phone_none": "Dieses Telefon hat keine eigene Spracherkennung.",
"widget_description": "Per Sprache oder Text fragen oder den letzten Assistenten-Chat fortsetzen. Zeigt nichts aus Ihrem Konto.",
"widget_hint": "Frag mich alles",
"widget_speak": "Sprechen"
},
"es": {
"about_version": "LLeMbas para Android %1$s",
@@ -601,9 +611,11 @@
"settings_about": "Acerca de",
"settings_assistant": "Asistente",
"settings_instances": "Instancias",
"share_ask_hint": "¿Qué debe hacer LLeMbas con esto? (opcional)",
"share_default_prompt": "Échele un vistazo a esto.",
"share_label": "Preguntar a LLeMbas",
"share_sending": "Enviando a LLeMbas…",
"shortcut_last": "Último chat",
"shown": "Mostrado",
"signin_address": "Dirección de la instancia",
"signin_code_intro": "Abra la instancia en el navegador, inicie sesión y apruebe este código:",
@@ -670,7 +682,10 @@
"voice_input_lembas_line": "La conversión de voz a texto de su instancia, a través del servidor. La grabación va a su instancia y a ningún otro sitio.",
"voice_input_phone": "Teléfono (Google o el del sistema)",
"voice_input_phone_line": "El reconocimiento de voz del propio teléfono. Las palabras aparecen mientras habla; la grabación va adonde ese reconocimiento la envíe.",
"voice_input_phone_none": "Este teléfono no tiene reconocimiento de voz propio."
"voice_input_phone_none": "Este teléfono no tiene reconocimiento de voz propio.",
"widget_description": "Pregunta por voz o por texto, o continúa el último chat del asistente. No muestra nada de tu cuenta.",
"widget_hint": "Pregunta lo que quieras",
"widget_speak": "Hablar"
},
"fr": {
"about_version": "LLeMbas pour Android %1$s",
@@ -826,9 +841,11 @@
"settings_about": "À propos",
"settings_assistant": "Assistant",
"settings_instances": "Instances",
"share_ask_hint": "Que doit en faire LLeMbas ? (facultatif)",
"share_default_prompt": "Jetez un œil à ceci.",
"share_label": "Demander à LLeMbas",
"share_sending": "Envoi à LLeMbas…",
"shortcut_last": "Dernière discussion",
"shown": "Affiché",
"signin_address": "Adresse de l'instance",
"signin_code_intro": "Ouvrez l'instance dans le navigateur, connectez-vous et approuvez ce code :",
@@ -895,7 +912,10 @@
"voice_input_lembas_line": "La transcription de votre instance, via le serveur. L’enregistrement va à votre instance et nulle part ailleurs.",
"voice_input_phone": "Téléphone (Google ou celui du système)",
"voice_input_phone_line": "La reconnaissance vocale du téléphone. Les mots apparaissent pendant que vous parlez ; l’enregistrement va là où cette reconnaissance l’envoie.",
"voice_input_phone_none": "Ce téléphone n’a pas de reconnaissance vocale propre."
"voice_input_phone_none": "Ce téléphone n’a pas de reconnaissance vocale propre.",
"widget_description": "Demandez à la voix ou par écrit, ou reprenez la dernière discussion de l’assistant. N’affiche rien de votre compte.",
"widget_hint": "Posez une question",
"widget_speak": "Parler"
},
"hu": {
"about_version": "LLeMbas Androidra %1$s",
@@ -1051,9 +1071,11 @@
"settings_about": "Névjegy",
"settings_assistant": "Asszisztens",
"settings_instances": "Példányok",
"share_ask_hint": "Mit kezdjen vele a LLeMbas? (nem kötelező)",
"share_default_prompt": "Nézze meg ezt.",
"share_label": "Kérdés az LLeMbas-tól",
"share_sending": "Küldés az LLeMbas-nak…",
"shortcut_last": "Utolsó csevegés",
"shown": "Megjelenítve",
"signin_address": "A példány címe",
"signin_code_intro": "Nyissa meg a példányt a böngészőben, jelentkezzen be, és hagyja jóvá ezt a kódot:",
@@ -1120,7 +1142,10 @@
"voice_input_lembas_line": "A példánya beszédfelismerése, a szerveren át. A felvétel a példányához megy, máshová nem.",
"voice_input_phone": "Telefon (Google vagy a rendszeré)",
"voice_input_phone_line": "A telefon saját beszédfelismerője. A szavak beszéd közben jelennek meg; a felvétel oda megy, ahová az a felismerő küldi.",
"voice_input_phone_none": "Ennek a telefonnak nincs saját beszédfelismerője."
"voice_input_phone_none": "Ennek a telefonnak nincs saját beszédfelismerője.",
"widget_description": "Kérdezz hanggal vagy szöveggel, vagy folytasd az asszisztens legutóbbi csevegését. A fiókodból semmit sem mutat.",
"widget_hint": "Kérdezz bármit",
"widget_speak": "Beszéd"
},
"it": {
"about_version": "LLeMbas per Android %1$s",
@@ -1275,9 +1300,11 @@
"settings_about": "Informazioni",
"settings_assistant": "Assistente",
"settings_instances": "Istanze",
"share_ask_hint": "Cosa deve farne LLeMbas? (facoltativo)",
"share_default_prompt": "Dai un'occhiata a questo.",
"share_label": "Chiedi a LLeMbas",
"share_sending": "Invio a LLeMbas…",
"shortcut_last": "Ultima chat",
"shown": "Mostrato",
"signin_address": "Indirizzo dell'istanza",
"signin_code_intro": "Apri l'istanza nel browser, accedi e approva questo codice:",
@@ -1344,7 +1371,10 @@
"voice_input_lembas_line": "La trascrizione della sua istanza, tramite il server. La registrazione va alla sua istanza e da nessun’altra parte.",
"voice_input_phone": "Telefono (Google o quello di sistema)",
"voice_input_phone_line": "Il riconoscimento vocale del telefono. Le parole appaiono mentre parla; la registrazione va dove la manda quel riconoscimento.",
"voice_input_phone_none": "Questo telefono non ha un riconoscimento vocale proprio."
"voice_input_phone_none": "Questo telefono non ha un riconoscimento vocale proprio.",
"widget_description": "Chiedi a voce o per iscritto, o continua l’ultima chat dell’assistente. Non mostra nulla del tuo account.",
"widget_hint": "Chiedi qualsiasi cosa",
"widget_speak": "Parla"
},
"pl": {
"about_version": "LLeMbas na Androida %1$s",
@@ -1499,9 +1529,11 @@
"settings_about": "Informacje",
"settings_assistant": "Asystent",
"settings_instances": "Instancje",
"share_ask_hint": "Co LLeMbas ma z tym zrobić? (opcjonalnie)",
"share_default_prompt": "Zobacz to.",
"share_label": "Zapytaj LLeMbas",
"share_sending": "Wysyłanie do LLeMbas…",
"shortcut_last": "Ostatni czat",
"shown": "Pokazano",
"signin_address": "Adres instancji",
"signin_code_intro": "Otwórz instancję w przeglądarce, zaloguj się i zatwierdź ten kod:",
@@ -1568,7 +1600,10 @@
"voice_input_lembas_line": "Zamiana mowy na tekst Twojej instancji, przez serwer. Nagranie trafia do Twojej instancji i nigdzie indziej.",
"voice_input_phone": "Telefon (Google lub systemowy)",
"voice_input_phone_line": "Własne rozpoznawanie mowy telefonu. Słowa pojawiają się w trakcie mówienia; nagranie trafia tam, dokąd wyśle je to rozpoznawanie.",
"voice_input_phone_none": "Ten telefon nie ma własnego rozpoznawania mowy."
"voice_input_phone_none": "Ten telefon nie ma własnego rozpoznawania mowy.",
"widget_description": "Pytaj głosem lub tekstem albo kontynuuj ostatni czat asystenta. Nie pokazuje niczego z Twojego konta.",
"widget_hint": "Zapytaj o cokolwiek",
"widget_speak": "Mów"
},
"sk": {
"about_version": "LLeMbas pre Android %1$s",
@@ -1723,9 +1758,11 @@
"settings_about": "O aplikácii",
"settings_assistant": "Asistent",
"settings_instances": "Inštancie",
"share_ask_hint": "Čo s tým má LLeMbas urobiť? (nepovinné)",
"share_default_prompt": "Pozrite sa na toto.",
"share_label": "Spýtať sa LLeMbas",
"share_sending": "Odosiela sa do LLeMbas…",
"shortcut_last": "Posledný chat",
"shown": "Zobrazené",
"signin_address": "Adresa inštancie",
"signin_code_intro": "Otvorte inštanciu v prehliadači, prihláste sa a schváľte tento kód:",
@@ -1792,6 +1829,9 @@
"voice_input_lembas_line": "Prevod reči na text vašej inštancie, cez server. Nahrávka ide na vašu inštanciu a nikam inam.",
"voice_input_phone": "Telefón (Google alebo systémový)",
"voice_input_phone_line": "Vlastné rozpoznávanie reči v telefóne. Slová sa objavujú, ako hovoríte; nahrávka ide tam, kam ju to rozpoznávanie pošle.",
"voice_input_phone_none": "Tento telefón nemá vlastné rozpoznávanie reči."
"voice_input_phone_none": "Tento telefón nemá vlastné rozpoznávanie reči.",
"widget_description": "Pýtajte sa hlasom alebo textom, alebo pokračujte v poslednej konverzácii s asistentom. Neukazuje nič z vášho účtu.",
"widget_hint": "Opýtajte sa na čokoľvek",
"widget_speak": "Hovoriť"
}
}