commit
One look for every app: Inbox's theme as a shared :design module
Inbox's theme (palette, IBM Plex, the wallpaper backdrop, glass section cards, eyebrow headings) moves into :design, and every app's theme comes from it, so they can't drift apart. Plural drops its near-copy, Manager its own palette, and Device Reporter's XML screen is ported to Compose with the same behaviour. Text outside a Scaffold now defaults to the light text colour instead of black (Inbox's sign-in title and much of Device Reporter were unreadable), and every app gets light system-bar icons whatever the phone's theme.
diff --git a/README.md b/README.md
index d3037c1..2d07fc5 100644
--- a/README.md
+++ b/README.md
@@ -20,14 +20,16 @@ Plural is the System app; see [plural/README.md](plural/README.md).
settings.gradle.kts every app module is included here
build.gradle.kts plugin versions (apply false)
gradle/libs.versions.toml one version catalog: SDK levels, plugins, libraries
+design/ the shared look (Inbox's theme): palette, IBM Plex, backdrop, glass cards
<app>/app/ one Android application module per app
docs/releasing.md tags, version codes, signing, CI secrets
docs/manifest.md the Doughmination Manager's manifest format
.github/workflows/apps.yml one workflow: builds, signs and releases every app
```
-The apps share the build and the catalog, never each other's code: no app
-depends on another, and each keeps its own namespace, application ID,
+The apps share the build, the catalog and the look (`:design`, which every
+app's theme comes from, so they can't drift apart), never each other's code:
+no app depends on another, and each keeps its own namespace, application ID,
resources and signing key.
## Building
diff --git a/api-helper/app/build.gradle.kts b/api-helper/app/build.gradle.kts
index df90ca7..c31d831 100644
--- a/api-helper/app/build.gradle.kts
+++ b/api-helper/app/build.gradle.kts
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.kotlin.compose)
}
android {
@@ -47,6 +48,10 @@ android {
}
}
+ buildFeatures {
+ compose = true
+ }
+
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
@@ -58,10 +63,12 @@ android {
}
dependencies {
+ implementation(project(":design"))
+ implementation(platform(libs.androidx.compose.bom))
+ implementation(libs.androidx.compose.material3)
+ implementation(libs.androidx.compose.ui)
+ implementation(libs.androidx.activity.compose)
implementation(libs.androidx.core.ktx)
- implementation(libs.androidx.activity.ktx)
- implementation(libs.androidx.appcompat)
implementation(libs.androidx.lifecycle.runtime.ktx)
- implementation(libs.google.material)
implementation(libs.kotlinx.coroutines.android)
}
diff --git a/api-helper/app/src/main/java/uk/doughmination/devicereporter/MainActivity.kt b/api-helper/app/src/main/java/uk/doughmination/devicereporter/MainActivity.kt
index 878e10a..4efeee2 100644
--- a/api-helper/app/src/main/java/uk/doughmination/devicereporter/MainActivity.kt
+++ b/api-helper/app/src/main/java/uk/doughmination/devicereporter/MainActivity.kt
@@ -2,59 +2,99 @@ package uk.doughmination.devicereporter
import android.Manifest
import android.annotation.SuppressLint
+import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
-import android.content.res.ColorStateList
-import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.PowerManager
import android.provider.Settings
-import android.view.View
-import android.widget.Button
-import android.widget.EditText
-import android.widget.TextView
import android.widget.Toast
-import androidx.activity.SystemBarStyle
-import androidx.activity.enableEdgeToEdge
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
-import androidx.annotation.ColorRes
-import androidx.appcompat.app.AppCompatActivity
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.WindowInsets
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.imePadding
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.safeDrawing
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.layout.windowInsetsPadding
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.foundation.text.selection.SelectionContainer
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.Button
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedButton
+import androidx.compose.material3.OutlinedTextField
+import androidx.compose.material3.Switch
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.input.PasswordVisualTransformation
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
import androidx.core.content.ContextCompat
-import androidx.core.view.ViewCompat
-import androidx.core.view.WindowInsetsCompat
-import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
-import com.google.android.material.dialog.MaterialAlertDialogBuilder
-import com.google.android.material.materialswitch.MaterialSwitch
+import gay.doughmination.design.Backdrop
+import gay.doughmination.design.DoughminationTheme
+import gay.doughmination.design.Eyebrow
+import gay.doughmination.design.GlassSection
+import gay.doughmination.design.Line
+import gay.doughmination.design.Muted
+import gay.doughmination.design.Ok
+import gay.doughmination.design.Warn
+import gay.doughmination.design.enableDoughminationEdgeToEdge
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
-class MainActivity : AppCompatActivity() {
+class MainActivity : ComponentActivity() {
private lateinit var prefs: Prefs
- private lateinit var inputBaseUrl: EditText
- private lateinit var inputApiKey: EditText
- private lateinit var inputDevice: EditText
- private lateinit var switchWatch: MaterialSwitch
- private lateinit var switchAirpods: MaterialSwitch
- private lateinit var textAirpodsDevice: TextView
- private lateinit var textStatus: TextView
- private lateinit var textServiceState: TextView
- private lateinit var textBattery: TextView
- private lateinit var textLocation: TextView
- private lateinit var textAlarms: TextView
- private lateinit var btnBattery: Button
- private lateinit var btnLocation: Button
- private lateinit var btnAlarms: Button
- private lateinit var btnStart: Button
- private lateinit var btnStop: Button
+ // Screen state. Text fields and switches are saved on Save, Start and Send test.
+ private var baseUrl by mutableStateOf("")
+ private var apiKey by mutableStateOf("")
+ private var deviceName by mutableStateOf("")
+ private var watchConnected by mutableStateOf(false)
+ private var airpodsEnabled by mutableStateOf(false)
+ private var airpodsDevice by mutableStateOf("No device selected")
+ private var running by mutableStateOf(false)
+ private var lastReport by mutableStateOf("Nothing sent yet.")
+ private var batteryOk by mutableStateOf(true)
+ private var locationFine by mutableStateOf(true)
+ private var locationOk by mutableStateOf(true)
+ private var alarmsOk by mutableStateOf(true)
+ private var askBackgroundLocation by mutableStateOf<(() -> Unit)?>(null)
+ private var bluetoothChoices by mutableStateOf<List<Pair<String, BluetoothDevice>>?>(null)
// Background location has to be asked for on its own, after foreground location is
// granted, so the foreground request chains into it.
@@ -72,78 +112,18 @@ class MainActivity : AppCompatActivity() {
}
override fun onCreate(savedInstanceState: Bundle?) {
- enableEdgeToEdge(
- statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
- navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT)
- )
+ enableDoughminationEdgeToEdge()
super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
prefs = Prefs(this)
-
- // Edge-to-edge: keep content clear of the status bar, camera cutout, nav bar and keyboard.
- val content = findViewById<View>(R.id.content)
- val basePadTop = content.paddingTop
- val basePadBottom = content.paddingBottom
- val basePadStart = content.paddingStart
- val basePadEnd = content.paddingEnd
- ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.scroll)) { _, insets ->
- val bars = insets.getInsets(
- WindowInsetsCompat.Type.systemBars() or
- WindowInsetsCompat.Type.displayCutout() or
- WindowInsetsCompat.Type.ime()
- )
- content.updatePadding(
- left = basePadStart + bars.left,
- top = basePadTop + bars.top,
- right = basePadEnd + bars.right,
- bottom = basePadBottom + bars.bottom
- )
- insets
- }
-
- inputBaseUrl = findViewById(R.id.inputBaseUrl)
- inputApiKey = findViewById(R.id.inputApiKey)
- inputDevice = findViewById(R.id.inputDevice)
- switchWatch = findViewById(R.id.switchWatch)
- switchAirpods = findViewById(R.id.switchAirpods)
- textAirpodsDevice = findViewById(R.id.textAirpodsDevice)
- textStatus = findViewById(R.id.textStatus)
- textServiceState = findViewById(R.id.textServiceState)
- textBattery = findViewById(R.id.textBattery)
- textLocation = findViewById(R.id.textLocation)
- textAlarms = findViewById(R.id.textAlarms)
- btnBattery = findViewById(R.id.btnBattery)
- btnLocation = findViewById(R.id.btnLocation)
- btnAlarms = findViewById(R.id.btnAlarms)
- btnStart = findViewById(R.id.btnStart)
- btnStop = findViewById(R.id.btnStop)
-
- loadIntoViews()
-
- findViewById<Button>(R.id.btnSelectAirpods).setOnClickListener { pickAirpodsDevice() }
- findViewById<Button>(R.id.btnSave).setOnClickListener { saveFromViews(); toast("Saved") }
- btnStart.setOnClickListener {
- saveFromViews()
- if (!prefs.isConfigured()) {
- toast("Set a base URL and device name first")
- } else {
- requestRuntimePermissions()
- prefs.reportingEnabled = true
- ReporterService.start(this)
- // The service flips isRunning in onCreate, a moment after this returns.
- btnStart.post { refreshServiceState() }
+ loadFromPrefs()
+ setContent {
+ DoughminationTheme {
+ Box(Modifier.fillMaxSize()) {
+ Backdrop()
+ Screen()
+ }
}
}
- btnStop.setOnClickListener {
- prefs.reportingEnabled = false
- ReporterService.stop(this)
- refreshServiceState()
- }
- findViewById<Button>(R.id.btnTest).setOnClickListener { sendTestReport() }
- btnBattery.setOnClickListener { requestBatteryExemption() }
- btnLocation.setOnClickListener { requestLocation() }
- btnAlarms.setOnClickListener { requestExactAlarms() }
-
requestRuntimePermissions()
}
@@ -160,74 +140,257 @@ class MainActivity : AppCompatActivity() {
super.onPause()
}
- private fun loadIntoViews() {
- inputBaseUrl.setText(prefs.baseUrl)
- inputApiKey.setText(prefs.apiKey)
- inputDevice.setText(prefs.deviceName)
- switchWatch.isChecked = prefs.watchConnected
- switchAirpods.isChecked = prefs.airpodsEnabled
+ private fun loadFromPrefs() {
+ baseUrl = prefs.baseUrl
+ apiKey = prefs.apiKey
+ deviceName = prefs.deviceName
+ watchConnected = prefs.watchConnected
+ airpodsEnabled = prefs.airpodsEnabled
updateAirpodsLabel()
}
- private fun saveFromViews() {
- prefs.baseUrl = inputBaseUrl.text.toString().trim().ifBlank { Prefs.DEFAULT_BASE_URL }
- prefs.apiKey = inputApiKey.text.toString().trim()
- prefs.deviceName = inputDevice.text.toString().trim().ifBlank { Prefs.DEFAULT_DEVICE }
- prefs.watchConnected = switchWatch.isChecked
- prefs.airpodsEnabled = switchAirpods.isChecked
+ private fun save() {
+ prefs.baseUrl = baseUrl.trim().ifBlank { Prefs.DEFAULT_BASE_URL }
+ prefs.apiKey = apiKey.trim()
+ prefs.deviceName = deviceName.trim().ifBlank { Prefs.DEFAULT_DEVICE }
+ prefs.watchConnected = watchConnected
+ prefs.airpodsEnabled = airpodsEnabled
+ }
+
+ // --- screen ------------------------------------------------------------
+
+ @Composable
+ private fun Screen() {
+ Column(
+ Modifier
+ .fillMaxSize()
+ .verticalScroll(rememberScrollState())
+ .windowInsetsPadding(WindowInsets.safeDrawing)
+ .imePadding()
+ .padding(16.dp),
+ verticalArrangement = Arrangement.spacedBy(12.dp),
+ ) {
+ Column(Modifier.padding(vertical = 8.dp)) {
+ Text("DOUGHMINATION.UK", style = Eyebrow)
+ Text("Device Reporter", style = MaterialTheme.typography.headlineMedium)
+ Text("Tells your API how this phone is doing.", color = Muted, style = MaterialTheme.typography.bodyMedium)
+ Spacer(Modifier.size(8.dp))
+ StatusPill(if (running) "Reporting" else "Stopped", if (running) Ok else Muted)
+ }
+
+ GlassSection("Endpoint") {
+ Code("POST /v2/devices")
+ Hint("Only device is required; the API updates just the fields it receives. Your key goes in the X-Battery-Key header.")
+ }
+
+ GlassSection("Configuration") {
+ Field("Base URL", baseUrl, "https://doughmination.uk/v2", KeyboardType.Uri) { baseUrl = it }
+ Field("X-Battery-Key", apiKey, "your device key", KeyboardType.Password, secret = true) { apiKey = it }
+ Field("Device name", deviceName, "phone") { deviceName = it }
+ }
+
+ GlassSection("Peripherals") {
+ SwitchRow("Watch connected", watchConnected) { watchConnected = it }
+ Hint("Manual: an Apple Watch can't pair with Android, so flip this yourself.")
+ HorizontalDivider(color = Line)
+ SwitchRow("Report AirPods", airpodsEnabled) { airpodsEnabled = it }
+ Hint(airpodsDevice)
+ OutlinedButton(onClick = ::pickAirpodsDevice) { Text("Choose Bluetooth device") }
+ }
+
+ GlassSection("Background") {
+ PermissionRow(
+ "Battery: unrestricted", batteryOk,
+ ok = "Allowed",
+ missing = "One UI may stop the service while the screen's off",
+ onAllow = ::requestBatteryExemption,
+ )
+ PermissionRow(
+ "Location: all the time", locationOk,
+ ok = "Allowed",
+ missing = if (!locationFine) "Needed for the Wi-Fi name and location"
+ else "Only while open: background reports won't have Wi-Fi name or location",
+ onAllow = ::requestLocation,
+ )
+ PermissionRow(
+ "On-time heartbeat", alarmsOk,
+ ok = "Allowed: every 5 minutes, even asleep",
+ missing = "Without it, idle gaps can stretch to ~10 minutes",
+ onAllow = ::requestExactAlarms,
+ )
+ Hint("On Samsung, also keep this app off the sleeping lists: Settings › Battery › Background usage limits.")
+ }
+
+ if (running) {
+ OutlinedButton(onClick = ::stopReporting, modifier = Modifier.fillMaxWidth()) { Text("Stop reporting") }
+ } else {
+ Button(onClick = ::startReporting, modifier = Modifier.fillMaxWidth()) { Text("Start reporting") }
+ }
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ OutlinedButton(onClick = { save(); toast("Saved") }, modifier = Modifier.weight(1f)) { Text("Save") }
+ OutlinedButton(onClick = ::sendTestReport, modifier = Modifier.weight(1f)) { Text("Send test") }
+ }
+
+ GlassSection("Last report") {
+ SelectionContainer { Code(lastReport) }
+ }
+ }
+
+ askBackgroundLocation?.let { ask ->
+ AlertDialog(
+ onDismissRequest = { askBackgroundLocation = null },
+ title = { Text("Location all the time") },
+ text = {
+ Text(
+ "Reports sent while the app is closed need location to include your Wi-Fi name " +
+ "and city. On the next screen, choose \"Allow all the time\".",
+ )
+ },
+ confirmButton = { TextButton(onClick = { askBackgroundLocation = null; ask() }) { Text("Continue") } },
+ dismissButton = { TextButton(onClick = { askBackgroundLocation = null }) { Text("Not now") } },
+ )
+ }
+
+ bluetoothChoices?.let { choices ->
+ AlertDialog(
+ onDismissRequest = { bluetoothChoices = null },
+ title = { Text("Choose your AirPods") },
+ text = {
+ Column {
+ choices.forEach { (name, device) ->
+ Text(
+ name,
+ Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(8.dp))
+ .clickable { bluetoothChoices = null; chooseAirpods(name, device) }
+ .padding(vertical = 12.dp, horizontal = 4.dp),
+ style = MaterialTheme.typography.bodyLarge,
+ )
+ }
+ }
+ },
+ confirmButton = {},
+ dismissButton = { TextButton(onClick = { bluetoothChoices = null }) { Text("Cancel") } },
+ )
+ }
+ }
+
+ @Composable
+ private fun StatusPill(text: String, colour: Color) {
+ Row(
+ Modifier
+ .clip(RoundedCornerShape(50))
+ .background(colour.copy(alpha = 0.12f))
+ .padding(horizontal = 10.dp, vertical = 4.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Box(Modifier.size(8.dp).clip(CircleShape).background(colour))
+ Spacer(Modifier.width(6.dp))
+ Text(text, color = colour, style = MaterialTheme.typography.labelLarge)
+ }
+ }
+
+ @Composable
+ private fun Code(text: String) {
+ Text(
+ text,
+ Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(10.dp))
+ .background(Color.Black.copy(alpha = 0.25f))
+ .padding(10.dp),
+ fontFamily = FontFamily.Monospace,
+ fontSize = 13.sp,
+ )
+ }
+
+ @Composable
+ private fun Hint(text: String, colour: Color = Muted) =
+ Text(text, color = colour, style = MaterialTheme.typography.bodySmall)
+
+ @Composable
+ private fun Field(
+ label: String,
+ value: String,
+ placeholder: String,
+ type: KeyboardType = KeyboardType.Text,
+ secret: Boolean = false,
+ onChange: (String) -> Unit,
+ ) {
+ OutlinedTextField(
+ value = value,
+ onValueChange = onChange,
+ label = { Text(label) },
+ placeholder = { Text(placeholder) },
+ singleLine = true,
+ keyboardOptions = KeyboardOptions(keyboardType = type),
+ visualTransformation = if (secret) PasswordVisualTransformation() else androidx.compose.ui.text.input.VisualTransformation.None,
+ modifier = Modifier.fillMaxWidth(),
+ )
+ }
+
+ @Composable
+ private fun SwitchRow(label: String, checked: Boolean, onChange: (Boolean) -> Unit) {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text(label, Modifier.weight(1f), style = MaterialTheme.typography.bodyLarge)
+ Switch(checked = checked, onCheckedChange = onChange)
+ }
+ }
+
+ @Composable
+ private fun PermissionRow(label: String, granted: Boolean, ok: String, missing: String, onAllow: () -> Unit) {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Column(Modifier.weight(1f)) {
+ Text(label, style = MaterialTheme.typography.bodyLarge)
+ Hint(if (granted) ok else missing, if (granted) Ok else Warn)
+ }
+ if (!granted) {
+ Spacer(Modifier.width(8.dp))
+ OutlinedButton(onClick = onAllow) { Text("Allow") }
+ }
+ }
}
// --- status ------------------------------------------------------------
+ private fun startReporting() {
+ save()
+ if (!prefs.isConfigured()) {
+ toast("Set a base URL and device name first")
+ return
+ }
+ requestRuntimePermissions()
+ prefs.reportingEnabled = true
+ ReporterService.start(this)
+ // The service flips isRunning in onCreate, a moment after this returns.
+ window.decorView.post { refreshServiceState() }
+ }
+
+ private fun stopReporting() {
+ prefs.reportingEnabled = false
+ ReporterService.stop(this)
+ refreshServiceState()
+ }
+
private fun refreshServiceState() {
- val running = ReporterService.isRunning
- btnStart.visibility = if (running) View.GONE else View.VISIBLE
- btnStop.visibility = if (running) View.VISIBLE else View.GONE
- setPill(textServiceState, if (running) "Reporting" else "Stopped", if (running) R.color.ok else R.color.muted)
+ running = ReporterService.isRunning
}
private fun showLastReport() {
val last = prefs.lastReport
- if (last.isNotBlank()) textStatus.text = last
- }
-
- private fun setPill(view: TextView, text: String, @ColorRes color: Int) {
- val c = ContextCompat.getColor(this, color)
- view.text = text
- view.setTextColor(c)
- view.compoundDrawablesRelative[0]?.setTint(c)
+ if (last.isNotBlank()) lastReport = last
}
/** One UI needs all three of these for the service to keep running and report on time. */
private fun refreshBackgroundRows() {
val pm = getSystemService(PowerManager::class.java)
- val unrestricted = pm.isIgnoringBatteryOptimizations(packageName)
- setRow(
- textBattery, btnBattery, unrestricted,
- ok = "Allowed",
- missing = "One UI may stop the service while the screen's off"
- )
-
- val fine = has(Manifest.permission.ACCESS_FINE_LOCATION)
+ batteryOk = pm.isIgnoringBatteryOptimizations(packageName)
+ locationFine = has(Manifest.permission.ACCESS_FINE_LOCATION)
val background = Build.VERSION.SDK_INT < Build.VERSION_CODES.Q ||
has(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
- setRow(
- textLocation, btnLocation, fine && background,
- ok = "Allowed",
- missing = if (!fine) "Needed for the Wi-Fi name and location" else "Only while open: background reports won't have Wi-Fi name or location"
- )
-
- setRow(
- textAlarms, btnAlarms, ReporterService.canScheduleExact(this),
- ok = "Allowed: every 5 minutes, even asleep",
- missing = "Without it, idle gaps can stretch to ~10 minutes"
- )
- }
-
- private fun setRow(hint: TextView, button: Button, granted: Boolean, ok: String, missing: String) {
- hint.text = if (granted) ok else missing
- hint.setTextColor(ContextCompat.getColor(this, if (granted) R.color.ok else R.color.warn))
- button.visibility = if (granted) View.GONE else View.VISIBLE
+ locationOk = locationFine && background
+ alarmsOk = ReporterService.canScheduleExact(this)
}
// --- permissions -------------------------------------------------------
@@ -256,7 +419,7 @@ class MainActivity : AppCompatActivity() {
private fun requestLocation() {
when {
!has(Manifest.permission.ACCESS_FINE_LOCATION) -> permissionLauncher.launch(
- arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION)
+ arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION),
)
else -> requestBackgroundLocation(explain = true)
}
@@ -269,22 +432,13 @@ class MainActivity : AppCompatActivity() {
private fun requestBackgroundLocation(explain: Boolean = false) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return
if (has(Manifest.permission.ACCESS_BACKGROUND_LOCATION)) return
- val ask = {
+ askBackgroundLocation = {
if (shouldShowRequestPermissionRationale(Manifest.permission.ACCESS_BACKGROUND_LOCATION) || !explain) {
backgroundLocationLauncher.launch(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
} else {
openAppSettings()
}
}
- MaterialAlertDialogBuilder(this)
- .setTitle("Location all the time")
- .setMessage(
- "Reports sent while the app is closed need location to include your Wi-Fi name " +
- "and city. On the next screen, choose \"Allow all the time\"."
- )
- .setPositiveButton("Continue") { _, _ -> ask() }
- .setNegativeButton("Not now", null)
- .show()
}
private fun requestBatteryExemption() {
@@ -302,14 +456,14 @@ class MainActivity : AppCompatActivity() {
private fun openAppSettings() {
startActivity(
- Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.parse("package:$packageName"))
+ Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.parse("package:$packageName")),
)
}
// --- airpods -----------------------------------------------------------
private fun updateAirpodsLabel() {
- textAirpodsDevice.text = if (prefs.airpodsAddress.isNotBlank()) {
+ airpodsDevice = if (prefs.airpodsAddress.isNotBlank()) {
"${prefs.airpodsLabel} · ${prefs.airpodsAddress}"
} else {
"No device selected"
@@ -343,38 +497,33 @@ class MainActivity : AppCompatActivity() {
toast("No paired Bluetooth devices found")
return
}
+ bluetoothChoices = bonded.map { (runCatching { it.name }.getOrNull() ?: it.address) to it }
+ }
- val names = bonded.map { runCatching { it.name }.getOrNull() ?: it.address }.toTypedArray()
- MaterialAlertDialogBuilder(this)
- .setTitle("Choose your AirPods")
- .setItems(names) { _, which ->
- val chosen = bonded[which]
- prefs.airpodsAddress = chosen.address
- prefs.airpodsLabel = names[which]
- prefs.airpodsEnabled = true
- switchAirpods.isChecked = true
- updateAirpodsLabel()
- toast("Saved: ${names[which]}")
- }
- .setNegativeButton("Cancel", null)
- .show()
+ private fun chooseAirpods(name: String, device: BluetoothDevice) {
+ prefs.airpodsAddress = device.address
+ prefs.airpodsLabel = name
+ prefs.airpodsEnabled = true
+ airpodsEnabled = true
+ updateAirpodsLabel()
+ toast("Saved: $name")
}
// --- test --------------------------------------------------------------
private fun sendTestReport() {
- saveFromViews()
+ save()
if (!prefs.isConfigured()) {
toast("Set a base URL and device name first")
return
}
- textStatus.text = "Sending test report…"
+ lastReport = "Sending test report…"
lifecycleScope.launch {
val (url, result) = withContext(Dispatchers.IO) {
val snap = DeviceState.snapshot(this@MainActivity, prefs, includeLocation = true)
Reporter.buildUrl(prefs, snap) to Reporter.report(prefs, snap)
}
- textStatus.text = buildString {
+ lastReport = buildString {
append(if (result.ok) "Test OK\n" else "Test FAILED: ${result.message}\n")
append("\nRequest:\n$url")
}
diff --git a/api-helper/app/src/main/res/color/switch_thumb.xml b/api-helper/app/src/main/res/color/switch_thumb.xml
deleted file mode 100644
index e25f2b9..0000000
--- a/api-helper/app/src/main/res/color/switch_thumb.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@color/on_accent" android:state_checked="true" />
- <item android:color="@color/muted" />
-</selector>
diff --git a/api-helper/app/src/main/res/color/switch_track.xml b/api-helper/app/src/main/res/color/switch_track.xml
deleted file mode 100644
index f4860aa..0000000
--- a/api-helper/app/src/main/res/color/switch_track.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@color/accent" android:state_checked="true" />
- <item android:color="@color/field" />
-</selector>
diff --git a/api-helper/app/src/main/res/color/switch_track_outline.xml b/api-helper/app/src/main/res/color/switch_track_outline.xml
deleted file mode 100644
index 4f02a36..0000000
--- a/api-helper/app/src/main/res/color/switch_track_outline.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="@color/accent" android:state_checked="true" />
- <item android:color="@color/line" />
-</selector>
diff --git a/api-helper/app/src/main/res/drawable/bg_card.xml b/api-helper/app/src/main/res/drawable/bg_card.xml
deleted file mode 100644
index 6cdd606..0000000
--- a/api-helper/app/src/main/res/drawable/bg_card.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
- <solid android:color="@color/raised" />
- <stroke android:width="1dp" android:color="@color/line" />
- <corners android:radius="16dp" />
-</shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_code.xml b/api-helper/app/src/main/res/drawable/bg_code.xml
deleted file mode 100644
index eb69534..0000000
--- a/api-helper/app/src/main/res/drawable/bg_code.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
- <solid android:color="@color/field" />
- <stroke android:width="1dp" android:color="@color/line" />
- <corners android:radius="12dp" />
-</shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_input.xml b/api-helper/app/src/main/res/drawable/bg_input.xml
deleted file mode 100644
index ee5ab41..0000000
--- a/api-helper/app/src/main/res/drawable/bg_input.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_focused="true">
- <shape android:shape="rectangle">
- <solid android:color="@color/field" />
- <stroke android:width="1dp" android:color="@color/accent" />
- <corners android:radius="12dp" />
- </shape>
- </item>
- <item>
- <shape android:shape="rectangle">
- <solid android:color="@color/field" />
- <stroke android:width="1dp" android:color="@color/line" />
- <corners android:radius="12dp" />
- </shape>
- </item>
-</selector>
diff --git a/api-helper/app/src/main/res/drawable/bg_pill.xml b/api-helper/app/src/main/res/drawable/bg_pill.xml
deleted file mode 100644
index 23ab35b..0000000
--- a/api-helper/app/src/main/res/drawable/bg_pill.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Status pill; MainActivity tints it ok / warn / bad. -->
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
- <solid android:color="#1fffffff" />
- <corners android:radius="999dp" />
-</shape>
diff --git a/api-helper/app/src/main/res/drawable/dot.xml b/api-helper/app/src/main/res/drawable/dot.xml
deleted file mode 100644
index 5612bc7..0000000
--- a/api-helper/app/src/main/res/drawable/dot.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
- <solid android:color="@android:color/white" />
- <size android:width="8dp" android:height="8dp" />
-</shape>
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans.xml b/api-helper/app/src/main/res/font/ibm_plex_sans.xml
deleted file mode 100644
index 3d240ea..0000000
--- a/api-helper/app/src/main/res/font/ibm_plex_sans.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- IBM Plex Sans, the same cut doughmination.gay serves (SIL OFL 1.1). -->
-<font-family xmlns:android="http://schemas.android.com/apk/res/android">
- <font android:font="@font/ibm_plex_sans_regular" android:fontStyle="normal" android:fontWeight="400" />
- <font android:font="@font/ibm_plex_sans_medium" android:fontStyle="normal" android:fontWeight="500" />
- <font android:font="@font/ibm_plex_sans_semibold" android:fontStyle="normal" android:fontWeight="600" />
- <font android:font="@font/ibm_plex_sans_bold" android:fontStyle="normal" android:fontWeight="700" />
-</font-family>
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans_bold.ttf b/api-helper/app/src/main/res/font/ibm_plex_sans_bold.ttf
deleted file mode 100644
index 7f2c4d5..0000000
Binary files a/api-helper/app/src/main/res/font/ibm_plex_sans_bold.ttf and /dev/null differ
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans_medium.ttf b/api-helper/app/src/main/res/font/ibm_plex_sans_medium.ttf
deleted file mode 100644
index 4e82959..0000000
Binary files a/api-helper/app/src/main/res/font/ibm_plex_sans_medium.ttf and /dev/null differ
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans_regular.ttf b/api-helper/app/src/main/res/font/ibm_plex_sans_regular.ttf
deleted file mode 100644
index 6df0ff4..0000000
Binary files a/api-helper/app/src/main/res/font/ibm_plex_sans_regular.ttf and /dev/null differ
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans_semibold.ttf b/api-helper/app/src/main/res/font/ibm_plex_sans_semibold.ttf
deleted file mode 100644
index 2346904..0000000
Binary files a/api-helper/app/src/main/res/font/ibm_plex_sans_semibold.ttf and /dev/null differ
diff --git a/api-helper/app/src/main/res/layout/activity_main.xml b/api-helper/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 5c4b3c8..0000000
--- a/api-helper/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,337 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:id="@+id/scroll"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipToPadding="false"
- android:fillViewport="true">
-
- <LinearLayout
- android:id="@+id/content"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingHorizontal="20dp"
- android:paddingTop="24dp"
- android:paddingBottom="32dp">
-
- <!-- Hero, after web's .eyebrow / h1 / .subtitle -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="doughmination.uk"
- android:textAllCaps="true"
- android:textColor="@color/accent"
- android:textSize="12sp"
- android:textStyle="bold"
- android:letterSpacing="0.14" />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="4dp"
- android:text="Device Reporter"
- android:textColor="@color/text"
- android:textSize="34sp"
- android:textStyle="bold"
- android:letterSpacing="-0.03" />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="2dp"
- android:text="Tells your API how this phone is doing."
- android:textColor="@color/muted"
- android:textSize="16sp" />
-
- <TextView
- android:id="@+id/textServiceState"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="14dp"
- android:background="@drawable/bg_pill"
- app:drawableStartCompat="@drawable/dot"
- android:drawablePadding="8dp"
- android:gravity="center_vertical"
- android:paddingHorizontal="12dp"
- android:paddingVertical="5dp"
- android:text="Stopped"
- android:textColor="@color/muted"
- android:textSize="13sp"
- android:fontFamily="@font/ibm_plex_sans_medium" />
-
- <!-- Endpoint -->
- <LinearLayout
- style="@style/Panel"
- android:layout_marginTop="24dp">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:fontFamily="monospace"
- android:text="POST /v2/devices"
- android:textColor="@color/text"
- android:textSize="14sp"
- android:textStyle="bold" />
-
- <TextView
- style="@style/RowHint"
- android:layout_marginTop="6dp"
- android:text="Only device is required; the API updates just the fields it receives. Your key goes in the X-Battery-Key header." />
- </LinearLayout>
-
- <!-- Configuration -->
- <TextView style="@style/Eyebrow" android:text="Configuration" />
-
- <LinearLayout style="@style/Panel" android:paddingTop="4dp">
-
- <TextView style="@style/FieldLabel" android:text="Base URL" />
-
- <EditText
- android:id="@+id/inputBaseUrl"
- style="@style/FieldInput"
- android:hint="https://doughmination.uk/v2"
- android:inputType="textUri" />
-
- <TextView style="@style/FieldLabel" android:text="X-Battery-Key" />
-
- <EditText
- android:id="@+id/inputApiKey"
- style="@style/FieldInput"
- android:hint="your device key"
- android:inputType="textPassword" />
-
- <TextView style="@style/FieldLabel" android:text="Device name" />
-
- <EditText
- android:id="@+id/inputDevice"
- style="@style/FieldInput"
- android:hint="phone"
- android:inputType="text" />
- </LinearLayout>
-
- <!-- Peripherals -->
- <TextView style="@style/Eyebrow" android:text="Peripherals" />
-
- <LinearLayout style="@style/Panel">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:minHeight="48dp"
- android:orientation="horizontal">
-
- <TextView style="@style/RowLabel" android:text="Watch connected" />
-
- <com.google.android.material.materialswitch.MaterialSwitch
- android:id="@+id/switchWatch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </LinearLayout>
-
- <TextView
- style="@style/RowHint"
- android:text="Manual: an Apple Watch can't pair with Android, so flip this yourself." />
-
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:layout_marginVertical="14dp"
- android:background="@color/line" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:minHeight="48dp"
- android:orientation="horizontal">
-
- <TextView style="@style/RowLabel" android:text="Report AirPods" />
-
- <com.google.android.material.materialswitch.MaterialSwitch
- android:id="@+id/switchAirpods"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </LinearLayout>
-
- <TextView
- android:id="@+id/textAirpodsDevice"
- style="@style/RowHint"
- android:text="No device selected" />
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btnSelectAirpods"
- style="@style/Button.Small"
- android:layout_marginTop="10dp"
- android:text="Choose Bluetooth device" />
- </LinearLayout>
-
- <!-- Background: what One UI needs to leave the service alone -->
- <TextView style="@style/Eyebrow" android:text="Background" />
-
- <LinearLayout style="@style/Panel">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:minHeight="48dp"
- android:orientation="horizontal">
-
- <LinearLayout
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Battery: unrestricted"
- android:textColor="@color/text"
- android:textSize="15sp" />
-
- <TextView
- android:id="@+id/textBattery"
- style="@style/RowHint"
- android:text="Checking…" />
- </LinearLayout>
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btnBattery"
- style="@style/Button.Small"
- android:layout_marginStart="12dp"
- android:text="Allow" />
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:gravity="center_vertical"
- android:minHeight="48dp"
- android:orientation="horizontal">
-
- <LinearLayout
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Location: all the time"
- android:textColor="@color/text"
- android:textSize="15sp" />
-
- <TextView
- android:id="@+id/textLocation"
- style="@style/RowHint"
- android:text="Checking…" />
- </LinearLayout>
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btnLocation"
- style="@style/Button.Small"
- android:layout_marginStart="12dp"
- android:text="Allow" />
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:gravity="center_vertical"
- android:minHeight="48dp"
- android:orientation="horizontal">
-
- <LinearLayout
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="vertical">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="On-time heartbeat"
- android:textColor="@color/text"
- android:textSize="15sp" />
-
- <TextView
- android:id="@+id/textAlarms"
- style="@style/RowHint"
- android:text="Checking…" />
- </LinearLayout>
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btnAlarms"
- style="@style/Button.Small"
- android:layout_marginStart="12dp"
- android:text="Allow" />
- </LinearLayout>
-
- <TextView
- style="@style/RowHint"
- android:layout_marginTop="14dp"
- android:text="On Samsung, also keep this app off the sleeping lists: Settings › Battery › Background usage limits." />
- </LinearLayout>
-
- <!-- Actions -->
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btnStart"
- style="@style/Button.Primary"
- android:layout_marginTop="28dp"
- android:text="Start reporting" />
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btnStop"
- style="@style/Button.Danger"
- android:layout_marginTop="28dp"
- android:text="Stop reporting"
- android:visibility="gone" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="8dp"
- android:baselineAligned="false"
- android:orientation="horizontal">
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btnSave"
- style="@style/Button.Raised"
- android:layout_width="0dp"
- android:layout_marginEnd="4dp"
- android:layout_weight="1"
- android:text="Save" />
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/btnTest"
- style="@style/Button.Raised"
- android:layout_width="0dp"
- android:layout_marginStart="4dp"
- android:layout_weight="1"
- android:text="Send test" />
- </LinearLayout>
-
- <!-- Status -->
- <TextView style="@style/Eyebrow" android:text="Last report" />
-
- <TextView
- android:id="@+id/textStatus"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/bg_code"
- android:fontFamily="monospace"
- android:padding="14dp"
- android:text="Nothing sent yet."
- android:textColor="@color/lede"
- android:textIsSelectable="true"
- android:textSize="12sp" />
-
- </LinearLayout>
-</ScrollView>
diff --git a/api-helper/app/src/main/res/values/colors.xml b/api-helper/app/src/main/res/values/colors.xml
index 4b1d691..f6eb350 100644
--- a/api-helper/app/src/main/res/values/colors.xml
+++ b/api-helper/app/src/main/res/values/colors.xml
@@ -1,19 +1,5 @@
<resources>
- <!-- doughmination.gay tokens, mirrored from web's theme.css (and pastebin/reviewer's app extras). -->
- <color name="bg">#0b0a0d</color>
- <color name="raised">#09ffffff</color> <!-- rgb(255 255 255 / 3.5%) -->
- <color name="line">#17ffffff</color> <!-- rgb(255 255 255 / 9%) -->
- <color name="field">#40000000</color> <!-- rgb(0 0 0 / 25%) -->
- <color name="text">#ece9ef</color>
- <color name="lede">#cfc9d6</color>
- <color name="muted">#a49eab</color>
- <color name="accent">#eb459e</color>
- <color name="accent_dim">#24eb459e</color> <!-- rgb(235 69 158 / 14%) -->
- <color name="on_accent">#1a0611</color>
-
- <color name="ok">#7fd98b</color>
- <color name="warn">#f2c46d</color>
- <color name="bad">#ff8a9a</color>
-
+ <!-- The notification's accent: the shared Doughmination pink. -->
+ <color name="accent">#EB459E</color>
<color name="ic_launcher_background">#0b0a0d</color>
</resources>
diff --git a/api-helper/app/src/main/res/values/styles.xml b/api-helper/app/src/main/res/values/styles.xml
deleted file mode 100644
index 1544f02..0000000
--- a/api-helper/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<resources>
-
- <!-- web's .eyebrow: small, accent, tracked-out caps -->
- <style name="Eyebrow">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:layout_marginTop">28dp</item>
- <item name="android:layout_marginBottom">10dp</item>
- <item name="android:textColor">@color/accent</item>
- <item name="android:textSize">12sp</item>
- <item name="android:textStyle">bold</item>
- <item name="android:textAllCaps">true</item>
- <item name="android:letterSpacing">0.14</item>
- </style>
-
- <!-- pastebin's .panel: raised surface, hairline, 1rem corners -->
- <style name="Panel">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:orientation">vertical</item>
- <item name="android:background">@drawable/bg_card</item>
- <item name="android:paddingHorizontal">20dp</item>
- <item name="android:paddingVertical">16dp</item>
- </style>
-
- <style name="FieldLabel">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:layout_marginTop">12dp</item>
- <item name="android:layout_marginBottom">6dp</item>
- <item name="android:textColor">@color/muted</item>
- <item name="android:textSize">13sp</item>
- <item name="android:fontFamily">@font/ibm_plex_sans_medium</item>
- </style>
-
- <style name="FieldInput">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:minHeight">48dp</item>
- <item name="android:background">@drawable/bg_input</item>
- <item name="android:paddingHorizontal">14dp</item>
- <item name="android:paddingVertical">10dp</item>
- <item name="android:textColor">@color/text</item>
- <item name="android:textColorHint">@color/muted</item>
- <item name="android:textSize">15sp</item>
- <item name="android:fontFamily">@font/ibm_plex_sans</item>
- <item name="android:importantForAutofill">no</item>
- <item name="android:singleLine">true</item>
- </style>
-
- <style name="RowLabel">
- <item name="android:layout_width">0dp</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:layout_weight">1</item>
- <item name="android:textColor">@color/text</item>
- <item name="android:textSize">15sp</item>
- </style>
-
- <style name="RowHint">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:textColor">@color/muted</item>
- <item name="android:textSize">13sp</item>
- </style>
-
- <!-- pastebin's button.primary -->
- <style name="Button.Primary" parent="Widget.Material3.Button">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:minHeight">52dp</item>
- <item name="android:textAllCaps">false</item>
- <item name="android:textSize">15sp</item>
- <item name="android:fontFamily">@font/ibm_plex_sans_semibold</item>
- <item name="android:textColor">@color/on_accent</item>
- <item name="backgroundTint">@color/accent</item>
- <item name="cornerRadius">12dp</item>
- </style>
-
- <!-- pastebin's plain button: raised surface + hairline, accent ring on press -->
- <style name="Button.Raised" parent="Widget.Material3.Button.OutlinedButton">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:minHeight">52dp</item>
- <item name="android:textAllCaps">false</item>
- <item name="android:textSize">15sp</item>
- <item name="android:textColor">@color/text</item>
- <item name="backgroundTint">@color/raised</item>
- <item name="strokeColor">@color/line</item>
- <item name="rippleColor">@color/accent_dim</item>
- <item name="cornerRadius">12dp</item>
- </style>
-
- <style name="Button.Danger" parent="Button.Raised">
- <item name="android:textColor">@color/bad</item>
- </style>
-
- <style name="Button.Small" parent="Button.Raised">
- <item name="android:layout_width">wrap_content</item>
- <item name="android:minHeight">40dp</item>
- <item name="android:textSize">13sp</item>
- <item name="android:paddingHorizontal">14dp</item>
- </style>
-
- <style name="Switch" parent="Widget.Material3.CompoundButton.MaterialSwitch">
- <item name="thumbTint">@color/switch_thumb</item>
- <item name="trackTint">@color/switch_track</item>
- <item name="trackDecorationTint">@color/switch_track_outline</item>
- </style>
-
-</resources>
diff --git a/api-helper/app/src/main/res/values/themes.xml b/api-helper/app/src/main/res/values/themes.xml
index 933afd2..6e1804b 100644
--- a/api-helper/app/src/main/res/values/themes.xml
+++ b/api-helper/app/src/main/res/values/themes.xml
@@ -1,32 +1,4 @@
<resources>
- <!-- Edge-to-edge is set up in MainActivity; the system bars are transparent over @color/bg. -->
- <style name="Theme.DeviceReporter" parent="Theme.Material3.Dark.NoActionBar">
- <item name="android:windowBackground">@color/bg</item>
- <item name="colorPrimary">@color/accent</item>
- <item name="colorOnPrimary">@color/on_accent</item>
- <item name="colorPrimaryContainer">@color/accent_dim</item>
- <item name="colorOnPrimaryContainer">@color/text</item>
- <item name="colorSecondary">@color/accent</item>
- <item name="colorOnSecondary">@color/on_accent</item>
- <item name="colorSurface">@color/bg</item>
- <item name="colorOnSurface">@color/text</item>
- <item name="colorOnSurfaceVariant">@color/muted</item>
- <item name="colorOutline">@color/line</item>
- <item name="colorError">@color/bad</item>
- <item name="android:textColorPrimary">@color/text</item>
- <item name="android:textColorSecondary">@color/muted</item>
- <item name="android:textColorHint">@color/muted</item>
- <item name="android:fontFamily">@font/ibm_plex_sans</item>
- <item name="fontFamily">@font/ibm_plex_sans</item>
- <item name="materialSwitchStyle">@style/Switch</item>
- <item name="alertDialogTheme">@style/Dialog</item>
- <item name="materialAlertDialogTheme">@style/Dialog</item>
- </style>
-
- <style name="Dialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
- <item name="colorSurface">#17151b</item>
- <item name="colorSurfaceContainerHigh">#17151b</item>
- <item name="colorPrimary">@color/accent</item>
- <item name="android:fontFamily">@font/ibm_plex_sans</item>
- </style>
+ <!-- The shared window theme (the :design module); Compose draws the rest. -->
+ <style name="Theme.DeviceReporter" parent="Theme.Doughmination" />
</resources>
diff --git a/build.gradle.kts b/build.gradle.kts
index ee3c061..55e0862 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -2,6 +2,7 @@
// applies the ones it needs in its own build.gradle.kts.
plugins {
alias(libs.plugins.android.application) apply false
+ alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.kotlin.serialization) apply false
diff --git a/design/build.gradle.kts b/design/build.gradle.kts
new file mode 100644
index 0000000..8bea12d
--- /dev/null
+++ b/design/build.gradle.kts
@@ -0,0 +1,37 @@
+// The Doughmination look, shared by every app: Inbox's theme (palette, IBM
+// Plex, the wallpaper backdrop, glass cards). Apps depend on this module and
+// nothing else in the repo.
+plugins {
+ alias(libs.plugins.android.library)
+ alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.kotlin.compose)
+}
+
+android {
+ namespace = "gay.doughmination.design"
+ compileSdk = libs.versions.compileSdk.get().toInt()
+
+ defaultConfig {
+ minSdk = libs.versions.minSdk.get().toInt()
+ }
+
+ buildFeatures {
+ compose = true
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+
+ kotlinOptions {
+ jvmTarget = "17"
+ }
+}
+
+dependencies {
+ api(platform(libs.androidx.compose.bom))
+ api(libs.androidx.compose.material3)
+ api(libs.androidx.compose.ui)
+ implementation(libs.androidx.activity.compose)
+}
diff --git a/design/src/main/java/gay/doughmination/design/Theme.kt b/design/src/main/java/gay/doughmination/design/Theme.kt
new file mode 100644
index 0000000..ff6d8f1
--- /dev/null
+++ b/design/src/main/java/gay/doughmination/design/Theme.kt
@@ -0,0 +1,218 @@
+package gay.doughmination.design
+
+import android.graphics.Color as AndroidColor
+import androidx.activity.ComponentActivity
+import androidx.activity.SystemBarStyle
+import androidx.activity.enableEdgeToEdge
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ColumnScope
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.Icon
+import androidx.compose.material3.LocalContentColor
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.material3.Typography
+import androidx.compose.material3.darkColorScheme
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.draw.drawBehind
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.Font
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+
+// The Doughmination palette, as Inbox and the websites use it
+// (email/src/web/app.css, doughmination.gay).
+val Accent = Color(0xFFEB459E)
+val Danger = Color(0xFFFF5C7A)
+val Muted = Color(0xFFA49EAB)
+val Bg = Color(0xFF0B0A0D)
+val TextColour = Color(0xFFECE9EF)
+/** Success and caution, for status dots and banners. */
+val Ok = Color(0xFF7FD98B)
+val Warn = Color(0xFFF2C46D)
+/** A card on the backdrop, like --raised on the web. */
+val Raised = Color.White.copy(alpha = 0.05f)
+/** Hairline borders, like --line on the web. */
+val Line = Color.White.copy(alpha = 0.09f)
+/** Selected chips and tabs: the accent, faint. */
+val AccentDim = Accent.copy(alpha = 0.14f)
+val AccentLine = Accent.copy(alpha = 0.4f)
+
+/** IBM Plex Sans, as on the web and doughmination.gay (the same files, as TTF). */
+val PlexSans = FontFamily(
+ Font(R.font.ibm_plex_sans_regular, FontWeight.Normal),
+ Font(R.font.ibm_plex_sans_medium, FontWeight.Medium),
+ Font(R.font.ibm_plex_sans_semibold, FontWeight.SemiBold),
+ Font(R.font.ibm_plex_sans_bold, FontWeight.Bold),
+)
+
+private fun TextStyle.plex() = copy(fontFamily = PlexSans)
+
+private val typography = Typography().run {
+ Typography(
+ displayLarge = displayLarge.plex(),
+ displayMedium = displayMedium.plex(),
+ displaySmall = displaySmall.plex(),
+ headlineLarge = headlineLarge.plex(),
+ headlineMedium = headlineMedium.plex(),
+ headlineSmall = headlineSmall.plex(),
+ titleLarge = titleLarge.plex(),
+ titleMedium = titleMedium.plex(),
+ titleSmall = titleSmall.plex(),
+ bodyLarge = bodyLarge.plex(),
+ bodyMedium = bodyMedium.plex(),
+ bodySmall = bodySmall.plex(),
+ labelLarge = labelLarge.plex(),
+ labelMedium = labelMedium.plex(),
+ labelSmall = labelSmall.plex(),
+ )
+}
+
+/** The web's small uppercase accent label (.eyebrow), used for headings. Pass it uppercase text. */
+val Eyebrow = TextStyle(
+ fontFamily = PlexSans,
+ fontSize = 11.sp,
+ fontWeight = FontWeight.SemiBold,
+ letterSpacing = 1.5.sp,
+ color = Accent,
+)
+
+private val colors = darkColorScheme(
+ primary = Accent,
+ onPrimary = Color.White,
+ primaryContainer = Color(0xFF3A1A2C),
+ onPrimaryContainer = Color(0xFFFFD8EA),
+ secondaryContainer = Color(0xFF2A1A24),
+ onSecondaryContainer = Color(0xFFFFD8EA),
+ // Screens and app bars sit on the Backdrop, so these are see-through.
+ // Sheets, menus and dialogs use the surfaceContainer colours and stay opaque.
+ background = Color.Transparent,
+ onBackground = TextColour,
+ surface = Color.Transparent,
+ onSurface = TextColour,
+ surfaceVariant = Color(0xFF1C1A20),
+ onSurfaceVariant = Muted,
+ surfaceContainerLowest = Bg,
+ surfaceContainerLow = Color(0xFF131116),
+ surfaceContainer = Color(0xFF17151B),
+ surfaceContainerHigh = Color(0xFF1E1B22),
+ surfaceContainerHighest = Color(0xFF26222B),
+ outline = Color(0xFF3A3640),
+ outlineVariant = Color(0xFF26222B),
+ error = Danger,
+)
+
+/**
+ * Every app's Compose theme. Put a [Backdrop] behind the screens.
+ *
+ * Surfaces are see-through, so content outside a Scaffold or Surface would
+ * otherwise get Compose's default text colour, black. Light text is the
+ * default everywhere instead.
+ */
+@Composable
+fun DoughminationTheme(content: @Composable () -> Unit) =
+ MaterialTheme(colorScheme = colors, typography = typography) {
+ CompositionLocalProvider(LocalContentColor provides TextColour, content = content)
+ }
+
+/**
+ * Edge to edge with light system-bar icons. The apps are always dark, so the
+ * icons must not follow the phone's light/dark setting. Call before super.onCreate.
+ */
+fun ComponentActivity.enableDoughminationEdgeToEdge() = enableEdgeToEdge(
+ statusBarStyle = SystemBarStyle.dark(AndroidColor.TRANSPARENT),
+ navigationBarStyle = SystemBarStyle.dark(AndroidColor.TRANSPARENT),
+)
+
+/**
+ * The site's wallpaper behind every screen, dimmed the way the web does it:
+ * the art at half strength under a dark wash and a soft pink glow.
+ */
+@Composable
+fun Backdrop(modifier: Modifier = Modifier) {
+ Box(modifier.fillMaxSize().background(Bg)) {
+ Image(
+ painterResource(R.drawable.background),
+ contentDescription = null,
+ contentScale = ContentScale.Crop,
+ alpha = 0.5f,
+ modifier = Modifier.fillMaxSize(),
+ )
+ Box(
+ Modifier.fillMaxSize().background(
+ Brush.verticalGradient(
+ 0f to Bg.copy(alpha = 0.55f),
+ 0.55f to Bg.copy(alpha = 0.8f),
+ 1f to Bg,
+ ),
+ ),
+ )
+ Box(
+ Modifier.fillMaxSize().drawBehind {
+ drawRect(
+ Brush.radialGradient(
+ listOf(Accent.copy(alpha = 0.12f), Color.Transparent),
+ center = Offset(size.width * 0.2f, size.height * 0.3f),
+ radius = size.maxDimension * 0.6f,
+ ),
+ )
+ },
+ )
+ }
+}
+
+val SectionShape = RoundedCornerShape(16.dp)
+
+/** A card like the web's sections (Inbox's settings): dark glass, a hairline border, an eyebrow heading. */
+@Composable
+fun GlassSection(
+ title: String? = null,
+ modifier: Modifier = Modifier,
+ icon: ImageVector? = null,
+ content: @Composable ColumnScope.() -> Unit,
+) {
+ Column(
+ modifier
+ .fillMaxWidth()
+ .clip(SectionShape)
+ .background(Bg.copy(alpha = 0.72f))
+ .border(1.dp, Line, SectionShape)
+ .padding(16.dp),
+ verticalArrangement = Arrangement.spacedBy(10.dp),
+ ) {
+ if (title != null) {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ if (icon != null) {
+ Icon(icon, null, Modifier.size(16.dp), tint = Accent)
+ Spacer(Modifier.width(6.dp))
+ }
+ Text(title.uppercase(), style = Eyebrow)
+ }
+ }
+ content()
+ }
+}
diff --git a/email/app/src/main/res/drawable-nodpi/background.webp b/design/src/main/res/drawable-nodpi/background.webp
similarity index 100%
rename from email/app/src/main/res/drawable-nodpi/background.webp
rename to design/src/main/res/drawable-nodpi/background.webp
diff --git a/email/app/src/main/res/font/ibm_plex_sans_bold.ttf b/design/src/main/res/font/ibm_plex_sans_bold.ttf
similarity index 100%
rename from email/app/src/main/res/font/ibm_plex_sans_bold.ttf
rename to design/src/main/res/font/ibm_plex_sans_bold.ttf
diff --git a/email/app/src/main/res/font/ibm_plex_sans_medium.ttf b/design/src/main/res/font/ibm_plex_sans_medium.ttf
similarity index 100%
rename from email/app/src/main/res/font/ibm_plex_sans_medium.ttf
rename to design/src/main/res/font/ibm_plex_sans_medium.ttf
diff --git a/email/app/src/main/res/font/ibm_plex_sans_regular.ttf b/design/src/main/res/font/ibm_plex_sans_regular.ttf
similarity index 100%
rename from email/app/src/main/res/font/ibm_plex_sans_regular.ttf
rename to design/src/main/res/font/ibm_plex_sans_regular.ttf
diff --git a/email/app/src/main/res/font/ibm_plex_sans_semibold.ttf b/design/src/main/res/font/ibm_plex_sans_semibold.ttf
similarity index 100%
rename from email/app/src/main/res/font/ibm_plex_sans_semibold.ttf
rename to design/src/main/res/font/ibm_plex_sans_semibold.ttf
diff --git a/design/src/main/res/values/design.xml b/design/src/main/res/values/design.xml
new file mode 100644
index 0000000..ba1a4e4
--- /dev/null
+++ b/design/src/main/res/values/design.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="doughmination_background">#0B0A0D</color>
+
+ <!-- Every app's window theme: Compose draws everything, this only colours
+ the window before it does, so launching never flashes white. -->
+ <style name="Theme.Doughmination" parent="android:Theme.Material.NoActionBar">
+ <item name="android:windowBackground">@color/doughmination_background</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:navigationBarColor">@android:color/transparent</item>
+ </style>
+</resources>
diff --git a/doughmination-manager/app/build.gradle.kts b/doughmination-manager/app/build.gradle.kts
index 40ecac3..a212135 100644
--- a/doughmination-manager/app/build.gradle.kts
+++ b/doughmination-manager/app/build.gradle.kts
@@ -65,6 +65,7 @@ android {
}
dependencies {
+ implementation(project(":design"))
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.icons.extended)
diff --git a/doughmination-manager/app/src/main/java/gay/doughmination/manager/MainActivity.kt b/doughmination-manager/app/src/main/java/gay/doughmination/manager/MainActivity.kt
index 9b25f36..8e7b61e 100644
--- a/doughmination-manager/app/src/main/java/gay/doughmination/manager/MainActivity.kt
+++ b/doughmination-manager/app/src/main/java/gay/doughmination/manager/MainActivity.kt
@@ -1,27 +1,32 @@
package gay.doughmination.manager
-import android.graphics.Color
import android.os.Bundle
import androidx.activity.ComponentActivity
-import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
-import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.ui.Modifier
+import gay.doughmination.design.Backdrop
+import gay.doughmination.design.DoughminationTheme
+import gay.doughmination.design.enableDoughminationEdgeToEdge
import gay.doughmination.manager.ui.ManagerApp
-import gay.doughmination.manager.ui.ManagerTheme
import gay.doughmination.manager.ui.ManagerViewModel
class MainActivity : ComponentActivity() {
private val vm: ManagerViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
- // The app is always dark, so the system bars get light icons.
- enableEdgeToEdge(
- statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
- navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
- )
+ enableDoughminationEdgeToEdge()
super.onCreate(savedInstanceState)
- setContent { ManagerTheme { ManagerApp(vm) } }
+ setContent {
+ DoughminationTheme {
+ Box(Modifier.fillMaxSize()) {
+ Backdrop()
+ ManagerApp(vm)
+ }
+ }
+ }
}
override fun onResume() {
diff --git a/doughmination-manager/app/src/main/java/gay/doughmination/manager/ui/Screens.kt b/doughmination-manager/app/src/main/java/gay/doughmination/manager/ui/Screens.kt
index a2293bf..342c16f 100644
--- a/doughmination-manager/app/src/main/java/gay/doughmination/manager/ui/Screens.kt
+++ b/doughmination-manager/app/src/main/java/gay/doughmination/manager/ui/Screens.kt
@@ -1,11 +1,13 @@
package gay.doughmination.manager.ui
+import gay.doughmination.design.*
import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.text.format.DateUtils
import android.text.format.Formatter
import androidx.activity.compose.BackHandler
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
@@ -38,7 +40,6 @@ import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
-import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LinearProgressIndicator
@@ -50,7 +51,6 @@ import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar
-import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -143,7 +143,6 @@ fun ManagerApp(vm: ManagerViewModel) {
}
}
},
- colors = TopAppBarDefaults.topAppBarColors(containerColor = MaterialTheme.colorScheme.background),
)
},
) { padding ->
@@ -269,8 +268,9 @@ private fun AppCard(
) {
Card(
onClick = { onSelect(row) },
- colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer),
- shape = RoundedCornerShape(16.dp),
+ colors = CardDefaults.cardColors(containerColor = Bg.copy(alpha = 0.72f)),
+ border = BorderStroke(1.dp, Line),
+ shape = SectionShape,
) {
Column(Modifier.padding(16.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
@@ -332,7 +332,7 @@ private fun StatusChip(row: AppRow) {
AppStatus.UpToDate -> "Up to date" to Ok
AppStatus.UpdateAvailable -> "Update available" to Accent
AppStatus.InstalledNewer -> "Newer than the release" to Muted
- AppStatus.SignatureMismatch -> "Different signing key" to Bad
+ AppStatus.SignatureMismatch -> "Different signing key" to Danger
AppStatus.Incompatible -> "Needs Android ${sdkName(row.app.latest.minSdk)}" to Warn
}
Row(verticalAlignment = Alignment.CenterVertically) {
@@ -385,7 +385,7 @@ private fun TaskLine(row: AppRow) {
}
Task.Verifying -> TaskText("Checking the SHA-256 checksum and signature…")
Task.Installing -> TaskText("Waiting for Android to install it…")
- is Task.Failed -> TaskText(task.message, Bad)
+ is Task.Failed -> TaskText(task.message, Danger)
null -> Unit
}
}
@@ -408,77 +408,78 @@ private fun AppDetail(
) {
val context = LocalContext.current
val latest = row.app.latest
- Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(16.dp)) {
- Row(verticalAlignment = Alignment.CenterVertically) {
- AppIcon(row)
- Spacer(Modifier.width(14.dp))
- Column(Modifier.weight(1f)) {
- Text(row.app.name, style = MaterialTheme.typography.headlineSmall, fontWeight = FontWeight.SemiBold)
- row.app.summary?.let { Text(it, style = MaterialTheme.typography.bodyMedium, color = Muted) }
+ Column(
+ Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(16.dp),
+ verticalArrangement = Arrangement.spacedBy(12.dp),
+ ) {
+ GlassSection {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ AppIcon(row)
+ Spacer(Modifier.width(14.dp))
+ Column(Modifier.weight(1f)) {
+ Text(row.app.name, style = MaterialTheme.typography.headlineSmall, fontWeight = FontWeight.SemiBold)
+ row.app.summary?.let { Text(it, style = MaterialTheme.typography.bodyMedium, color = Muted) }
+ }
}
- }
- Spacer(Modifier.height(16.dp))
- StatusChip(row)
- explanation(row)?.let {
- Spacer(Modifier.height(6.dp))
- Text(it, style = MaterialTheme.typography.bodyMedium)
- }
- TaskLine(row)
- Spacer(Modifier.height(16.dp))
- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- val task = row.task
- when {
- task is Task.Downloading -> OutlinedButton(onClick = onCancel) { Text("Cancel download") }
- task == Task.Verifying || task == Task.Installing -> Unit
- Status.canInstall(row.status) -> Button(onClick = onInstall) {
- Text(if (row.status == AppStatus.UpdateAvailable) "Update to ${latest.versionName}" else "Install ${latest.versionName}")
+ StatusChip(row)
+ explanation(row)?.let { Text(it, style = MaterialTheme.typography.bodyMedium) }
+ TaskLine(row)
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ val task = row.task
+ when {
+ task is Task.Downloading -> OutlinedButton(onClick = onCancel) { Text("Cancel download") }
+ task == Task.Verifying || task == Task.Installing -> Unit
+ Status.canInstall(row.status) -> Button(onClick = onInstall) {
+ Text(if (row.status == AppStatus.UpdateAvailable) "Update to ${latest.versionName}" else "Install ${latest.versionName}")
+ }
+ row.status == AppStatus.SignatureMismatch -> Button(onClick = onUninstall) { Text("Uninstall the old copy") }
}
- row.status == AppStatus.SignatureMismatch -> Button(onClick = onUninstall) { Text("Uninstall the old copy") }
+ if (task is Task.Failed) TextButton(onClick = onDismiss) { Text("Dismiss") }
+ if (row.installed != null && !row.isSelf) OutlinedButton(onClick = onOpen) { Text("Open") }
}
- if (task is Task.Failed) TextButton(onClick = onDismiss) { Text("Dismiss") }
- if (row.installed != null && !row.isSelf) OutlinedButton(onClick = onOpen) { Text("Open") }
}
- Section("Versions")
- Field("Installed", row.installed?.let { "${it.versionName ?: "?"} (${it.versionCode})" } ?: "Not installed")
- Field("Latest", "${latest.versionName} (${latest.versionCode})")
- latest.releasedAt?.let { Field("Built", relative(it)) }
- Field("Download", Formatter.formatShortFileSize(context, latest.sizeBytes))
- latest.minSdk?.let { Field("Needs", "Android ${sdkName(it)} or newer") }
+ GlassSection("Versions") {
+ Field("Installed", row.installed?.let { "${it.versionName ?: "?"} (${it.versionCode})" } ?: "Not installed")
+ Field("Latest", "${latest.versionName} (${latest.versionCode})")
+ latest.releasedAt?.let { Field("Built", relative(it)) }
+ Field("Download", Formatter.formatShortFileSize(context, latest.sizeBytes))
+ latest.minSdk?.let { Field("Needs", "Android ${sdkName(it)} or newer") }
+ }
- Section("What's new")
- Text(
- latest.releaseNotes?.takeIf { it.isNotBlank() }?.let(::plainNotes) ?: "No notes for this build.",
- style = MaterialTheme.typography.bodyMedium,
- )
- latest.releaseUrl?.let { url ->
- Spacer(Modifier.height(8.dp))
- TextButton(onClick = { onLink(url) }, contentPadding = PaddingValues(0.dp)) {
- Text("View the release")
- Spacer(Modifier.width(6.dp))
- Icon(Icons.AutoMirrored.Filled.OpenInNew, null, Modifier.size(16.dp))
+ GlassSection("What's new") {
+ Text(
+ latest.releaseNotes?.takeIf { it.isNotBlank() }?.let(::plainNotes) ?: "No notes for this build.",
+ style = MaterialTheme.typography.bodyMedium,
+ )
+ latest.releaseUrl?.let { url ->
+ TextButton(onClick = { onLink(url) }, contentPadding = PaddingValues(0.dp)) {
+ Text("View the release")
+ Spacer(Modifier.width(6.dp))
+ Icon(Icons.AutoMirrored.Filled.OpenInNew, null, Modifier.size(16.dp))
+ }
}
}
- Section("Integrity")
- Text(
- "Every download is checked against this SHA-256 and the signing certificate before Android is asked to install it.",
- style = MaterialTheme.typography.bodySmall,
- color = Muted,
- )
- Spacer(Modifier.height(8.dp))
- SelectionContainer {
- Column {
- Field("Package", row.app.packageName, mono = true)
- Field("SHA-256", latest.sha256.lowercase(), mono = true)
- row.app.signingCertSha256.forEach { Field("Signing key", it, mono = true) }
+ GlassSection("Integrity") {
+ Text(
+ "Every download is checked against this SHA-256 and the signing certificate before Android is asked to install it.",
+ style = MaterialTheme.typography.bodySmall,
+ color = Muted,
+ )
+ SelectionContainer {
+ Column {
+ Field("Package", row.app.packageName, mono = true)
+ Field("SHA-256", latest.sha256.lowercase(), mono = true)
+ row.app.signingCertSha256.forEach { Field("Signing key", it, mono = true) }
+ }
}
}
- Spacer(Modifier.height(24.dp))
Text(
"Manager ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})",
style = MaterialTheme.typography.labelSmall,
color = Muted,
+ modifier = Modifier.padding(top = 8.dp),
)
}
}
@@ -492,15 +493,6 @@ private fun explanation(row: AppRow): String? = when (row.status) {
else -> null
}
-@Composable
-private fun Section(title: String) {
- Spacer(Modifier.height(24.dp))
- Text(title, style = MaterialTheme.typography.titleSmall, color = Accent)
- Spacer(Modifier.height(4.dp))
- HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
- Spacer(Modifier.height(8.dp))
-}
-
@Composable
private fun Field(label: String, value: String, mono: Boolean = false) {
Column(Modifier.padding(vertical = 4.dp)) {
diff --git a/doughmination-manager/app/src/main/java/gay/doughmination/manager/ui/Theme.kt b/doughmination-manager/app/src/main/java/gay/doughmination/manager/ui/Theme.kt
deleted file mode 100644
index c19af4e..0000000
--- a/doughmination-manager/app/src/main/java/gay/doughmination/manager/ui/Theme.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package gay.doughmination.manager.ui
-
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.darkColorScheme
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.graphics.Color
-
-// The Doughmination palette, as the System app and the websites use it.
-val Accent = Color(0xFFEB459E)
-val Ok = Color(0xFF7FD98B)
-val Warn = Color(0xFFF2C46D)
-val Bad = Color(0xFFFF8A9A)
-val Muted = Color(0xFFA49EAB)
-
-private val scheme = darkColorScheme(
- primary = Accent,
- onPrimary = Color.White,
- primaryContainer = Color(0xFF3A1430),
- onPrimaryContainer = Color(0xFFFFD8EC),
- secondary = Color(0xFFCDB8D6),
- background = Color(0xFF0F0D14),
- onBackground = Color(0xFFECE9EF),
- surface = Color(0xFF0F0D14),
- onSurface = Color(0xFFECE9EF),
- surfaceVariant = Color(0xFF1E1B2E),
- onSurfaceVariant = Muted,
- surfaceContainer = Color(0xFF17141F),
- surfaceContainerHigh = Color(0xFF1E1B2E),
- outline = Color(0xFF3B3546),
- outlineVariant = Color(0xFF2A2533),
- error = Bad,
-)
-
-@Composable
-fun ManagerTheme(content: @Composable () -> Unit) {
- MaterialTheme(colorScheme = scheme, content = content)
-}
diff --git a/doughmination-manager/app/src/main/res/values/themes.xml b/doughmination-manager/app/src/main/res/values/themes.xml
index 67869ed..bb5f90b 100644
--- a/doughmination-manager/app/src/main/res/values/themes.xml
+++ b/doughmination-manager/app/src/main/res/values/themes.xml
@@ -1,7 +1,5 @@
<resources>
- <!-- Compose draws everything; this only covers the window before it does. -->
- <style name="Theme.App" parent="android:Theme.Material.NoActionBar">
- <item name="android:windowBackground">@color/ic_launcher_background</item>
- </style>
+ <!-- The shared window theme (the :design module): dark, so launching doesn't flash white. -->
+ <style name="Theme.App" parent="Theme.Doughmination" />
<color name="ic_launcher_background">#1E1B2E</color>
</resources>
diff --git a/email/app/build.gradle.kts b/email/app/build.gradle.kts
index 6206654..a77f2a6 100644
--- a/email/app/build.gradle.kts
+++ b/email/app/build.gradle.kts
@@ -73,6 +73,7 @@ android {
}
dependencies {
+ implementation(project(":design"))
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.icons.extended)
diff --git a/email/app/src/main/java/gay/doughmination/mail/MainActivity.kt b/email/app/src/main/java/gay/doughmination/mail/MainActivity.kt
index fcf001d..09d2445 100644
--- a/email/app/src/main/java/gay/doughmination/mail/MainActivity.kt
+++ b/email/app/src/main/java/gay/doughmination/mail/MainActivity.kt
@@ -6,7 +6,7 @@ import android.os.SystemClock
import android.view.animation.AccelerateInterpolator
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
-import androidx.activity.enableEdgeToEdge
+import gay.doughmination.design.enableDoughminationEdgeToEdge
import androidx.activity.viewModels
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import gay.doughmination.mail.ui.AppRoot
@@ -37,7 +37,7 @@ class MainActivity : ComponentActivity() {
.start()
}
}
- enableEdgeToEdge()
+ enableDoughminationEdgeToEdge()
super.onCreate(savedInstanceState)
setContent { InboxTheme { AppRoot(vm) } }
// A recreated activity (rotation) has already handled its launch intent.
diff --git a/email/app/src/main/java/gay/doughmination/mail/ui/AccountPicture.kt b/email/app/src/main/java/gay/doughmination/mail/ui/AccountPicture.kt
index 120c0d3..3271c13 100644
--- a/email/app/src/main/java/gay/doughmination/mail/ui/AccountPicture.kt
+++ b/email/app/src/main/java/gay/doughmination/mail/ui/AccountPicture.kt
@@ -1,5 +1,6 @@
package gay.doughmination.mail.ui
+import gay.doughmination.design.*
import android.graphics.BitmapFactory
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
diff --git a/email/app/src/main/java/gay/doughmination/mail/ui/AppRoot.kt b/email/app/src/main/java/gay/doughmination/mail/ui/AppRoot.kt
index 2567ac3..01089e2 100644
--- a/email/app/src/main/java/gay/doughmination/mail/ui/AppRoot.kt
+++ b/email/app/src/main/java/gay/doughmination/mail/ui/AppRoot.kt
@@ -1,5 +1,6 @@
package gay.doughmination.mail.ui
+import gay.doughmination.design.*
import android.Manifest
import android.content.pm.PackageManager
import android.os.Build
diff --git a/email/app/src/main/java/gay/doughmination/mail/ui/ComposeScreen.kt b/email/app/src/main/java/gay/doughmination/mail/ui/ComposeScreen.kt
index c43db75..d6b2c9c 100644
--- a/email/app/src/main/java/gay/doughmination/mail/ui/ComposeScreen.kt
+++ b/email/app/src/main/java/gay/doughmination/mail/ui/ComposeScreen.kt
@@ -1,5 +1,6 @@
package gay.doughmination.mail.ui
+import gay.doughmination.design.*
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Column
diff --git a/email/app/src/main/java/gay/doughmination/mail/ui/SettingsScreen.kt b/email/app/src/main/java/gay/doughmination/mail/ui/SettingsScreen.kt
index d96f918..60b7264 100644
--- a/email/app/src/main/java/gay/doughmination/mail/ui/SettingsScreen.kt
+++ b/email/app/src/main/java/gay/doughmination/mail/ui/SettingsScreen.kt
@@ -1,5 +1,6 @@
package gay.doughmination.mail.ui
+import gay.doughmination.design.*
import android.content.Intent
import android.net.Uri
import android.provider.Settings
@@ -193,30 +194,11 @@ fun SettingsScreen(vm: MailViewModel) {
}
}
-private val sectionShape = RoundedCornerShape(16.dp)
-/** A card like the web's settings sections: dark glass, a hairline border, an eyebrow heading. */
+/** A settings section: the shared glass card. */
@Composable
-private fun Section(title: String, icon: ImageVector? = null, content: @Composable ColumnScope.() -> Unit) {
- Column(
- Modifier
- .fillMaxWidth()
- .clip(sectionShape)
- .background(Bg.copy(alpha = 0.72f))
- .border(1.dp, Line, sectionShape)
- .padding(16.dp),
- verticalArrangement = Arrangement.spacedBy(10.dp),
- ) {
- Row(verticalAlignment = Alignment.CenterVertically) {
- if (icon != null) {
- Icon(icon, null, Modifier.size(16.dp), tint = Accent)
- Spacer(Modifier.width(6.dp))
- }
- Text(title.uppercase(), style = Eyebrow)
- }
- content()
- }
-}
+private fun Section(title: String, icon: ImageVector? = null, content: @Composable ColumnScope.() -> Unit) =
+ GlassSection(title, icon = icon, content = content)
/** A dropdown of the swipe actions, as an outlined field. */
@OptIn(ExperimentalMaterial3Api::class)
diff --git a/email/app/src/main/java/gay/doughmination/mail/ui/Theme.kt b/email/app/src/main/java/gay/doughmination/mail/ui/Theme.kt
index b1eefa4..9267bbe 100644
--- a/email/app/src/main/java/gay/doughmination/mail/ui/Theme.kt
+++ b/email/app/src/main/java/gay/doughmination/mail/ui/Theme.kt
@@ -1,140 +1,14 @@
package gay.doughmination.mail.ui
-import androidx.compose.foundation.Image
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.drawBehind
-import androidx.compose.ui.geometry.Offset
-import androidx.compose.ui.graphics.Brush
-import androidx.compose.ui.layout.ContentScale
-import androidx.compose.ui.res.painterResource
-import gay.doughmination.mail.R
-import androidx.compose.material3.Typography
-import androidx.compose.material3.darkColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.Font
-import androidx.compose.ui.text.font.FontFamily
-import androidx.compose.ui.text.font.FontWeight
-import androidx.compose.ui.unit.sp
+import gay.doughmination.design.DoughminationTheme
+
+// Inbox's look is the shared Doughmination theme (the :design module), which
+// started here; only what's Inbox's own stays in this file.
-// The site's palette (email/src/web/app.css).
-val Accent = Color(0xFFEB459E)
-val Danger = Color(0xFFFF5C7A)
-val Muted = Color(0xFFA49EAB)
-val Bg = Color(0xFF0B0A0D)
-/** A card on the backdrop, like --raised on the web. */
-val Raised = Color.White.copy(alpha = 0.05f)
-/** Hairline borders, like --line on the web. */
-val Line = Color.White.copy(alpha = 0.09f)
/** A starred thread, like --star on the web. */
val StarYellow = Color(0xFFF7C948)
-/** IBM Plex Sans, as on the web and doughmination.gay (the same files, as TTF). */
-val PlexSans = FontFamily(
- Font(R.font.ibm_plex_sans_regular, FontWeight.Normal),
- Font(R.font.ibm_plex_sans_medium, FontWeight.Medium),
- Font(R.font.ibm_plex_sans_semibold, FontWeight.SemiBold),
- Font(R.font.ibm_plex_sans_bold, FontWeight.Bold),
-)
-
-private fun TextStyle.plex() = copy(fontFamily = PlexSans)
-
-private val typography = Typography().run {
- Typography(
- displayLarge = displayLarge.plex(),
- displayMedium = displayMedium.plex(),
- displaySmall = displaySmall.plex(),
- headlineLarge = headlineLarge.plex(),
- headlineMedium = headlineMedium.plex(),
- headlineSmall = headlineSmall.plex(),
- titleLarge = titleLarge.plex(),
- titleMedium = titleMedium.plex(),
- titleSmall = titleSmall.plex(),
- bodyLarge = bodyLarge.plex(),
- bodyMedium = bodyMedium.plex(),
- bodySmall = bodySmall.plex(),
- labelLarge = labelLarge.plex(),
- labelMedium = labelMedium.plex(),
- labelSmall = labelSmall.plex(),
- )
-}
-
-/** The web's small uppercase accent label (.eyebrow), used for headings. */
-val Eyebrow = TextStyle(
- fontFamily = PlexSans,
- fontSize = 11.sp,
- fontWeight = FontWeight.SemiBold,
- letterSpacing = 1.5.sp,
- color = Accent,
-)
-
-private val colors = darkColorScheme(
- primary = Accent,
- onPrimary = Color.White,
- primaryContainer = Color(0xFF3A1A2C),
- onPrimaryContainer = Color(0xFFFFD8EA),
- secondaryContainer = Color(0xFF2A1A24),
- onSecondaryContainer = Color(0xFFFFD8EA),
- // Screens and app bars sit on the Backdrop, so these are see-through.
- // Sheets, menus and dialogs use the surfaceContainer colours and stay opaque.
- background = Color.Transparent,
- onBackground = Color(0xFFECE9EF),
- surface = Color.Transparent,
- onSurface = Color(0xFFECE9EF),
- surfaceVariant = Color(0xFF1C1A20),
- onSurfaceVariant = Muted,
- surfaceContainerLowest = Color(0xFF0B0A0D),
- surfaceContainerLow = Color(0xFF131116),
- surfaceContainer = Color(0xFF17151B),
- surfaceContainerHigh = Color(0xFF1E1B22),
- surfaceContainerHighest = Color(0xFF26222B),
- outline = Color(0xFF3A3640),
- outlineVariant = Color(0xFF26222B),
- error = Danger,
-)
-
-/**
- * The site's wallpaper behind every screen, dimmed the way the web does it:
- * the art at half strength under a dark wash and a soft pink glow.
- */
-@Composable
-fun Backdrop(modifier: Modifier = Modifier) {
- Box(modifier.fillMaxSize().background(Bg)) {
- Image(
- painterResource(R.drawable.background),
- contentDescription = null,
- contentScale = ContentScale.Crop,
- alpha = 0.5f,
- modifier = Modifier.fillMaxSize(),
- )
- Box(
- Modifier.fillMaxSize().background(
- Brush.verticalGradient(
- 0f to Bg.copy(alpha = 0.55f),
- 0.55f to Bg.copy(alpha = 0.8f),
- 1f to Bg,
- ),
- ),
- )
- Box(
- Modifier.fillMaxSize().drawBehind {
- drawRect(
- Brush.radialGradient(
- listOf(Accent.copy(alpha = 0.12f), Color.Transparent),
- center = Offset(size.width * 0.2f, size.height * 0.3f),
- radius = size.maxDimension * 0.6f,
- ),
- )
- },
- )
- }
-}
-
@Composable
-fun InboxTheme(content: @Composable () -> Unit) =
- MaterialTheme(colorScheme = colors, typography = typography, content = content)
+fun InboxTheme(content: @Composable () -> Unit) = DoughminationTheme(content)
diff --git a/email/app/src/main/java/gay/doughmination/mail/ui/ThreadListScreen.kt b/email/app/src/main/java/gay/doughmination/mail/ui/ThreadListScreen.kt
index cd09381..5fb535a 100644
--- a/email/app/src/main/java/gay/doughmination/mail/ui/ThreadListScreen.kt
+++ b/email/app/src/main/java/gay/doughmination/mail/ui/ThreadListScreen.kt
@@ -1,5 +1,6 @@
package gay.doughmination.mail.ui
+import gay.doughmination.design.*
import android.os.Build
import android.view.HapticFeedbackConstants
import androidx.compose.foundation.ExperimentalFoundationApi
diff --git a/email/app/src/main/java/gay/doughmination/mail/ui/ThreadScreen.kt b/email/app/src/main/java/gay/doughmination/mail/ui/ThreadScreen.kt
index c18a0d7..342e54e 100644
--- a/email/app/src/main/java/gay/doughmination/mail/ui/ThreadScreen.kt
+++ b/email/app/src/main/java/gay/doughmination/mail/ui/ThreadScreen.kt
@@ -1,5 +1,6 @@
package gay.doughmination.mail.ui
+import gay.doughmination.design.*
import android.app.DownloadManager
import android.content.Context
import android.net.Uri
diff --git a/email/app/src/main/res/values/themes.xml b/email/app/src/main/res/values/themes.xml
index bd564ec..69a4310 100644
--- a/email/app/src/main/res/values/themes.xml
+++ b/email/app/src/main/res/values/themes.xml
@@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Compose draws everything; this only colours the window before it does. -->
- <style name="Theme.Inbox" parent="android:Theme.Material.NoActionBar">
- <item name="android:windowBackground">@color/background</item>
- <item name="android:statusBarColor">@android:color/transparent</item>
- <item name="android:navigationBarColor">@android:color/transparent</item>
- </style>
+ <style name="Theme.Inbox" parent="Theme.Doughmination" />
<!-- The splash: the mascot on a blush disc, held until the first page of
mail is in (see MainActivity), then it hands over to Theme.Inbox. -->
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index a52d24a..faaa996 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -58,6 +58,7 @@ junit = { module = "junit:junit", version.ref = "junit" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
+android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
diff --git a/plural/app/build.gradle.kts b/plural/app/build.gradle.kts
index e42f6bb..3ead427 100644
--- a/plural/app/build.gradle.kts
+++ b/plural/app/build.gradle.kts
@@ -64,6 +64,7 @@ android {
}
dependencies {
+ implementation(project(":design"))
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.icons.extended)
diff --git a/plural/app/src/main/java/gay/doughmination/plural/MainActivity.kt b/plural/app/src/main/java/gay/doughmination/plural/MainActivity.kt
index 96bf704..974da22 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/MainActivity.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/MainActivity.kt
@@ -2,11 +2,9 @@ package gay.doughmination.plural
import android.content.Intent
import android.os.Bundle
-import android.graphics.Color
import androidx.activity.ComponentActivity
-import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
-import androidx.activity.enableEdgeToEdge
+import gay.doughmination.design.enableDoughminationEdgeToEdge
import androidx.activity.viewModels
import gay.doughmination.plural.ui.AppRoot
import gay.doughmination.plural.ui.SystemTheme
@@ -19,11 +17,7 @@ class MainActivity : ComponentActivity() {
private var awaitingLogin = false
override fun onCreate(savedInstanceState: Bundle?) {
- // The app is always dark, so the system bars need light icons whatever the phone's theme.
- enableEdgeToEdge(
- statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
- navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
- )
+ enableDoughminationEdgeToEdge()
super.onCreate(savedInstanceState)
setContent { SystemTheme { AppRoot(vm) } }
// A recreated activity (rotation) has already handled its launch intent.
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/AccountScreen.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/AccountScreen.kt
index 0294c5a..938c2aa 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/AccountScreen.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/AccountScreen.kt
@@ -2,6 +2,7 @@
package gay.doughmination.plural.ui
+import gay.doughmination.design.*
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@@ -73,7 +74,7 @@ fun AccountScreen(vm: SystemViewModel) {
}
Panel {
- Text("Account", style = Eyebrow)
+ Text("ACCOUNT", style = Eyebrow)
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(6.dp)) {
Avatar(user.avatarUrl, 96.dp, ring = Accent)
Text(user.shownName, style = MaterialTheme.typography.headlineSmall)
@@ -102,7 +103,7 @@ fun AccountScreen(vm: SystemViewModel) {
private fun SignIn(vm: SystemViewModel) {
val context = LocalContext.current
Panel {
- Text("Account", style = Eyebrow)
+ Text("ACCOUNT", style = Eyebrow)
Text("Sign in", style = MaterialTheme.typography.headlineSmall)
Text("Use your SSO account to continue.", color = Muted)
Button(onClick = { vm.startLogin(context) }, enabled = !vm.signingIn) {
@@ -137,7 +138,7 @@ private fun AdminHub(vm: SystemViewModel) {
Tile(Icons.Outlined.Group, "User management", "Manage all users") { vm.open(Screen.Users) }
}
- Panel(Modifier.border(1.dp, Bad.copy(alpha = 0.4f), RoundedCornerShape(16.dp))) {
+ Panel(Modifier.border(1.dp, Danger.copy(alpha = 0.4f), RoundedCornerShape(16.dp))) {
Text("[ danger ] Force refresh all clients", style = MaterialTheme.typography.titleMedium)
Text(
"Send a refresh command to everyone viewing the website or this app. Their pages reload immediately.",
@@ -147,7 +148,7 @@ private fun AdminHub(vm: SystemViewModel) {
Button(
onClick = { confirmRefresh = true },
enabled = !vm.busy,
- colors = ButtonDefaults.buttonColors(containerColor = Bad),
+ colors = ButtonDefaults.buttonColors(containerColor = Danger),
) {
Icon(Icons.Outlined.Refresh, null, Modifier.size(18.dp)); HGap(6); Text("Refresh all")
}
@@ -196,7 +197,7 @@ fun Confirm(title: String, text: String, action: String, onDismiss: () -> Unit,
onDismissRequest = onDismiss,
title = { Text(title) },
text = { Text(text) },
- confirmButton = { TextButton(onClick = onConfirm) { Text(action, color = Bad) } },
+ confirmButton = { TextButton(onClick = onConfirm) { Text(action, color = Danger) } },
dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } },
)
}
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/AdminScreens.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/AdminScreens.kt
index 161bd04..24c5ac5 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/AdminScreens.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/AdminScreens.kt
@@ -2,6 +2,7 @@
package gay.doughmination.plural.ui
+import gay.doughmination.design.*
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@@ -269,7 +270,7 @@ fun StatusScreen(vm: SystemViewModel) {
Text(if (vm.busy) "Updating..." else "Update status")
}
if (chosen.status != null) {
- OutlinedButton(onClick = { confirmClear = true }, enabled = !vm.busy) { Text("Clear", color = Bad) }
+ OutlinedButton(onClick = { confirmClear = true }, enabled = !vm.busy) { Text("Clear", color = Danger) }
}
}
chosen.status?.let { status ->
@@ -432,7 +433,7 @@ fun ManageRelationshipsScreen(vm: SystemViewModel) {
Text("${label(edge.members[0])} ${if (edge.type == "crush") "→" else "&"} ${label(edge.members[1])}")
Text(edge.type + (edge.since?.let { " · since $it" } ?: ""), color = Muted, fontSize = 12.sp)
}
- IconButton(onClick = { removing = edge }, enabled = !vm.busy) { Icon(Icons.Outlined.Delete, "Remove", tint = Bad) }
+ IconButton(onClick = { removing = edge }, enabled = !vm.busy) { Icon(Icons.Outlined.Delete, "Remove", tint = Danger) }
}
}
}
@@ -483,7 +484,7 @@ fun UsersScreen(vm: SystemViewModel) {
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OutlinedButton(onClick = { editingId = user.id }) { Text("Edit") }
if (user.id != vm.user?.id) {
- OutlinedButton(onClick = { deleting = user }, enabled = !vm.busy) { Text("Delete", color = Bad) }
+ OutlinedButton(onClick = { deleting = user }, enabled = !vm.busy) { Text("Delete", color = Danger) }
}
}
}
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/AppRoot.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/AppRoot.kt
index 4638d3d..a82da05 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/AppRoot.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/AppRoot.kt
@@ -1,5 +1,6 @@
package gay.doughmination.plural.ui
+import gay.doughmination.design.*
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
@@ -58,7 +59,7 @@ fun AppRoot(vm: SystemViewModel) {
val error = vm.flash?.error == true
Snackbar(
data,
- containerColor = if (error) Bad else androidx.compose.material3.MaterialTheme.colorScheme.surfaceContainerHighest,
+ containerColor = if (error) Danger else androidx.compose.material3.MaterialTheme.colorScheme.surfaceContainerHighest,
contentColor = if (error) Color(0xFF1A0611) else TextColour,
)
}
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/Components.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/Components.kt
index 617fdfb..b05f517 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/Components.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/Components.kt
@@ -2,6 +2,7 @@
package gay.doughmination.plural.ui
+import gay.doughmination.design.*
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@@ -67,11 +68,11 @@ fun Panel(modifier: Modifier = Modifier, content: @Composable ColumnScope.() ->
)
}
-/** A page's heading, as the website writes them: "// system.members" over a title. */
+/** A page's heading: an eyebrow over a title, as Inbox and the websites do it. */
@Composable
fun PageHead(eyebrow: String, title: String, subtitle: String? = null) {
Column(Modifier.padding(bottom = 4.dp)) {
- Text(eyebrow, style = Eyebrow)
+ Text(eyebrow.uppercase(), style = Eyebrow)
Text(title, style = MaterialTheme.typography.headlineMedium)
subtitle?.let { Text(it, color = Muted, style = MaterialTheme.typography.bodyMedium) }
}
@@ -179,7 +180,7 @@ fun PrideSwatch(label: String, modifier: Modifier = Modifier) {
/** The colour the website gives a mental-state level: ok, warn or bad. */
fun mentalColour(level: String): Color = when (MentalLevel.of(level)?.severity) {
1 -> Warn
- 2 -> Bad
+ 2 -> Danger
else -> Ok
}
@@ -210,12 +211,12 @@ fun MentalBanner(state: MentalState, modifier: Modifier = Modifier) {
Icon(mentalIcon(state.level), contentDescription = null, tint = colour, modifier = Modifier.size(30.dp))
Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
Row {
- Text("status: ", color = Muted, fontFamily = Eyebrow.fontFamily, fontSize = 14.sp)
- Text("[ $label ]", color = colour, fontWeight = FontWeight.SemiBold, fontFamily = Eyebrow.fontFamily, fontSize = 14.sp)
+ Text("status: ", color = Muted, fontFamily = Mono, fontSize = 14.sp)
+ Text("[ $label ]", color = colour, fontWeight = FontWeight.SemiBold, fontFamily = Mono, fontSize = 14.sp)
}
state.notes?.ifBlank { null }?.let { Text(it, style = MaterialTheme.typography.bodyMedium) }
formatTime(state.updatedAt)?.let {
- Text("last_updated: $it", color = Muted, fontSize = 12.sp, fontFamily = Eyebrow.fontFamily)
+ Text("last_updated: $it", color = Muted, fontSize = 12.sp, fontFamily = Mono)
}
}
}
@@ -224,10 +225,10 @@ fun MentalBanner(state: MentalState, modifier: Modifier = Modifier) {
/** A plain notice line, like the website's .notice. */
@Composable
fun Notice(text: String, error: Boolean = false, modifier: Modifier = Modifier) {
- val colour = if (error) Bad else Muted
+ val colour = if (error) Danger else Muted
Text(
text,
- color = if (error) Bad else TextColour,
+ color = if (error) Danger else TextColour,
style = MaterialTheme.typography.bodyMedium,
modifier = modifier
.fillMaxWidth()
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/HomeScreen.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/HomeScreen.kt
index 73107e5..a66ce96 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/HomeScreen.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/HomeScreen.kt
@@ -2,6 +2,7 @@
package gay.doughmination.plural.ui
+import gay.doughmination.design.*
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@@ -120,7 +121,7 @@ fun HomeScreen(vm: SystemViewModel) {
}
}
- item(span = full) { PageHead("// system.members", "System Members") }
+ item(span = full) { PageHead("Doughmination System", "System Members") }
vm.mental?.let { state -> item(span = full) { MentalBanner(state) } }
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/MemberScreen.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/MemberScreen.kt
index aa035ee..f84a4ae 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/MemberScreen.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/MemberScreen.kt
@@ -2,6 +2,7 @@
package gay.doughmination.plural.ui
+import gay.doughmination.design.*
import android.content.Intent
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@@ -54,7 +55,7 @@ fun MemberScreen(vm: SystemViewModel, id: String) {
if (member == null) {
Box(Modifier.fillMaxSize().padding(16.dp)) {
Panel {
- Text("Error 404", style = Eyebrow)
+ Text("ERROR 404", style = Eyebrow)
Text("Member not found", style = MaterialTheme.typography.headlineSmall)
Text("This member could not be found in the Doughmination System.", color = Muted)
}
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/MetricsScreen.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/MetricsScreen.kt
index 7890957..d77e6d6 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/MetricsScreen.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/MetricsScreen.kt
@@ -2,6 +2,7 @@
package gay.doughmination.plural.ui
+import gay.doughmination.design.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
@@ -72,7 +73,7 @@ fun MetricsScreen(vm: SystemViewModel) {
Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
- PageHead("// system.metrics", "Metrics", "System fronting and switching statistics")
+ PageHead("Statistics", "Metrics", "System fronting and switching statistics")
vm.metricsError?.let {
Notice(it, error = true)
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/RelationshipsScreen.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/RelationshipsScreen.kt
index 1e2c134..0bd2831 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/RelationshipsScreen.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/RelationshipsScreen.kt
@@ -2,6 +2,7 @@
package gay.doughmination.plural.ui
+import gay.doughmination.design.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectDragGestures
@@ -80,7 +81,7 @@ fun RelationshipsScreen(vm: SystemViewModel) {
Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
- PageHead("// system.relationships", "Relationship Map", "Who is dating who across the system")
+ PageHead("Relationships", "Relationship Map", "Who is dating who across the system")
if (couples.isEmpty()) {
Panel { Text(if (vm.loading) "Loading…" else "No relationships to show yet", color = Muted) }
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/Theme.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/Theme.kt
index e808bff..1ed1ac4 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/Theme.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/Theme.kt
@@ -1,136 +1,14 @@
package gay.doughmination.plural.ui
-import androidx.compose.foundation.Image
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.Typography
-import androidx.compose.material3.darkColorScheme
import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.drawBehind
-import androidx.compose.ui.geometry.Offset
-import androidx.compose.ui.graphics.Brush
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.layout.ContentScale
-import androidx.compose.ui.res.painterResource
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
-import androidx.compose.ui.text.font.FontWeight
-import androidx.compose.ui.unit.sp
-import gay.doughmination.plural.R
+import gay.doughmination.design.DoughminationTheme
-// The website's tokens (system/src/lib/styles/theme.css), which are
-// doughmination.gay's.
-val Bg = Color(0xFF0B0A0D)
-val TextColour = Color(0xFFECE9EF)
-val Muted = Color(0xFFA49EAB)
-val Accent = Color(0xFFEB459E)
-val AccentDim = Color(0xFFEB459E).copy(alpha = 0.14f)
-val AccentLine = Color(0xFFEB459E).copy(alpha = 0.4f)
-val Ok = Color(0xFF7FD98B)
-val Warn = Color(0xFFF2C46D)
-val Bad = Color(0xFFFF8A9A)
-/** A card on the backdrop, like --raised. */
-val Raised = Color.White.copy(alpha = 0.035f)
-/** Hairline borders, like --line. */
-val Line = Color.White.copy(alpha = 0.09f)
+// The System app's look is the shared Doughmination theme (the :design
+// module, Inbox's theme); only what's the System app's own stays here.
-/** IBM Plex Sans, as on the website (the same files as TTF, shared with Inbox). */
-val PlexSans = FontFamily(
- Font(R.font.ibm_plex_sans_regular, FontWeight.Normal),
- Font(R.font.ibm_plex_sans_medium, FontWeight.Medium),
- Font(R.font.ibm_plex_sans_semibold, FontWeight.SemiBold),
- Font(R.font.ibm_plex_sans_bold, FontWeight.Bold),
-)
-
-private fun TextStyle.plex() = copy(fontFamily = PlexSans)
-
-private val typography = Typography().run {
- Typography(
- displayLarge = displayLarge.plex(),
- displayMedium = displayMedium.plex(),
- displaySmall = displaySmall.plex(),
- headlineLarge = headlineLarge.plex(),
- headlineMedium = headlineMedium.plex().copy(fontWeight = FontWeight.SemiBold),
- headlineSmall = headlineSmall.plex().copy(fontWeight = FontWeight.SemiBold),
- titleLarge = titleLarge.plex().copy(fontWeight = FontWeight.SemiBold),
- titleMedium = titleMedium.plex().copy(fontWeight = FontWeight.SemiBold),
- titleSmall = titleSmall.plex(),
- bodyLarge = bodyLarge.plex(),
- bodyMedium = bodyMedium.plex(),
- bodySmall = bodySmall.plex(),
- labelLarge = labelLarge.plex(),
- labelMedium = labelMedium.plex(),
- labelSmall = labelSmall.plex(),
- )
-}
-
-/** The website's mono eyebrows ("// system.members"). */
-val Eyebrow = TextStyle(
- fontFamily = FontFamily.Monospace,
- fontSize = 12.sp,
- letterSpacing = 0.5.sp,
- color = Accent,
-)
-
-private val colours = darkColorScheme(
- primary = Accent,
- onPrimary = Color(0xFF1A0611),
- primaryContainer = Color(0xFF3A1A2C),
- onPrimaryContainer = Color(0xFFFFD8EA),
- secondaryContainer = Color(0xFF2A1A24),
- onSecondaryContainer = Color(0xFFFFD8EA),
- // Screens sit on the Backdrop, so these are see-through. Sheets, menus and
- // dialogs use the surfaceContainer colours and stay opaque.
- background = Color.Transparent,
- onBackground = TextColour,
- surface = Color.Transparent,
- onSurface = TextColour,
- surfaceVariant = Color(0xFF1C1A20),
- onSurfaceVariant = Muted,
- surfaceContainerLowest = Bg,
- surfaceContainerLow = Color(0xFF131116),
- surfaceContainer = Color(0xFF17151B),
- surfaceContainerHigh = Color(0xFF1E1B22),
- surfaceContainerHighest = Color(0xFF26222B),
- outline = Color(0xFF3A3640),
- outlineVariant = Color(0xFF26222B),
- error = Bad,
-)
-
-/** The site's wallpaper behind every screen, dimmed the way the web does it. */
-@Composable
-fun Backdrop(modifier: Modifier = Modifier) {
- Box(modifier.fillMaxSize().background(Bg)) {
- Image(
- painterResource(R.drawable.background),
- contentDescription = null,
- contentScale = ContentScale.Crop,
- alpha = 0.45f,
- modifier = Modifier.fillMaxSize(),
- )
- Box(
- Modifier.fillMaxSize().background(
- Brush.verticalGradient(0f to Bg.copy(alpha = 0.55f), 0.5f to Bg.copy(alpha = 0.85f), 1f to Bg),
- ),
- )
- Box(
- Modifier.fillMaxSize().drawBehind {
- drawRect(
- Brush.radialGradient(
- listOf(Accent.copy(alpha = 0.12f), Color.Transparent),
- center = Offset(size.width * 0.2f, size.height * 0.15f),
- radius = size.maxDimension * 0.6f,
- ),
- )
- },
- )
- }
-}
+/** The website's terminal-style text ("status: [ Safe ]"). */
+val Mono: FontFamily = FontFamily.Monospace
@Composable
-fun SystemTheme(content: @Composable () -> Unit) =
- MaterialTheme(colorScheme = colours, typography = typography, content = content)
+fun SystemTheme(content: @Composable () -> Unit) = DoughminationTheme(content)
diff --git a/plural/app/src/main/res/drawable-nodpi/background.webp b/plural/app/src/main/res/drawable-nodpi/background.webp
deleted file mode 100644
index 1f56761..0000000
Binary files a/plural/app/src/main/res/drawable-nodpi/background.webp and /dev/null differ
diff --git a/plural/app/src/main/res/font/ibm_plex_sans_bold.ttf b/plural/app/src/main/res/font/ibm_plex_sans_bold.ttf
deleted file mode 100644
index c864a80..0000000
Binary files a/plural/app/src/main/res/font/ibm_plex_sans_bold.ttf and /dev/null differ
diff --git a/plural/app/src/main/res/font/ibm_plex_sans_medium.ttf b/plural/app/src/main/res/font/ibm_plex_sans_medium.ttf
deleted file mode 100644
index 94738b8..0000000
Binary files a/plural/app/src/main/res/font/ibm_plex_sans_medium.ttf and /dev/null differ
diff --git a/plural/app/src/main/res/font/ibm_plex_sans_regular.ttf b/plural/app/src/main/res/font/ibm_plex_sans_regular.ttf
deleted file mode 100644
index a4f4148..0000000
Binary files a/plural/app/src/main/res/font/ibm_plex_sans_regular.ttf and /dev/null differ
diff --git a/plural/app/src/main/res/font/ibm_plex_sans_semibold.ttf b/plural/app/src/main/res/font/ibm_plex_sans_semibold.ttf
deleted file mode 100644
index 454f3d4..0000000
Binary files a/plural/app/src/main/res/font/ibm_plex_sans_semibold.ttf and /dev/null differ
diff --git a/plural/app/src/main/res/values/themes.xml b/plural/app/src/main/res/values/themes.xml
index a411fb3..9ea317d 100644
--- a/plural/app/src/main/res/values/themes.xml
+++ b/plural/app/src/main/res/values/themes.xml
@@ -1,11 +1,5 @@
<resources>
- <!-- Compose draws everything; this only covers the window before it does,
- in the site's dark background so launching doesn't flash white. -->
- <style name="Theme.App" parent="android:Theme.Material.NoActionBar">
- <item name="android:windowBackground">@color/bg</item>
- <item name="android:statusBarColor">@android:color/transparent</item>
- <item name="android:navigationBarColor">@android:color/transparent</item>
- </style>
- <color name="bg">#0B0A0D</color>
+ <!-- The shared window theme (the :design module): dark, so launching doesn't flash white. -->
+ <style name="Theme.App" parent="Theme.Doughmination" />
<color name="ic_launcher_background">#0B0A0D</color>
</resources>
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ef9e6af..fcc921a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -16,9 +16,10 @@ dependencyResolutionManagement {
rootProject.name = "doughmination-apps"
-// Each app is its own Android application module. They share this build and
-// the version catalog, never each other's code.
+// Each app is its own Android application module. They share this build, the
+// version catalog and the look (:design), never each other's code.
include(
+ ":design", // the shared theme: palette, fonts, backdrop
":api-helper:app", // Device Reporter
":email:app", // Inbox
":doughmination-manager:app", // Doughmination Manager