diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..5be2303
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,21 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 4
+
+[*.{kt,kts}]
+ktlint_code_style = android_studio
+ktlint_function_naming_ignore_when_annotated_with = Composable
+ij_kotlin_allow_trailing_comma = true
+ij_kotlin_allow_trailing_comma_on_call_site = true
+max_line_length = 120
+# Leave short signatures one parameter per line, with a trailing comma.
+ktlint_standard_class-signature = disabled
+ktlint_standard_function-signature = disabled
+
+[*.{yml,yaml,json,toml}]
+indent_size = 2
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..be3353d
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,15 @@
+version: 2
+updates:
+ - package-ecosystem: gradle
+ directory: /
+ schedule:
+ interval: weekly
+ groups:
+ androidx:
+ patterns: ["androidx.*"]
+ kotlin:
+ patterns: ["org.jetbrains.kotlin*", "org.jetbrains.kotlinx*"]
+ - package-ecosystem: github-actions
+ directory: /
+ schedule:
+ interval: weekly
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..a6ba2be
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,35 @@
+name: Build
+
+on:
+ pull_request:
+ push:
+ branches: [main]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ - uses: gradle/actions/wrapper-validation@v6
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: 21
+ - uses: gradle/actions/setup-gradle@v6
+ - name: Lint, test and build both flavours
+ run: ./gradlew ktlintCheck lintFossDebug lintPlayDebug testFossDebugUnitTest testPlayDebugUnitTest assembleDebug
+ - name: Upload debug builds
+ uses: actions/upload-artifact@v7
+ with:
+ name: debug-apks
+ path: app/build/outputs/apk/*/debug/*.apk
+ retention-days: 14
+ - name: Upload reports
+ if: failure()
+ uses: actions/upload-artifact@v7
+ with:
+ name: reports
+ path: app/build/reports/
diff --git a/.gitignore b/.gitignore
index b7fb64c..59087cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,26 @@ google-services.json
# Android Profiling
*.hprof
+
+# Signing: release keys and their passwords must never be committed
+keystore.properties
+signing.properties
+*.p12
+*.pk8
+*.pem
+
+# Google Play upload credentials (service account keys)
+play-service-account*.json
+service-account*.json
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots/**/*.png
+
+# Kotlin and Gradle caches
+.kotlin/
+/app/release/
+
+# OS and editor clutter
+.DS_Store
+Thumbs.db
+*.swp
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..0616fd1
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,15 @@
+Growstuff for Android
+Copyright the Growstuff contributors
+Licensed under the GNU Affero General Public License v3.0 or later. See LICENSE.
+
+This app includes the following third-party material.
+
+Fonts, under the SIL Open Font License 1.1 (text in licenses/):
+- Raleway, copyright 2010 The Raleway Project Authors
+- Modak, copyright 2015 Ek Type
+
+Libraries, under the Apache License 2.0:
+- AndroidX and Jetpack Compose, copyright The Android Open Source Project
+- Kotlin, kotlinx.coroutines and kotlinx.serialization, copyright JetBrains s.r.o. and Kotlin contributors
+
+Test libraries (not shipped): JUnit 4, under the Eclipse Public License 1.0.
diff --git a/README.md b/README.md
index bf8268a..1a417f4 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
# growstuff-android
-experimental android version
+
+The Growstuff app for Android phones and tablets, in Kotlin and Jetpack Compose. It is early and experimental. The plan is in the roadmap issue (#13), and the decisions behind it are in [docs/adr](docs/adr/).
## Designed for low vision
@@ -10,3 +11,45 @@ The app's designs are optimised for people with low vision, and for anyone using
- Large type, and large tap targets: the main controls are at least 56px tall.
- Short, plain labels, with actions in capitals.
- It must work with Android's font scaling and with TalkBack.
+
+## What works so far
+
+Sign in, home, my jobs (tick off with undo, add a job) and my gardens. On a tablet, home and the chosen area sit side by side.
+
+The app can't talk to growstuff.org yet: signing in needs OAuth on the server (#2). Until then every repository is a fake that reads JSON:API documents from [app/src/main/assets/fixtures](app/src/main/assets/fixtures/), written in the same shape as the real `/api/v1` responses. The fixture dates are moved so that the fixtures' "today" (24 October 2026) is today on the phone. Changes, such as ticking off a job, last until the app is closed.
+
+The fixtures include some things the API doesn't serve yet:
+
+- a signed-in member (there is no "who am I" endpoint)
+- a garden's `location`, `area` and `area_unit`
+- a job's `finished_at`
+- job ideas (suggested jobs)
+
+## Building
+
+You need JDK 21 (Gradle downloads it if it's missing) and the Android SDK, which Android Studio installs for you. Without Android Studio, install the command-line tools and set `ANDROID_HOME`, or put `sdk.dir=/path/to/sdk` in `local.properties`.
+
+There are two flavours. `play` may use Google services, such as Firebase for push notifications, and `foss` has no proprietary code. Today they are the same.
+
+```sh
+./gradlew assembleFossDebug # build a debug APK
+./gradlew installFossDebug # build and install on a connected phone
+./gradlew testFossDebugUnitTest # unit tests
+./gradlew ktlintCheck # code style (ktlintFormat fixes most of it)
+./gradlew lintFossDebug # Android lint
+```
+
+The debug app is installed as `org.growstuff.android.debug`, so it sits beside a release build.
+
+### Running on your phone
+
+1. On the phone, open Settings, About phone, and tap Build number seven times to turn on developer options.
+2. In Settings, System, Developer options, turn on USB debugging.
+3. Plug the phone in and accept the prompt on the phone.
+4. Check it is there with `adb devices`, then run `./gradlew installFossDebug`.
+
+In Android Studio, pick the phone in the device menu and press Run.
+
+## Licence
+
+AGPL-3.0-or-later, the same as the Growstuff website. See [LICENSE](LICENSE), and [NOTICE](NOTICE) for third-party material. Every source file starts with an SPDX licence line. Google Play's app signing means Google holds the release signing key; you can still build and install your own copy.
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 0000000..05a237f
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+plugins {
+ alias(libs.plugins.android.application)
+ alias(libs.plugins.kotlin.compose)
+ alias(libs.plugins.kotlin.serialization)
+ alias(libs.plugins.ktlint)
+}
+
+kotlin {
+ jvmToolchain(21)
+}
+
+android {
+ namespace = "org.growstuff.android"
+ compileSdk = 37
+
+ defaultConfig {
+ applicationId = "org.growstuff.android"
+ minSdk = 26
+ targetSdk = 37
+ versionCode = 1
+ versionName = "0.1.0"
+ }
+
+ // play may use Google services (such as Firebase push); foss has no proprietary code.
+ flavorDimensions += "distribution"
+ productFlavors {
+ create("play") {
+ dimension = "distribution"
+ }
+ create("foss") {
+ dimension = "distribution"
+ }
+ }
+
+ buildTypes {
+ debug {
+ applicationIdSuffix = ".debug"
+ }
+ release {
+ isMinifyEnabled = true
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro",
+ )
+ }
+ }
+
+ buildFeatures {
+ compose = true
+ }
+
+ testOptions {
+ unitTests.isReturnDefaultValues = true
+ }
+}
+
+dependencies {
+ implementation(libs.androidx.core.ktx)
+ implementation(libs.androidx.activity.compose)
+ implementation(libs.androidx.lifecycle.runtime.compose)
+ implementation(libs.androidx.lifecycle.viewmodel.compose)
+ implementation(libs.androidx.navigation.compose)
+ implementation(platform(libs.compose.bom))
+ implementation(libs.compose.ui)
+ implementation(libs.compose.ui.tooling.preview)
+ implementation(libs.compose.material3)
+ implementation(libs.compose.material3.adaptive)
+ implementation(libs.kotlinx.serialization.json)
+ debugImplementation(libs.compose.ui.tooling)
+
+ testImplementation(libs.junit)
+ testImplementation(libs.kotlinx.coroutines.test)
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..abc7479
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,5 @@
+# Keep kotlinx.serialization generated serializers.
+-keepclassmembers @kotlinx.serialization.Serializable class ** {
+ *** Companion;
+ kotlinx.serialization.KSerializer serializer(...);
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..56bdcb5
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/assets/fixtures/gardens.json b/app/src/main/assets/fixtures/gardens.json
new file mode 100644
index 0000000..ca88498
--- /dev/null
+++ b/app/src/main/assets/fixtures/gardens.json
@@ -0,0 +1,42 @@
+{
+ "data": [
+ {
+ "type": "gardens",
+ "id": "1",
+ "attributes": { "name": "Bed 2, the sunny one", "location": "Backyard", "area": 6, "area_unit": "square metre" },
+ "relationships": {
+ "owner": { "data": { "type": "members", "id": "1" } },
+ "plantings": { "data": [{ "type": "plantings", "id": "11" }, { "type": "plantings", "id": "12" }, { "type": "plantings", "id": "13" }] }
+ }
+ },
+ {
+ "type": "gardens",
+ "id": "2",
+ "attributes": { "name": "Bed 1, the herb bed", "location": "Backyard", "area": 3, "area_unit": "square metre" },
+ "relationships": {
+ "owner": { "data": { "type": "members", "id": "1" } },
+ "plantings": { "data": [{ "type": "plantings", "id": "21" }, { "type": "plantings", "id": "22" }, { "type": "plantings", "id": "23" }, { "type": "plantings", "id": "24" }, { "type": "plantings", "id": "25" }] }
+ }
+ },
+ {
+ "type": "gardens",
+ "id": "3",
+ "attributes": { "name": "Bed 3, by the fence", "location": "Backyard", "area": 4, "area_unit": "square metre" },
+ "relationships": {
+ "owner": { "data": { "type": "members", "id": "1" } },
+ "plantings": { "data": [{ "type": "plantings", "id": "31" }] }
+ }
+ }
+ ],
+ "included": [
+ { "type": "plantings", "id": "11", "attributes": { "crop_name": "sunflower", "planted_at": "2026-09-20", "finished": false, "first_harvest_date": "2027-01-15" } },
+ { "type": "plantings", "id": "12", "attributes": { "crop_name": "carrot", "planted_at": "2026-08-01", "finished": false, "first_harvest_date": "2026-10-25" } },
+ { "type": "plantings", "id": "13", "attributes": { "crop_name": "strawberry", "planted_at": "2026-06-10", "finished": false, "first_harvest_date": "2026-10-18" } },
+ { "type": "plantings", "id": "21", "attributes": { "crop_name": "basil", "planted_at": "2026-09-01", "finished": false, "first_harvest_date": "2026-11-10" } },
+ { "type": "plantings", "id": "22", "attributes": { "crop_name": "parsley", "planted_at": "2026-09-01", "finished": false, "first_harvest_date": "2026-11-20" } },
+ { "type": "plantings", "id": "23", "attributes": { "crop_name": "thyme", "planted_at": "2026-04-01", "finished": false, "first_harvest_date": null } },
+ { "type": "plantings", "id": "24", "attributes": { "crop_name": "mint", "planted_at": "2026-04-01", "finished": false, "first_harvest_date": null } },
+ { "type": "plantings", "id": "25", "attributes": { "crop_name": "coriander", "planted_at": "2026-03-01", "finished": true, "first_harvest_date": "2026-04-20" } },
+ { "type": "plantings", "id": "31", "attributes": { "crop_name": "potato", "planted_at": "2026-03-01", "finished": true, "first_harvest_date": "2026-06-20" } }
+ ]
+}
diff --git a/app/src/main/assets/fixtures/job_ideas.json b/app/src/main/assets/fixtures/job_ideas.json
new file mode 100644
index 0000000..c7ecfdd
--- /dev/null
+++ b/app/src/main/assets/fixtures/job_ideas.json
@@ -0,0 +1,11 @@
+{
+ "data": [
+ { "type": "job_ideas", "id": "1", "attributes": { "name": "Earth up the potatoes" } },
+ { "type": "job_ideas", "id": "2", "attributes": { "name": "Pinch out the basil" } },
+ { "type": "job_ideas", "id": "3", "attributes": { "name": "Thin the carrots" } },
+ { "type": "job_ideas", "id": "4", "attributes": { "name": "Feed the strawberries" } },
+ { "type": "job_ideas", "id": "5", "attributes": { "name": "Sow more coriander" } },
+ { "type": "job_ideas", "id": "6", "attributes": { "name": "Stake the sunflowers" } },
+ { "type": "job_ideas", "id": "7", "attributes": { "name": "Check for slugs" } }
+ ]
+}
diff --git a/app/src/main/assets/fixtures/jobs.json b/app/src/main/assets/fixtures/jobs.json
new file mode 100644
index 0000000..9b2744f
--- /dev/null
+++ b/app/src/main/assets/fixtures/jobs.json
@@ -0,0 +1,50 @@
+{
+ "data": [
+ {
+ "type": "jobs", "id": "1",
+ "attributes": { "name": "Fix the hose tap", "due_date": "2026-10-20", "finished": false, "finished_at": null, "jobbable_type": null, "jobbable_id": null },
+ "relationships": { "garden": { "data": null } }
+ },
+ {
+ "type": "jobs", "id": "2",
+ "attributes": { "name": "Plant out the sunflowers", "due_date": "2026-10-24", "finished": false, "finished_at": null, "jobbable_type": "Planting", "jobbable_id": 11 },
+ "relationships": { "garden": { "data": { "type": "gardens", "id": "1" } } }
+ },
+ {
+ "type": "jobs", "id": "3",
+ "attributes": { "name": "Sharpen the secateurs", "due_date": "2026-10-24", "finished": false, "finished_at": null, "jobbable_type": null, "jobbable_id": null },
+ "relationships": { "garden": { "data": null } }
+ },
+ {
+ "type": "jobs", "id": "4",
+ "attributes": { "name": "Harvest the carrots", "due_date": "2026-10-25", "finished": false, "finished_at": null, "jobbable_type": "Planting", "jobbable_id": 12 },
+ "relationships": { "garden": { "data": { "type": "gardens", "id": "1" } } }
+ },
+ {
+ "type": "jobs", "id": "5",
+ "attributes": { "name": "Order more compost", "due_date": null, "finished": false, "finished_at": null, "jobbable_type": null, "jobbable_id": null },
+ "relationships": { "garden": { "data": null } }
+ },
+ {
+ "type": "jobs", "id": "6",
+ "attributes": { "name": "Net the strawberries", "due_date": "2026-10-23", "finished": true, "finished_at": "2026-10-23T09:12:00Z", "jobbable_type": "Garden", "jobbable_id": 1 },
+ "relationships": { "garden": { "data": { "type": "gardens", "id": "1" } } }
+ },
+ {
+ "type": "jobs", "id": "7",
+ "attributes": { "name": "Sow the broad beans", "due_date": "2026-10-21", "finished": true, "finished_at": "2026-10-21T16:40:00Z", "jobbable_type": "Seed", "jobbable_id": 41 },
+ "relationships": { "garden": { "data": null } }
+ },
+ {
+ "type": "jobs", "id": "8",
+ "attributes": { "name": "Order seeds", "due_date": null, "finished": true, "finished_at": "2026-10-12T20:05:00Z", "jobbable_type": null, "jobbable_id": null },
+ "relationships": { "garden": { "data": null } }
+ }
+ ],
+ "included": [
+ { "type": "gardens", "id": "1", "attributes": { "name": "Bed 2, the sunny one" } },
+ { "type": "plantings", "id": "11", "attributes": { "crop_name": "sunflower" } },
+ { "type": "plantings", "id": "12", "attributes": { "crop_name": "carrot" } },
+ { "type": "seeds", "id": "41", "attributes": { "crop_name": "broad bean" } }
+ ]
+}
diff --git a/app/src/main/assets/fixtures/member.json b/app/src/main/assets/fixtures/member.json
new file mode 100644
index 0000000..4e4255d
--- /dev/null
+++ b/app/src/main/assets/fixtures/member.json
@@ -0,0 +1,9 @@
+{
+ "data": [
+ {
+ "type": "members",
+ "id": "1",
+ "attributes": { "login_name": "brenda", "slug": "brenda" }
+ }
+ ]
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/AppContainer.kt b/app/src/main/kotlin/org/growstuff/android/AppContainer.kt
new file mode 100644
index 0000000..55d30e6
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/AppContainer.kt
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android
+
+import android.content.Context
+import java.time.Clock
+import org.growstuff.android.data.GardensRepository
+import org.growstuff.android.data.JobsRepository
+import org.growstuff.android.data.SessionRepository
+import org.growstuff.android.data.fake.FakeGardensRepository
+import org.growstuff.android.data.fake.FakeJobsRepository
+import org.growstuff.android.data.fake.FakeSessionRepository
+import org.growstuff.android.data.fake.Fixtures
+
+/** Holds the app's repositories. Every one is a fake until the API can be signed in to (#2). */
+class AppContainer(context: Context) {
+ val clock: Clock = Clock.systemDefaultZone()
+
+ private val fixtures = Fixtures(
+ read = { name -> context.assets.open(name).bufferedReader().use { it.readText() } },
+ clock = clock,
+ )
+
+ val session: SessionRepository = FakeSessionRepository(fixtures)
+ val jobs: JobsRepository = FakeJobsRepository(fixtures)
+ val gardens: GardensRepository = FakeGardensRepository(fixtures)
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/GrowstuffApplication.kt b/app/src/main/kotlin/org/growstuff/android/GrowstuffApplication.kt
new file mode 100644
index 0000000..f825993
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/GrowstuffApplication.kt
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android
+
+import android.app.Application
+
+class GrowstuffApplication : Application() {
+ lateinit var container: AppContainer
+ private set
+
+ override fun onCreate() {
+ super.onCreate()
+ container = AppContainer(this)
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/MainActivity.kt b/app/src/main/kotlin/org/growstuff/android/MainActivity.kt
new file mode 100644
index 0000000..b030129
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/MainActivity.kt
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android
+
+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 org.growstuff.android.ui.GrowstuffApp
+import org.growstuff.android.ui.theme.GrowstuffTheme
+
+class MainActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ // Light icons on the brown top bar, dark icons over the white bottom of each screen.
+ enableEdgeToEdge(
+ statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
+ navigationBarStyle = SystemBarStyle.light(Color.TRANSPARENT, Color.TRANSPARENT),
+ )
+ super.onCreate(savedInstanceState)
+ val container = (application as GrowstuffApplication).container
+ setContent {
+ GrowstuffTheme {
+ GrowstuffApp(container)
+ }
+ }
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/data/JsonApiMappers.kt b/app/src/main/kotlin/org/growstuff/android/data/JsonApiMappers.kt
new file mode 100644
index 0000000..3230983
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/data/JsonApiMappers.kt
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.data
+
+import java.time.LocalDate
+import org.growstuff.android.data.jsonapi.JsonApiDocument
+import org.growstuff.android.data.jsonapi.JsonApiResource
+import org.growstuff.android.data.jsonapi.ResourceIdentifier
+
+/** Gardens from GET /api/v1/gardens?include=plantings. */
+fun JsonApiDocument.toGardens(today: LocalDate): List = data.map { garden ->
+ val growing = garden.many("plantings")
+ .mapNotNull { findIncluded(it) }
+ .filter { it.boolean("finished") != true }
+ Garden(
+ id = garden.id,
+ name = garden.string("name").orEmpty(),
+ location = garden.string("location"),
+ area = garden.double("area"),
+ areaUnit = garden.string("area_unit"),
+ growingCount = growing.size,
+ readyToHarvestCount = growing.count { planting ->
+ planting.date("first_harvest_date")?.let { !it.isAfter(today) } == true
+ },
+ )
+}
+
+/** Jobs from GET /api/v1/jobs?include=garden, with the planting or seed each job is about in `included`. */
+fun JsonApiDocument.toJobs(): List = data.map { job ->
+ Job(
+ id = job.id,
+ name = job.string("name").orEmpty(),
+ dueDate = job.date("due_date"),
+ finished = job.boolean("finished") == true,
+ finishedOn = job.date("finished_at"),
+ link = linkFor(job),
+ )
+}
+
+private fun JsonApiDocument.linkFor(job: JsonApiResource): JobLink? {
+ val garden = job.one("garden")?.let { findIncluded(it) }
+ val jobbableId = job.string("jobbable_id")
+ return when (job.string("jobbable_type")) {
+ "Planting" -> jobbableId?.let { findIncluded(ResourceIdentifier("plantings", it)) }?.let { planting ->
+ JobLink(JobLink.Kind.Planting, planting.string("crop_name").orEmpty(), garden?.string("name"))
+ }
+ "Seed" -> jobbableId?.let { findIncluded(ResourceIdentifier("seeds", it)) }?.let { seed ->
+ JobLink(JobLink.Kind.Seeds, seed.string("crop_name").orEmpty(), null)
+ }
+ else -> garden?.let { JobLink(JobLink.Kind.Garden, it.string("name").orEmpty(), null) }
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/data/Models.kt b/app/src/main/kotlin/org/growstuff/android/data/Models.kt
new file mode 100644
index 0000000..b9b0e8f
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/data/Models.kt
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.data
+
+import java.time.LocalDate
+
+data class Member(
+ val id: String,
+ val loginName: String,
+)
+
+data class Garden(
+ val id: String,
+ val name: String,
+ val location: String?,
+ val area: Double?,
+ val areaUnit: String?,
+ val growingCount: Int,
+ val readyToHarvestCount: Int,
+)
+
+data class Job(
+ val id: String,
+ val name: String,
+ val dueDate: LocalDate?,
+ val finished: Boolean,
+ val finishedOn: LocalDate?,
+ val link: JobLink?,
+)
+
+/** What a job is about: a planting, a garden, or some seeds. */
+data class JobLink(
+ val kind: Kind,
+ val name: String,
+ val gardenName: String?,
+) {
+ enum class Kind { Planting, Garden, Seeds }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/data/Repositories.kt b/app/src/main/kotlin/org/growstuff/android/data/Repositories.kt
new file mode 100644
index 0000000..eba28fb
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/data/Repositories.kt
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.data
+
+import kotlinx.coroutines.flow.StateFlow
+
+interface SessionRepository {
+ /** The signed-in member, or null when nobody is signed in. */
+ val member: StateFlow
+
+ suspend fun signIn()
+
+ suspend fun signOut()
+}
+
+interface JobsRepository {
+ val jobs: StateFlow>
+
+ /** How many suggested jobs there are for this week. */
+ val ideaCount: StateFlow
+
+ suspend fun setFinished(id: String, finished: Boolean)
+
+ suspend fun add(name: String)
+}
+
+interface GardensRepository {
+ val gardens: StateFlow>
+
+ suspend fun refresh()
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/data/fake/FakeRepositories.kt b/app/src/main/kotlin/org/growstuff/android/data/fake/FakeRepositories.kt
new file mode 100644
index 0000000..b525ffd
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/data/fake/FakeRepositories.kt
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.data.fake
+
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.update
+import org.growstuff.android.data.GardensRepository
+import org.growstuff.android.data.Job
+import org.growstuff.android.data.JobsRepository
+import org.growstuff.android.data.Member
+import org.growstuff.android.data.SessionRepository
+import org.growstuff.android.data.toGardens
+import org.growstuff.android.data.toJobs
+
+/** Signs in without the website: there is no OAuth on the server yet. */
+class FakeSessionRepository(private val fixtures: Fixtures) : SessionRepository {
+ override val member = MutableStateFlow(null)
+
+ override suspend fun signIn() {
+ val resource = fixtures.document("member").data.first()
+ member.value = Member(id = resource.id, loginName = resource.string("login_name").orEmpty())
+ }
+
+ override suspend fun signOut() {
+ member.value = null
+ }
+}
+
+/** Jobs from the fixtures, kept in memory, so ticking off and adding work until the app is closed. */
+class FakeJobsRepository(private val fixtures: Fixtures) : JobsRepository {
+ override val jobs: MutableStateFlow> = MutableStateFlow(
+ fixtures.document("jobs").toJobs().map {
+ it.copy(dueDate = fixtures.shift(it.dueDate), finishedOn = fixtures.shift(it.finishedOn))
+ },
+ )
+
+ override val ideaCount: StateFlow = MutableStateFlow(fixtures.document("job_ideas").data.size)
+
+ override suspend fun setFinished(id: String, finished: Boolean) {
+ jobs.update { all ->
+ all.map {
+ if (it.id == id) it.copy(finished = finished, finishedOn = fixtures.today().takeIf { finished }) else it
+ }
+ }
+ }
+
+ override suspend fun add(name: String) {
+ jobs.update { all ->
+ val id = "new-${all.size + 1}"
+ all + Job(id = id, name = name, dueDate = null, finished = false, finishedOn = null, link = null)
+ }
+ }
+}
+
+class FakeGardensRepository(private val fixtures: Fixtures) : GardensRepository {
+ override val gardens = MutableStateFlow(load())
+
+ override suspend fun refresh() {
+ // Long enough to see the pull-to-refresh indicator.
+ delay(600)
+ gardens.value = load()
+ }
+
+ private fun load() = fixtures.document("gardens").toGardens(today = Fixtures.FIXTURE_DAY)
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/data/fake/Fixtures.kt b/app/src/main/kotlin/org/growstuff/android/data/fake/Fixtures.kt
new file mode 100644
index 0000000..53b7965
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/data/fake/Fixtures.kt
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.data.fake
+
+import java.time.Clock
+import java.time.LocalDate
+import java.time.temporal.ChronoUnit
+import org.growstuff.android.data.jsonapi.JsonApiDocument
+
+/**
+ * Canned API responses for endpoints the app can't call yet, kept in `assets/fixtures`.
+ *
+ * The fixtures are written as if today were [FIXTURE_DAY]; [shift] moves their dates
+ * so that "today" in the fixtures is today on the phone.
+ */
+class Fixtures(
+ private val read: (name: String) -> String,
+ private val clock: Clock,
+) {
+ fun document(name: String): JsonApiDocument = JsonApiDocument.parse(read("fixtures/$name.json"))
+
+ fun today(): LocalDate = LocalDate.now(clock)
+
+ fun shift(date: LocalDate?): LocalDate? = date?.plusDays(ChronoUnit.DAYS.between(FIXTURE_DAY, today()))
+
+ companion object {
+ val FIXTURE_DAY: LocalDate = LocalDate.of(2026, 10, 24)
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/data/jsonapi/JsonApi.kt b/app/src/main/kotlin/org/growstuff/android/data/jsonapi/JsonApi.kt
new file mode 100644
index 0000000..2639233
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/data/jsonapi/JsonApi.kt
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.data.jsonapi
+
+import java.time.LocalDate
+import java.time.OffsetDateTime
+import kotlinx.serialization.Serializable
+import kotlinx.serialization.json.Json
+import kotlinx.serialization.json.JsonArray
+import kotlinx.serialization.json.JsonElement
+import kotlinx.serialization.json.JsonNull
+import kotlinx.serialization.json.JsonObject
+import kotlinx.serialization.json.booleanOrNull
+import kotlinx.serialization.json.contentOrNull
+import kotlinx.serialization.json.doubleOrNull
+import kotlinx.serialization.json.jsonObject
+import kotlinx.serialization.json.jsonPrimitive
+
+/** A JSON:API document, as served by the Growstuff API under /api/v1. */
+@Serializable
+data class JsonApiDocument(
+ val data: List,
+ val included: List = emptyList(),
+) {
+ fun findIncluded(identifier: ResourceIdentifier): JsonApiResource? =
+ included.find { it.type == identifier.type && it.id == identifier.id }
+
+ companion object {
+ val json = Json { ignoreUnknownKeys = true }
+
+ fun parse(text: String): JsonApiDocument = json.decodeFromString(serializer(), text)
+ }
+}
+
+@Serializable
+data class JsonApiResource(
+ val type: String,
+ val id: String,
+ val attributes: JsonObject = JsonObject(emptyMap()),
+ val relationships: Map = emptyMap(),
+) {
+ fun string(name: String): String? = attribute(name)?.jsonPrimitive?.contentOrNull
+
+ fun boolean(name: String): Boolean? = attribute(name)?.jsonPrimitive?.booleanOrNull
+
+ fun double(name: String): Double? = attribute(name)?.jsonPrimitive?.doubleOrNull
+
+ /** Reads a date attribute, which the API sends either as a date or as a timestamp. */
+ fun date(name: String): LocalDate? {
+ val value = string(name) ?: return null
+ return if (value.length == 10) LocalDate.parse(value) else OffsetDateTime.parse(value).toLocalDate()
+ }
+
+ fun one(name: String): ResourceIdentifier? = relationships[name]?.identifiers()?.firstOrNull()
+
+ fun many(name: String): List = relationships[name]?.identifiers().orEmpty()
+
+ private fun attribute(name: String): JsonElement? = attributes[name]?.takeUnless { it is JsonNull }
+}
+
+@Serializable
+data class JsonApiRelationship(
+ val data: JsonElement? = null,
+) {
+ fun identifiers(): List = when (val linkage = data) {
+ is JsonArray -> linkage.map { it.toIdentifier() }
+ is JsonObject -> listOf(linkage.toIdentifier())
+ else -> emptyList()
+ }
+
+ private fun JsonElement.toIdentifier(): ResourceIdentifier {
+ val fields = jsonObject
+ return ResourceIdentifier(
+ type = fields.getValue("type").jsonPrimitive.content,
+ id = fields.getValue("id").jsonPrimitive.content,
+ )
+ }
+}
+
+data class ResourceIdentifier(
+ val type: String,
+ val id: String,
+)
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/GrowstuffApp.kt b/app/src/main/kotlin/org/growstuff/android/ui/GrowstuffApp.kt
new file mode 100644
index 0000000..230eaf5
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/GrowstuffApp.kt
@@ -0,0 +1,149 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui
+
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.widthIn
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.material3.adaptive.currentWindowAdaptiveInfoV2
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.unit.dp
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import androidx.lifecycle.viewmodel.compose.viewModel
+import androidx.lifecycle.viewmodel.initializer
+import androidx.lifecycle.viewmodel.viewModelFactory
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import androidx.navigation.compose.rememberNavController
+import androidx.window.core.layout.WindowSizeClass
+import kotlinx.coroutines.launch
+import kotlinx.serialization.Serializable
+import org.growstuff.android.AppContainer
+import org.growstuff.android.R
+import org.growstuff.android.ui.components.VerticalRule
+import org.growstuff.android.ui.friends.FriendsScreen
+import org.growstuff.android.ui.gardens.GardensScreen
+import org.growstuff.android.ui.gardens.GardensViewModel
+import org.growstuff.android.ui.home.Area
+import org.growstuff.android.ui.home.HomeScreen
+import org.growstuff.android.ui.jobs.JobsScreen
+import org.growstuff.android.ui.jobs.JobsViewModel
+import org.growstuff.android.ui.signin.SignInScreen
+import org.growstuff.android.ui.theme.GrowstuffColors
+
+@Serializable private object SignInRoute
+
+@Serializable private object HomeRoute
+
+@Serializable private object GardensRoute
+
+@Serializable private object FriendsRoute
+
+@Serializable private object JobsRoute
+
+@Composable
+fun GrowstuffApp(container: AppContainer) {
+ val member by container.session.member.collectAsStateWithLifecycle()
+ val ideaCount by container.jobs.ideaCount.collectAsStateWithLifecycle()
+ val scope = rememberCoroutineScope()
+ val nav = rememberNavController()
+ // Two panes from medium width up: a tablet, or a big phone on its side.
+ val twoPanes = currentWindowAdaptiveInfoV2().windowSizeClass
+ .isWidthAtLeastBreakpoint(WindowSizeClass.WIDTH_DP_MEDIUM_LOWER_BOUND)
+
+ val area: @Composable (Area, (() -> Unit)?) -> Unit = { which, onBack ->
+ when (which) {
+ Area.Gardens -> GardensScreen(gardensViewModel(container), container.clock, onBack)
+ Area.Friends -> FriendsScreen(onBack)
+ Area.Jobs -> JobsScreen(jobsViewModel(container), onBack)
+ }
+ }
+
+ NavHost(nav, startDestination = if (member == null) SignInRoute else HomeRoute) {
+ composable {
+ SignInScreen(onSignIn = {
+ scope.launch {
+ container.session.signIn()
+ nav.navigate(HomeRoute) { popUpTo(SignInRoute) { inclusive = true } }
+ }
+ })
+ }
+ composable {
+ var selected by rememberSaveable { mutableStateOf(null) }
+ val home: @Composable (Modifier) -> Unit = { modifier ->
+ HomeScreen(
+ loginName = member?.loginName.orEmpty(),
+ hasIdeas = ideaCount > 0,
+ selected = selected.takeIf { twoPanes },
+ onOpen = { which ->
+ if (twoPanes) {
+ selected = which
+ } else {
+ nav.navigate(
+ when (which) {
+ Area.Gardens -> GardensRoute
+ Area.Friends -> FriendsRoute
+ Area.Jobs -> JobsRoute
+ },
+ )
+ }
+ },
+ onSignOut = {
+ scope.launch {
+ container.session.signOut()
+ nav.navigate(SignInRoute) { popUpTo(HomeRoute) { inclusive = true } }
+ }
+ },
+ modifier = modifier,
+ )
+ }
+ if (twoPanes) {
+ Row(Modifier.fillMaxSize()) {
+ home(Modifier.widthIn(max = 420.dp).weight(0.4f))
+ VerticalRule()
+ Box(Modifier.weight(0.6f)) {
+ selected?.let { area(it, null) } ?: PickAnArea()
+ }
+ }
+ } else {
+ home(Modifier)
+ }
+ }
+ composable { area(Area.Gardens) { nav.popBackStack() } }
+ composable { area(Area.Friends) { nav.popBackStack() } }
+ composable { area(Area.Jobs) { nav.popBackStack() } }
+ }
+}
+
+@Composable
+private fun PickAnArea() {
+ Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
+ Text(
+ stringResource(R.string.pick_an_area),
+ style = MaterialTheme.typography.bodyLarge,
+ color = GrowstuffColors.Black,
+ )
+ }
+}
+
+@Composable
+private fun jobsViewModel(container: AppContainer): JobsViewModel = viewModel(
+ factory = viewModelFactory { initializer { JobsViewModel(container.jobs, container.clock) } },
+)
+
+@Composable
+private fun gardensViewModel(container: AppContainer): GardensViewModel = viewModel(
+ factory = viewModelFactory {
+ initializer { GardensViewModel(container.gardens, container.clock) }
+ },
+)
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/Links.kt b/app/src/main/kotlin/org/growstuff/android/ui/Links.kt
new file mode 100644
index 0000000..f77ba69
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/Links.kt
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui
+
+/** Pages on the website, for things the app leaves to it. */
+object Links {
+ private const val SITE = "https://www.growstuff.org"
+
+ const val SIGN_UP = "$SITE/members/sign_up"
+ const val PRIVACY = "$SITE/policy/privacy"
+ const val JOB_IDEAS = "$SITE/job_ideas"
+ const val NEW_GARDEN = "$SITE/gardens/new"
+ const val SOURCE = "https://github.com/Growstuff/growstuff-android"
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/components/Blocks.kt b/app/src/main/kotlin/org/growstuff/android/ui/components/Blocks.kt
new file mode 100644
index 0000000..fcde5be
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/components/Blocks.kt
@@ -0,0 +1,215 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.components
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+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.IntrinsicSize
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.RowScope
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxHeight
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.statusBarsPadding
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.selection.selectable
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.RectangleShape
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.heading
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import org.growstuff.android.R
+import org.growstuff.android.ui.theme.GrowstuffColors
+import org.growstuff.android.ui.theme.MinTapTarget
+import org.growstuff.android.ui.theme.Modak
+import org.growstuff.android.ui.theme.Outline
+
+/** A black line across the screen, between blocks. */
+@Composable
+fun Rule(thickness: Dp = Outline) {
+ Box(Modifier.fillMaxWidth().height(thickness).background(GrowstuffColors.Black))
+}
+
+/** A black line down a row. The row needs `Modifier.height(IntrinsicSize.Min)`. */
+@Composable
+fun VerticalRule(thickness: Dp = Outline) {
+ Box(Modifier.fillMaxHeight().width(thickness).background(GrowstuffColors.Black))
+}
+
+fun Modifier.outlined(thickness: Dp = Outline) = border(thickness, GrowstuffColors.Black, RectangleShape)
+
+/** The brown bar along the top: the wordmark, or a back button and a title. */
+@Composable
+fun TopBar(
+ title: String? = null,
+ onBack: (() -> Unit)? = null,
+ actions: @Composable RowScope.() -> Unit = {},
+) {
+ Column(Modifier.background(GrowstuffColors.Brown).statusBarsPadding()) {
+ Row(Modifier.fillMaxWidth().height(IntrinsicSize.Min).heightIn(min = 68.dp)) {
+ if (onBack != null) {
+ Box(
+ Modifier
+ .width(68.dp)
+ .fillMaxHeight()
+ .clickable(onClickLabel = stringResource(R.string.back), role = Role.Button, onClick = onBack),
+ contentAlignment = Alignment.Center,
+ ) {
+ Icon(
+ GrowstuffIcons.Back,
+ stringResource(R.string.back),
+ Modifier.size(28.dp),
+ tint = GrowstuffColors.White,
+ )
+ }
+ VerticalRule()
+ }
+ if (title == null) {
+ Box(Modifier.fillMaxHeight().padding(horizontal = 18.dp), contentAlignment = Alignment.Center) {
+ Text(
+ stringResource(R.string.app_name),
+ fontFamily = Modak,
+ fontSize = 32.sp,
+ lineHeight = 32.sp,
+ color = GrowstuffColors.White,
+ modifier = Modifier.padding(top = 6.dp),
+ )
+ }
+ VerticalRule()
+ } else {
+ Text(
+ title.uppercase(),
+ style = MaterialTheme.typography.titleLarge,
+ color = GrowstuffColors.White,
+ modifier = Modifier
+ .align(Alignment.CenterVertically)
+ .padding(horizontal = 18.dp)
+ .semantics { heading() },
+ )
+ }
+ Spacer(Modifier.weight(1f))
+ actions()
+ }
+ Rule()
+ }
+}
+
+/** A big outlined button with a short label in capitals. */
+@Composable
+fun BlockButton(
+ text: String,
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ primary: Boolean = true,
+ icon: ImageVector? = null,
+ minHeight: Dp = 64.dp,
+) {
+ val content = if (primary) GrowstuffColors.White else GrowstuffColors.Black
+ Row(
+ modifier
+ .heightIn(min = minHeight)
+ .background(if (primary) GrowstuffColors.Green else GrowstuffColors.White)
+ .outlined()
+ .clickable(role = Role.Button, onClick = onClick)
+ .padding(horizontal = 16.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.CenterHorizontally),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Text(
+ text.uppercase(),
+ style = MaterialTheme.typography.labelLarge,
+ color = content,
+ textAlign = TextAlign.Center,
+ )
+ if (icon != null) Icon(icon, null, Modifier.size(24.dp), tint = content)
+ }
+}
+
+/** A full-width row that leads somewhere: an icon block, a title and a line, and a chevron. */
+@Composable
+fun AreaRow(
+ icon: ImageVector,
+ title: String,
+ body: String,
+ onClick: (() -> Unit)?,
+ modifier: Modifier = Modifier,
+ selected: Boolean = false,
+ iconBlockWidth: Dp = 112.dp,
+ iconBackground: Color = GrowstuffColors.Green,
+ iconTint: Color = GrowstuffColors.White,
+ extra: @Composable () -> Unit = {},
+) {
+ val select = onClick?.let { Modifier.selectable(selected, role = Role.Button, onClick = it) } ?: Modifier
+ Row(
+ modifier
+ .fillMaxWidth()
+ .height(IntrinsicSize.Min)
+ .background(GrowstuffColors.White)
+ .then(select),
+ ) {
+ Box(
+ Modifier.width(iconBlockWidth).fillMaxHeight().background(iconBackground),
+ contentAlignment = Alignment.Center,
+ ) {
+ Icon(icon, null, Modifier.size(iconBlockWidth * 0.5f), tint = iconTint)
+ }
+ VerticalRule()
+ Column(
+ Modifier.weight(1f).padding(16.dp).align(Alignment.CenterVertically),
+ verticalArrangement = Arrangement.spacedBy(6.dp),
+ ) {
+ Text(title, style = MaterialTheme.typography.headlineSmall)
+ Text(body, style = MaterialTheme.typography.bodyMedium)
+ extra()
+ }
+ if (onClick != null) {
+ VerticalRule()
+ Box(
+ Modifier
+ .width(MinTapTarget)
+ .fillMaxHeight()
+ .background(if (selected) GrowstuffColors.Green else GrowstuffColors.White),
+ contentAlignment = Alignment.Center,
+ ) {
+ Icon(
+ GrowstuffIcons.Chevron,
+ null,
+ Modifier.size(28.dp),
+ tint = if (selected) GrowstuffColors.White else GrowstuffColors.Black,
+ )
+ }
+ }
+ }
+}
+
+/** A small outlined label, such as "3 growing". */
+@Composable
+fun Tag(text: String, background: Color = GrowstuffColors.White, outline: Dp = 3.dp) {
+ Text(
+ text.uppercase(),
+ style = MaterialTheme.typography.labelSmall,
+ modifier = Modifier
+ .background(background)
+ .outlined(outline)
+ .padding(horizontal = 10.dp, vertical = 3.dp),
+ )
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/components/GrowstuffIcons.kt b/app/src/main/kotlin/org/growstuff/android/ui/components/GrowstuffIcons.kt
new file mode 100644
index 0000000..d3781da
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/components/GrowstuffIcons.kt
@@ -0,0 +1,70 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.components
+
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.SolidColor
+import androidx.compose.ui.graphics.StrokeCap
+import androidx.compose.ui.graphics.StrokeJoin
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.graphics.vector.addPathNodes
+import androidx.compose.ui.unit.dp
+
+/** Stroke icons on a 24 unit grid, drawn to match the designs. They take the tint of the Icon. */
+object GrowstuffIcons {
+ val Arrow = stroke("arrow", 2.4f, "M4 12h16M14 6l6 6-6 6")
+ val Back = stroke("back", 2.6f, "M15 5l-7 7 7 7")
+ val Chevron = stroke("chevron", 2.6f, "M9 5l7 7-7 7")
+ val External = stroke(
+ "external",
+ 2.4f,
+ "M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5",
+ )
+ val Lock = stroke(
+ "lock",
+ 2.2f,
+ "M6 11h12a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1z",
+ "M8 11V8a4 4 0 0 1 8 0v3",
+ )
+ val Sprout =
+ stroke("sprout", 1.8f, "M12 19v-8M12 11c0-4-3-6-7-6 0 4 3 6 7 6zM12 13c0-3 2-5 6-5 0 3-2 5-6 5zM3 19.5h18")
+ val Friends = stroke(
+ "friends",
+ 1.8f,
+ circle(9f, 8f, 3.2f),
+ "M3 20c0-4 2.7-6.2 6-6.2s6 2.2 6 6.2",
+ circle(17.2f, 9f, 2.6f),
+ "M16.4 13.9c2.9 0 4.6 1.9 4.6 5.1",
+ )
+ val Jobs =
+ stroke(
+ "jobs",
+ 1.8f,
+ "M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z",
+ "M8 12.2l3 3 5-6.4",
+ )
+ val Resting = stroke("resting", 1.8f, "M3 17h18M5 21h14M9 14c0-1.4 1.3-2.5 3-2.5s3 1.1 3 2.5M12 11.5V9")
+ val Idea = stroke(
+ "idea",
+ 2f,
+ "M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z",
+ )
+ val Plus = stroke("plus", 2.8f, "M12 5v14M5 12h14")
+ val Tick = stroke("tick", 3.4f, "M5 12.5l5 5L19 7")
+ val SignOut = stroke("sign-out", 2.2f, "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9")
+
+ private fun circle(cx: Float, cy: Float, r: Float) =
+ "M${cx - r} ${cy}a$r $r 0 1 0 ${2 * r} 0a$r $r 0 1 0 ${-2 * r} 0z"
+
+ private fun stroke(name: String, width: Float, vararg paths: String): ImageVector =
+ ImageVector.Builder(name, 24.dp, 24.dp, 24f, 24f).apply {
+ paths.forEach {
+ addPath(
+ pathData = addPathNodes(it),
+ stroke = SolidColor(Color.Black),
+ strokeLineWidth = width,
+ strokeLineCap = StrokeCap.Round,
+ strokeLineJoin = StrokeJoin.Round,
+ )
+ }
+ }.build()
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/friends/FriendsScreen.kt b/app/src/main/kotlin/org/growstuff/android/ui/friends/FriendsScreen.kt
new file mode 100644
index 0000000..1e137f4
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/friends/FriendsScreen.kt
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.friends
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.unit.dp
+import org.growstuff.android.R
+import org.growstuff.android.ui.components.TopBar
+import org.growstuff.android.ui.theme.GrowstuffColors
+
+@Composable
+fun FriendsScreen(onBack: (() -> Unit)?) {
+ Column(Modifier.fillMaxSize().background(GrowstuffColors.White)) {
+ TopBar(title = stringResource(R.string.my_friends), onBack = onBack)
+ Column(Modifier.padding(28.dp)) {
+ Text(
+ stringResource(R.string.friends_coming),
+ style = MaterialTheme.typography.headlineSmall,
+ )
+ Text(
+ stringResource(R.string.friends_coming_body),
+ style = MaterialTheme.typography.bodyLarge,
+ modifier = Modifier.padding(top = 8.dp),
+ )
+ }
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/gardens/GardensScreen.kt b/app/src/main/kotlin/org/growstuff/android/ui/gardens/GardensScreen.kt
new file mode 100644
index 0000000..2ae9fed
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/gardens/GardensScreen.kt
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.gardens
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.navigationBarsPadding
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.material3.pulltorefresh.PullToRefreshBox
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.res.pluralStringResource
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import java.text.NumberFormat
+import java.time.Clock
+import java.time.Duration
+import java.time.Instant
+import kotlinx.coroutines.delay
+import org.growstuff.android.R
+import org.growstuff.android.data.Garden
+import org.growstuff.android.ui.Links
+import org.growstuff.android.ui.components.AreaRow
+import org.growstuff.android.ui.components.BlockButton
+import org.growstuff.android.ui.components.GrowstuffIcons
+import org.growstuff.android.ui.components.Rule
+import org.growstuff.android.ui.components.Tag
+import org.growstuff.android.ui.components.TopBar
+import org.growstuff.android.ui.theme.GrowstuffColors
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun GardensScreen(viewModel: GardensViewModel, clock: Clock, onBack: (() -> Unit)?) {
+ val state by viewModel.state.collectAsStateWithLifecycle()
+ val uriHandler = LocalUriHandler.current
+ Column(Modifier.fillMaxSize().background(GrowstuffColors.Beige)) {
+ TopBar(title = stringResource(R.string.my_gardens), onBack = onBack)
+ Text(
+ stringResource(R.string.last_watered, wateredAgo(state.refreshedAt, clock)),
+ style = MaterialTheme.typography.bodySmall,
+ fontWeight = FontWeight.SemiBold,
+ modifier = Modifier.fillMaxWidth().background(
+ GrowstuffColors.White,
+ ).padding(horizontal = 16.dp, vertical = 10.dp),
+ )
+ Rule()
+ PullToRefreshBox(
+ isRefreshing = state.refreshing,
+ onRefresh = viewModel::refresh,
+ modifier = Modifier.weight(1f).background(GrowstuffColors.White),
+ ) {
+ LazyColumn(Modifier.fillMaxSize()) {
+ items(state.gardens, key = { it.id }) { garden ->
+ GardenRow(garden)
+ Rule()
+ }
+ }
+ }
+ Rule()
+ BlockButton(
+ stringResource(R.string.add_a_garden),
+ onClick = { uriHandler.openUri(Links.NEW_GARDEN) },
+ icon = GrowstuffIcons.External,
+ minHeight = 60.dp,
+ modifier = Modifier.navigationBarsPadding().padding(12.dp).fillMaxWidth(),
+ )
+ }
+}
+
+@Composable
+private fun GardenRow(garden: Garden) {
+ val growing = garden.growingCount > 0
+ AreaRow(
+ icon = if (growing) GrowstuffIcons.Sprout else GrowstuffIcons.Resting,
+ title = garden.name,
+ body = listOfNotNull(garden.location, area(garden)).joinToString(" · "),
+ // A garden's own screen comes next; until then the row doesn't lead anywhere.
+ onClick = null,
+ iconBlockWidth = 88.dp,
+ iconBackground = if (growing) GrowstuffColors.Green else GrowstuffColors.Panel,
+ iconTint = if (growing) GrowstuffColors.White else GrowstuffColors.Soil,
+ modifier = Modifier.heightIn(min = 132.dp),
+ ) {
+ if (growing) {
+ FlowRow(
+ horizontalArrangement = Arrangement.spacedBy(6.dp),
+ verticalArrangement = Arrangement.spacedBy(6.dp),
+ ) {
+ Tag(
+ pluralStringResource(
+ R.plurals.growing,
+ garden.growingCount,
+ garden.growingCount,
+ ),
+ )
+ if (garden.readyToHarvestCount > 0) {
+ Tag(
+ pluralStringResource(
+ R.plurals.ready_to_harvest,
+ garden.readyToHarvestCount,
+ garden.readyToHarvestCount,
+ ),
+ GrowstuffColors.MemberChip,
+ )
+ }
+ }
+ } else {
+ Text(
+ stringResource(R.string.soil_resting),
+ style = MaterialTheme.typography.bodySmall,
+ fontWeight = FontWeight.SemiBold,
+ )
+ }
+ }
+}
+
+@Composable
+private fun area(garden: Garden): String? {
+ val size = garden.area ?: return null
+ val number = NumberFormat.getNumberInstance().format(size)
+ return when (garden.areaUnit) {
+ "square metre" -> stringResource(R.string.square_metres, number)
+ "square foot" -> stringResource(R.string.square_feet, number)
+ else -> listOfNotNull(number, garden.areaUnit).joinToString(" ")
+ }
+}
+
+/** "just now" or "3 minutes ago", kept up to date while the screen is open. */
+@Composable
+private fun wateredAgo(at: Instant, clock: Clock): String {
+ var now by remember { mutableStateOf(clock.instant()) }
+ LaunchedEffect(at) {
+ while (true) {
+ now = clock.instant()
+ delay(30_000)
+ }
+ }
+ val minutes = Duration.between(at, now).toMinutes().toInt()
+ return if (minutes <
+ 1
+ ) {
+ stringResource(R.string.just_now)
+ } else {
+ pluralStringResource(R.plurals.minutes_ago, minutes, minutes)
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/gardens/GardensViewModel.kt b/app/src/main/kotlin/org/growstuff/android/ui/gardens/GardensViewModel.kt
new file mode 100644
index 0000000..1f84f1d
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/gardens/GardensViewModel.kt
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.gardens
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import java.time.Clock
+import java.time.Instant
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.SharingStarted
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.combine
+import kotlinx.coroutines.flow.stateIn
+import kotlinx.coroutines.launch
+import org.growstuff.android.data.Garden
+import org.growstuff.android.data.GardensRepository
+
+data class GardensUiState(
+ val gardens: List = emptyList(),
+ val refreshing: Boolean = false,
+ val refreshedAt: Instant = Instant.EPOCH,
+)
+
+class GardensViewModel(private val repository: GardensRepository, private val clock: Clock) : ViewModel() {
+ private val refreshing = MutableStateFlow(false)
+ private val refreshedAt = MutableStateFlow(clock.instant())
+
+ val state: StateFlow = combine(
+ repository.gardens,
+ refreshing,
+ refreshedAt,
+ ::GardensUiState,
+ )
+ .stateIn(
+ viewModelScope,
+ SharingStarted.WhileSubscribed(5_000),
+ GardensUiState(refreshedAt = clock.instant()),
+ )
+
+ fun refresh() {
+ if (refreshing.value) return
+ viewModelScope.launch {
+ refreshing.value = true
+ try {
+ repository.refresh()
+ refreshedAt.value = clock.instant()
+ } finally {
+ refreshing.value = false
+ }
+ }
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/home/HomeScreen.kt b/app/src/main/kotlin/org/growstuff/android/ui/home/HomeScreen.kt
new file mode 100644
index 0000000..96ca7b3
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/home/HomeScreen.kt
@@ -0,0 +1,145 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.home
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+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.fillMaxHeight
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.navigationBarsPadding
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.heading
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.unit.dp
+import org.growstuff.android.R
+import org.growstuff.android.ui.components.AreaRow
+import org.growstuff.android.ui.components.GrowstuffIcons
+import org.growstuff.android.ui.components.Rule
+import org.growstuff.android.ui.components.Tag
+import org.growstuff.android.ui.components.TopBar
+import org.growstuff.android.ui.components.VerticalRule
+import org.growstuff.android.ui.theme.GrowstuffColors
+import org.growstuff.android.ui.theme.MinTapTarget
+
+/** The three parts of the app reached from home. */
+enum class Area { Gardens, Friends, Jobs }
+
+@Composable
+fun HomeScreen(
+ loginName: String,
+ hasIdeas: Boolean,
+ selected: Area?,
+ onOpen: (Area) -> Unit,
+ onSignOut: () -> Unit,
+ modifier: Modifier = Modifier,
+) {
+ Column(modifier.fillMaxSize().background(GrowstuffColors.White)) {
+ TopBar {
+ VerticalRule()
+ Box(Modifier.width(68.dp).fillMaxHeight(), contentAlignment = Alignment.Center) {
+ Avatar(loginName)
+ }
+ }
+ Column(Modifier.weight(1f).verticalScroll(rememberScrollState())) {
+ Column(Modifier.fillMaxWidth().background(GrowstuffColors.Green).padding(24.dp)) {
+ Text(
+ stringResource(R.string.hello, loginName),
+ style = MaterialTheme.typography.headlineLarge,
+ color = GrowstuffColors.White,
+ modifier = Modifier.semantics { heading() },
+ )
+ Text(
+ stringResource(R.string.hello_body),
+ style = MaterialTheme.typography.bodyLarge,
+ color = GrowstuffColors.White,
+ modifier = Modifier.padding(top = 10.dp),
+ )
+ }
+ Rule()
+ AreaRow(
+ GrowstuffIcons.Sprout,
+ stringResource(R.string.my_gardens).uppercase(),
+ stringResource(R.string.my_gardens_body),
+ onClick = { onOpen(Area.Gardens) },
+ selected = selected == Area.Gardens,
+ modifier = Modifier.heightIn(min = 150.dp),
+ )
+ Rule()
+ AreaRow(
+ GrowstuffIcons.Friends,
+ stringResource(R.string.my_friends).uppercase(),
+ stringResource(R.string.my_friends_body),
+ onClick = { onOpen(Area.Friends) },
+ selected = selected == Area.Friends,
+ modifier = Modifier.heightIn(min = 150.dp),
+ )
+ Rule()
+ AreaRow(
+ GrowstuffIcons.Jobs,
+ stringResource(R.string.my_jobs).uppercase(),
+ stringResource(R.string.my_jobs_body),
+ onClick = { onOpen(Area.Jobs) },
+ selected = selected == Area.Jobs,
+ modifier = Modifier.heightIn(min = 150.dp),
+ ) {
+ if (hasIdeas) {
+ Box(Modifier.padding(top = 4.dp)) {
+ Tag(stringResource(R.string.ideas_for_you), GrowstuffColors.IdeasYellow)
+ }
+ }
+ }
+ Rule()
+ }
+ Rule()
+ Row(
+ Modifier
+ .fillMaxWidth()
+ .navigationBarsPadding()
+ .heightIn(min = MinTapTarget)
+ .clickable(role = Role.Button, onClick = onSignOut),
+ horizontalArrangement = Arrangement.spacedBy(10.dp, Alignment.CenterHorizontally),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Icon(GrowstuffIcons.SignOut, null, Modifier.size(22.dp))
+ Text(
+ stringResource(R.string.sign_out).uppercase(),
+ style = MaterialTheme.typography.labelMedium,
+ )
+ }
+ }
+}
+
+@Composable
+private fun Avatar(loginName: String) {
+ val label = stringResource(R.string.account_label, loginName)
+ Box(
+ Modifier
+ .size(44.dp)
+ .background(GrowstuffColors.MemberChip, CircleShape)
+ .border(3.dp, GrowstuffColors.Black, CircleShape)
+ .semantics { contentDescription = label },
+ contentAlignment = Alignment.Center,
+ ) {
+ Text(loginName.take(1).uppercase(), style = MaterialTheme.typography.titleLarge)
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/jobs/FlowerBurst.kt b/app/src/main/kotlin/org/growstuff/android/ui/jobs/FlowerBurst.kt
new file mode 100644
index 0000000..82f1056
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/jobs/FlowerBurst.kt
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.jobs
+
+import android.provider.Settings
+import androidx.compose.animation.core.Animatable
+import androidx.compose.animation.core.FastOutSlowInEasing
+import androidx.compose.animation.core.LinearEasing
+import androidx.compose.animation.core.tween
+import androidx.compose.foundation.Canvas
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.drawscope.DrawScope
+import androidx.compose.ui.graphics.drawscope.Stroke
+import androidx.compose.ui.graphics.drawscope.rotate
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.unit.dp
+import kotlin.random.Random
+
+/** One burst of flowers from the tick box at [origin], in the overlay's own coordinates. */
+data class Burst(val origin: Offset, val key: Long)
+
+private data class Flower(
+ val color: Color,
+ val sizeDp: Float,
+ val dxDp: Float,
+ val dyDp: Float,
+ val rotation: Float,
+ val delay: Float,
+)
+
+private val petalColors = listOf(
+ Color(0xFFFFA500),
+ Color(0xFFE4A0A0),
+ Color(0xFFFFF3A8),
+ Color(0xFFC9A0DC),
+ Color(0xFFFF8A65),
+ Color(0xFFFFFFFF),
+)
+private val flowerMiddle = Color(0xFFC9A800)
+
+private const val FLIGHT_SECONDS = 1.4f
+private const val TOTAL_SECONDS = 1.9f
+
+/** True when the person has turned animations off in Android's settings. */
+@Composable
+fun animationsOff(): Boolean {
+ val resolver = LocalContext.current.contentResolver
+ return remember(resolver) {
+ Settings.Global.getFloat(resolver, Settings.Global.ANIMATOR_DURATION_SCALE, 1f) == 0f
+ }
+}
+
+/** Flowers bloom out of the tick box, drift up and fade, as on the website. */
+@Composable
+fun FlowerBurst(burst: Burst, onFinished: () -> Unit, modifier: Modifier = Modifier) {
+ val clock = remember(burst.key) { Animatable(0f) }
+ val flowers = remember(burst.key) {
+ List(10) { i ->
+ Flower(
+ color = petalColors[i % petalColors.size],
+ sizeDp = 20f + Random.nextFloat() * 18f,
+ dxDp = (Random.nextFloat() * 2 - 1) * 130f,
+ dyDp = -(50f + Random.nextFloat() * 130f),
+ rotation = (Random.nextFloat() * 2 - 1) * 200f,
+ delay = Random.nextFloat() * 0.25f,
+ )
+ }
+ }
+ LaunchedEffect(burst.key) {
+ clock.animateTo(TOTAL_SECONDS, tween((TOTAL_SECONDS * 1000).toInt(), easing = LinearEasing))
+ onFinished()
+ }
+ Canvas(modifier) {
+ flowers.forEach { flower ->
+ val t = ((clock.value - flower.delay) / FLIGHT_SECONDS).coerceIn(0f, 1f)
+ if (t <= 0f || t >= 1f) return@forEach
+ val eased = FastOutSlowInEasing.transform(t)
+ val alpha = when {
+ t < 0.15f -> t / 0.15f
+ t > 0.7f -> (1f - t) / 0.3f
+ else -> 1f
+ }
+ val centre =
+ burst.origin + Offset(flower.dxDp.dp.toPx() * eased, flower.dyDp.dp.toPx() * eased)
+ val unit = flower.sizeDp.dp.toPx() / 20f * (0.2f + 0.8f * eased)
+ rotate(flower.rotation * eased, centre) {
+ drawFlower(centre, unit, flower.color, alpha)
+ }
+ }
+ }
+}
+
+private fun DrawScope.drawFlower(centre: Offset, unit: Float, color: Color, alpha: Float) {
+ val outline = Stroke(width = 0.7f * unit)
+ repeat(5) { petal ->
+ rotate(petal * 72f, centre) {
+ val at = centre + Offset(0f, -5.2f * unit)
+ drawCircle(color, 3.9f * unit, at, alpha)
+ drawCircle(Color.Black, 3.9f * unit, at, alpha, outline)
+ }
+ }
+ drawCircle(flowerMiddle, 2.7f * unit, centre, alpha)
+ drawCircle(Color.Black, 2.7f * unit, centre, alpha, outline)
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobGroups.kt b/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobGroups.kt
new file mode 100644
index 0000000..365ca68
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobGroups.kt
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.jobs
+
+import java.time.LocalDate
+import org.growstuff.android.data.Job
+
+enum class JobGroupKind { Overdue, Today, ThisWeek, Later, SomeDay, Done }
+
+data class JobGroup(val kind: JobGroupKind, val jobs: List)
+
+/** Jobs still to do, by when they are due, soonest first. Empty groups are left out. */
+fun groupToDo(jobs: List, today: LocalDate): List {
+ val weekEnd = today.plusDays(7)
+ return jobs
+ .groupBy { job ->
+ val due = job.dueDate
+ when {
+ due == null -> JobGroupKind.SomeDay
+ due.isBefore(today) -> JobGroupKind.Overdue
+ due == today -> JobGroupKind.Today
+ !due.isAfter(weekEnd) -> JobGroupKind.ThisWeek
+ else -> JobGroupKind.Later
+ }
+ }
+ .map { (kind, grouped) ->
+ JobGroup(kind, grouped.sortedWith(compareBy(nullsLast()) { it.dueDate }))
+ }
+ .sortedBy { it.kind }
+}
+
+/** Jobs that are done, most recently done first. */
+fun groupDone(jobs: List): List = if (jobs.isEmpty()) {
+ emptyList()
+} else {
+ listOf(
+ JobGroup(
+ JobGroupKind.Done,
+ jobs.sortedWith(
+ compareByDescending(nullsFirst()) {
+ it.finishedOn
+ },
+ ),
+ ),
+ )
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobsScreen.kt b/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobsScreen.kt
new file mode 100644
index 0000000..618ba0a
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobsScreen.kt
@@ -0,0 +1,512 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.jobs
+
+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.IntrinsicSize
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.WindowInsets
+import androidx.compose.foundation.layout.fillMaxHeight
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.ime
+import androidx.compose.foundation.layout.navigationBars
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.union
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.layout.windowInsetsPadding
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.selection.selectable
+import androidx.compose.foundation.selection.toggleable
+import androidx.compose.foundation.text.BasicTextField
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateMapOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.layout.boundsInRoot
+import androidx.compose.ui.layout.onGloballyPositioned
+import androidx.compose.ui.layout.positionInRoot
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.res.pluralStringResource
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.LiveRegionMode
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.heading
+import androidx.compose.ui.semantics.liveRegion
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.text.SpanStyle
+import androidx.compose.ui.text.buildAnnotatedString
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.style.TextDecoration
+import androidx.compose.ui.text.withStyle
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoUnit
+import kotlinx.coroutines.delay
+import org.growstuff.android.R
+import org.growstuff.android.data.Job
+import org.growstuff.android.data.JobLink
+import org.growstuff.android.ui.Links
+import org.growstuff.android.ui.components.BlockButton
+import org.growstuff.android.ui.components.GrowstuffIcons
+import org.growstuff.android.ui.components.Rule
+import org.growstuff.android.ui.components.TopBar
+import org.growstuff.android.ui.components.VerticalRule
+import org.growstuff.android.ui.components.outlined
+import org.growstuff.android.ui.theme.GrowstuffColors
+import org.growstuff.android.ui.theme.MinTapTarget
+import org.growstuff.android.ui.theme.Raleway
+
+@Composable
+fun JobsScreen(viewModel: JobsViewModel, onBack: (() -> Unit)?) {
+ val state by viewModel.state.collectAsStateWithLifecycle()
+ val uriHandler = LocalUriHandler.current
+ val noAnimations = animationsOff()
+ var burst by remember { mutableStateOf(null) }
+ var overlayOrigin by remember { mutableStateOf(Offset.Zero) }
+ val tickCentres = remember { mutableStateMapOf() }
+
+ Box(Modifier.fillMaxSize().onGloballyPositioned { overlayOrigin = it.positionInRoot() }) {
+ Column(Modifier.fillMaxSize().background(GrowstuffColors.White)) {
+ TopBar(title = stringResource(R.string.my_jobs), onBack = onBack)
+ Tabs(state, viewModel::showTab)
+ Rule()
+ if (state.ideaCount > 0) {
+ IdeasBanner(state.ideaCount) { uriHandler.openUri(Links.JOB_IDEAS) }
+ Rule()
+ }
+ Box(Modifier.weight(1f)) {
+ JobList(
+ state = state,
+ onToggle = { job, centre ->
+ val crossingOff = !job.finished
+ viewModel.setFinished(job, crossingOff)
+ if (crossingOff && !noAnimations) {
+ burst = Burst(centre - overlayOrigin, System.nanoTime())
+ }
+ },
+ tickCentres = tickCentres,
+ )
+ state.crossedOff?.let { job ->
+ CrossedOffToast(
+ job = job,
+ onUndo = viewModel::undoCrossOff,
+ onTimeout = viewModel::dismissCrossOff,
+ modifier = Modifier.align(Alignment.BottomCenter).padding(12.dp),
+ )
+ }
+ }
+ Rule()
+ AddJobBar(viewModel::add)
+ }
+ burst?.let {
+ FlowerBurst(it, onFinished = { burst = null }, modifier = Modifier.fillMaxSize())
+ }
+ }
+}
+
+@Composable
+private fun Tabs(state: JobsUiState, onSelect: (JobsTab) -> Unit) {
+ Row(Modifier.fillMaxWidth().height(IntrinsicSize.Min)) {
+ Tab(
+ stringResource(R.string.jobs_to_do),
+ state.toDoCount,
+ state.tab == JobsTab.ToDo,
+ Modifier.weight(1f),
+ ) {
+ onSelect(JobsTab.ToDo)
+ }
+ VerticalRule()
+ Tab(
+ stringResource(R.string.jobs_done),
+ state.doneCount,
+ state.tab == JobsTab.Done,
+ Modifier.weight(1f),
+ ) {
+ onSelect(JobsTab.Done)
+ }
+ }
+}
+
+@Composable
+private fun Tab(label: String, count: Int, selected: Boolean, modifier: Modifier, onClick: () -> Unit) {
+ val description = stringResource(R.string.jobs_tab_label, label, count)
+ Row(
+ modifier
+ .heightIn(min = 60.dp)
+ .background(if (selected) GrowstuffColors.Green else GrowstuffColors.White)
+ .selectable(selected, role = Role.Tab, onClick = onClick)
+ .semantics(mergeDescendants = true) { contentDescription = description },
+ horizontalArrangement = Arrangement.spacedBy(10.dp, Alignment.CenterHorizontally),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Text(
+ label.uppercase(),
+ style = MaterialTheme.typography.labelMedium,
+ fontSize = 16.sp,
+ color = if (selected) GrowstuffColors.White else GrowstuffColors.Black,
+ )
+ Text(
+ count.toString(),
+ style = MaterialTheme.typography.labelMedium,
+ fontSize = 14.sp,
+ modifier = Modifier
+ .background(if (selected) GrowstuffColors.White else GrowstuffColors.Beige)
+ .outlined(3.dp)
+ .padding(horizontal = 8.dp, vertical = 2.dp),
+ )
+ }
+}
+
+@Composable
+private fun IdeasBanner(count: Int, onClick: () -> Unit) {
+ Row(
+ Modifier
+ .fillMaxWidth()
+ .heightIn(min = MinTapTarget)
+ .background(GrowstuffColors.IdeasYellow)
+ .clickable(role = Role.Button, onClick = onClick)
+ .padding(horizontal = 16.dp, vertical = 6.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Icon(GrowstuffIcons.Idea, null, Modifier.size(26.dp))
+ Text(
+ pluralStringResource(R.plurals.job_ideas, count, count),
+ style = MaterialTheme.typography.bodyMedium,
+ fontWeight = FontWeight.Bold,
+ modifier = Modifier.weight(1f),
+ )
+ Text(
+ stringResource(R.string.see_ideas).uppercase() + " →",
+ style = MaterialTheme.typography.labelSmall,
+ fontSize = 13.sp,
+ )
+ }
+}
+
+@Composable
+private fun JobList(state: JobsUiState, onToggle: (Job, Offset) -> Unit, tickCentres: MutableMap) {
+ if (state.groups.isEmpty()) {
+ val (title, body) = if (state.tab == JobsTab.ToDo) {
+ R.string.jobs_nothing_left to R.string.jobs_nothing_left_body
+ } else {
+ R.string.jobs_nothing_done to R.string.jobs_nothing_done_body
+ }
+ Column(
+ Modifier.fillMaxWidth().padding(horizontal = 28.dp, vertical = 40.dp),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ ) {
+ Text(stringResource(title), style = MaterialTheme.typography.headlineSmall)
+ Text(
+ stringResource(body),
+ style = MaterialTheme.typography.bodyLarge,
+ modifier = Modifier.padding(top = 8.dp),
+ )
+ }
+ return
+ }
+ LazyColumn(Modifier.fillMaxSize()) {
+ state.groups.forEach { group ->
+ item(key = "head-${group.kind}") { GroupHeading(group.kind, state.today) }
+ items(group.jobs, key = { it.id }) { job ->
+ JobRow(
+ job = job,
+ today = state.today,
+ onToggle = { onToggle(job, tickCentres[job.id] ?: Offset.Zero) },
+ onTickPlaced = { tickCentres[job.id] = it },
+ )
+ }
+ }
+ }
+}
+
+@Composable
+private fun GroupHeading(kind: JobGroupKind, today: LocalDate) {
+ val dayMonth = DateTimeFormatter.ofPattern("EEE d MMM")
+ val (title, note) = when (kind) {
+ JobGroupKind.Overdue -> stringResource(R.string.jobs_overdue) to ""
+ JobGroupKind.Today -> stringResource(R.string.jobs_today) to today.format(dayMonth)
+ JobGroupKind.ThisWeek -> stringResource(R.string.jobs_this_week) to
+ "${today.plusDays(
+ 1,
+ ).format(DateTimeFormatter.ofPattern("EEE d"))} – ${today.plusDays(7).format(dayMonth)}"
+ JobGroupKind.Later -> stringResource(R.string.jobs_later) to ""
+ JobGroupKind.SomeDay -> stringResource(R.string.jobs_some_day) to
+ stringResource(R.string.jobs_some_day_note)
+ JobGroupKind.Done -> stringResource(R.string.jobs_done) to
+ stringResource(R.string.jobs_done_note)
+ }
+ Column {
+ Row(
+ Modifier
+ .fillMaxWidth()
+ .background(
+ if (kind ==
+ JobGroupKind.Overdue
+ ) {
+ GrowstuffColors.Red
+ } else {
+ GrowstuffColors.Panel
+ },
+ )
+ .padding(horizontal = 16.dp, vertical = 10.dp),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Text(
+ title.uppercase(),
+ style = MaterialTheme.typography.labelMedium,
+ fontSize = 14.sp,
+ modifier = Modifier.semantics { heading() },
+ )
+ Text(
+ note,
+ style = MaterialTheme.typography.bodySmall,
+ fontSize = 14.sp,
+ fontWeight = FontWeight.SemiBold,
+ )
+ }
+ Rule(3.dp)
+ }
+}
+
+@Composable
+private fun JobRow(job: Job, today: LocalDate, onToggle: () -> Unit, onTickPlaced: (Offset) -> Unit) {
+ val label =
+ stringResource(if (job.finished) R.string.put_back else R.string.cross_off, job.name)
+ Column {
+ Row(Modifier.fillMaxWidth().height(IntrinsicSize.Min)) {
+ Box(
+ Modifier
+ .width(68.dp)
+ .fillMaxHeight()
+ .heightIn(min = 76.dp)
+ .toggleable(value = job.finished, role = Role.Checkbox, onValueChange = {
+ onToggle()
+ })
+ .semantics { contentDescription = label },
+ contentAlignment = Alignment.Center,
+ ) {
+ Box(
+ Modifier
+ .size(34.dp)
+ .background(
+ if (job.finished) GrowstuffColors.Green else GrowstuffColors.White,
+ )
+ .outlined()
+ .onGloballyPositioned { onTickPlaced(it.boundsInRoot().center) },
+ contentAlignment = Alignment.Center,
+ ) {
+ if (job.finished) {
+ Icon(
+ GrowstuffIcons.Tick,
+ null,
+ Modifier.size(26.dp),
+ tint = GrowstuffColors.White,
+ )
+ }
+ }
+ }
+ VerticalRule(3.dp)
+ Row(
+ Modifier.weight(1f).padding(horizontal = 14.dp, vertical = 12.dp),
+ horizontalArrangement = Arrangement.spacedBy(10.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(6.dp)) {
+ Text(
+ job.name,
+ style = MaterialTheme.typography.titleMedium,
+ color = if (job.finished) GrowstuffColors.Muted else GrowstuffColors.Black,
+ textDecoration = if (job.finished) TextDecoration.LineThrough else null,
+ )
+ job.link?.let { LinkChip(it) }
+ }
+ dayLabel(job, today)?.let { day ->
+ Text(
+ day,
+ style = MaterialTheme.typography.labelMedium,
+ fontSize = 14.sp,
+ letterSpacing = 0.sp,
+ color = if (!job.finished && job.dueDate?.isBefore(today) == true) {
+ GrowstuffColors.DayOverdue
+ } else {
+ GrowstuffColors.DayGreen
+ },
+ )
+ }
+ }
+ }
+ Rule(3.dp)
+ }
+}
+
+@Composable
+private fun LinkChip(link: JobLink) {
+ val kind = stringResource(
+ when (link.kind) {
+ JobLink.Kind.Planting -> R.string.link_planting
+ JobLink.Kind.Garden -> R.string.link_garden
+ JobLink.Kind.Seeds -> R.string.link_seeds
+ },
+ )
+ val inGarden = link.gardenName?.let { stringResource(R.string.link_in_garden, it) }
+ Text(
+ buildAnnotatedString {
+ withStyle(
+ SpanStyle(
+ fontSize = 10.sp,
+ fontWeight = FontWeight.ExtraBold,
+ letterSpacing = 0.8.sp,
+ ),
+ ) {
+ append(kind.uppercase())
+ }
+ append(" ")
+ withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append(link.name) }
+ if (inGarden != null) {
+ withStyle(SpanStyle(fontWeight = FontWeight.Medium)) { append(" $inGarden") }
+ }
+ },
+ fontFamily = Raleway,
+ fontSize = 13.sp,
+ modifier = Modifier
+ .background(GrowstuffColors.MemberChip)
+ .outlined(2.dp)
+ .padding(horizontal = 10.dp, vertical = 4.dp),
+ )
+}
+
+@Composable
+private fun dayLabel(job: Job, today: LocalDate): String? {
+ val weekday = DateTimeFormatter.ofPattern("EEE")
+ val dayMonth = DateTimeFormatter.ofPattern("d MMM")
+ fun near(date: LocalDate) = ChronoUnit.DAYS.between(date, today).let { it in -7..6 }
+ if (job.finished) {
+ val on = job.finishedOn ?: return null
+ val text = when {
+ on == today -> stringResource(R.string.due_today)
+ near(on) -> on.format(weekday)
+ else -> on.format(dayMonth)
+ }
+ return stringResource(R.string.done_on, text)
+ }
+ val due = job.dueDate ?: return null
+ return when {
+ due == today -> stringResource(R.string.due_today)
+ near(due) -> due.format(weekday)
+ else -> due.format(dayMonth)
+ }
+}
+
+@Composable
+private fun CrossedOffToast(job: Job, onUndo: () -> Unit, onTimeout: () -> Unit, modifier: Modifier) {
+ LaunchedEffect(job.id) {
+ delay(7_000)
+ onTimeout()
+ }
+ Row(
+ modifier
+ .fillMaxWidth()
+ .background(GrowstuffColors.Brown)
+ .outlined()
+ .padding(start = 16.dp, top = 10.dp, end = 10.dp, bottom = 10.dp)
+ .semantics { liveRegion = LiveRegionMode.Polite },
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Text(
+ stringResource(R.string.crossed_off, job.name),
+ style = MaterialTheme.typography.bodyMedium,
+ fontWeight = FontWeight.Bold,
+ color = GrowstuffColors.White,
+ modifier = Modifier.weight(1f),
+ )
+ BlockButton(
+ stringResource(R.string.undo),
+ onClick = onUndo,
+ primary = false,
+ minHeight = 48.dp,
+ )
+ }
+}
+
+@Composable
+private fun AddJobBar(onAdd: (String) -> Unit) {
+ var text by rememberSaveable { mutableStateOf("") }
+ val placeholder = stringResource(R.string.add_a_job)
+ val submit = {
+ onAdd(text)
+ text = ""
+ }
+ Row(
+ Modifier
+ .fillMaxWidth()
+ .windowInsetsPadding(WindowInsets.navigationBars.union(WindowInsets.ime))
+ .height(IntrinsicSize.Min)
+ .padding(12.dp),
+ horizontalArrangement = Arrangement.spacedBy(10.dp),
+ ) {
+ BasicTextField(
+ value = text,
+ onValueChange = { text = it },
+ singleLine = true,
+ textStyle = MaterialTheme.typography.bodyLarge.copy(fontSize = 17.sp),
+ keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
+ keyboardActions = KeyboardActions(onDone = { submit() }),
+ modifier = Modifier
+ .weight(1f)
+ .heightIn(min = 64.dp)
+ .semantics { contentDescription = placeholder },
+ decorationBox = { field ->
+ Box(
+ Modifier.fillMaxSize().background(
+ GrowstuffColors.White,
+ ).outlined().padding(horizontal = 14.dp),
+ contentAlignment = Alignment.CenterStart,
+ ) {
+ if (text.isEmpty()) {
+ Text(
+ placeholder,
+ style = MaterialTheme.typography.bodyLarge,
+ fontSize = 17.sp,
+ color = Color(0xBF413F3B),
+ )
+ }
+ field()
+ }
+ },
+ )
+ BlockButton(
+ stringResource(R.string.add),
+ onClick = submit,
+ modifier = Modifier.width(92.dp).fillMaxHeight(),
+ )
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobsViewModel.kt b/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobsViewModel.kt
new file mode 100644
index 0000000..ab0ec59
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/jobs/JobsViewModel.kt
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.jobs
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import java.time.Clock
+import java.time.LocalDate
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.SharingStarted
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.combine
+import kotlinx.coroutines.flow.stateIn
+import kotlinx.coroutines.flow.update
+import kotlinx.coroutines.launch
+import org.growstuff.android.data.Job
+import org.growstuff.android.data.JobsRepository
+
+enum class JobsTab { ToDo, Done }
+
+data class JobsUiState(
+ val tab: JobsTab = JobsTab.ToDo,
+ val groups: List = emptyList(),
+ val toDoCount: Int = 0,
+ val doneCount: Int = 0,
+ val ideaCount: Int = 0,
+ val today: LocalDate = LocalDate.MIN,
+ /** The job just crossed off, offered for undo. */
+ val crossedOff: Job? = null,
+)
+
+private data class LocalState(
+ val tab: JobsTab = JobsTab.ToDo,
+ /** Jobs ticked or unticked since the tab was opened. They stay put until the tab changes. */
+ val moved: Set = emptySet(),
+ val crossedOffId: String? = null,
+)
+
+class JobsViewModel(private val repository: JobsRepository, private val clock: Clock) : ViewModel() {
+ private val local = MutableStateFlow(LocalState())
+
+ val state: StateFlow = combine(repository.jobs, repository.ideaCount, local) {
+ jobs,
+ ideas,
+ local,
+ ->
+ val today = LocalDate.now(clock)
+ val shown = jobs.filter { job ->
+ val stays = job.id in local.moved
+ when (local.tab) {
+ JobsTab.ToDo -> !job.finished || stays
+ JobsTab.Done -> job.finished || stays
+ }
+ }
+ JobsUiState(
+ tab = local.tab,
+ groups = if (local.tab == JobsTab.ToDo) groupToDo(shown, today) else groupDone(shown),
+ toDoCount = jobs.count { !it.finished },
+ doneCount = jobs.count { it.finished },
+ ideaCount = ideas,
+ today = today,
+ crossedOff = jobs.find { it.id == local.crossedOffId && it.finished },
+ )
+ }.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), JobsUiState())
+
+ fun showTab(tab: JobsTab) {
+ local.value = LocalState(tab = tab)
+ }
+
+ fun setFinished(job: Job, finished: Boolean) {
+ local.update {
+ it.copy(moved = it.moved + job.id, crossedOffId = if (finished) job.id else null)
+ }
+ viewModelScope.launch { repository.setFinished(job.id, finished) }
+ }
+
+ fun undoCrossOff() {
+ val id = local.value.crossedOffId ?: return
+ local.update { it.copy(crossedOffId = null) }
+ viewModelScope.launch { repository.setFinished(id, false) }
+ }
+
+ fun dismissCrossOff() {
+ local.update { it.copy(crossedOffId = null) }
+ }
+
+ fun add(name: String) {
+ val trimmed = name.trim()
+ if (trimmed.isEmpty()) return
+ viewModelScope.launch { repository.add(trimmed) }
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/signin/SignInScreen.kt b/app/src/main/kotlin/org/growstuff/android/ui/signin/SignInScreen.kt
new file mode 100644
index 0000000..45e2c4a
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/signin/SignInScreen.kt
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.signin
+
+import androidx.compose.foundation.Image
+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.IntrinsicSize
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxHeight
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.navigationBarsPadding
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.heading
+import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.unit.dp
+import org.growstuff.android.R
+import org.growstuff.android.ui.Links
+import org.growstuff.android.ui.components.BlockButton
+import org.growstuff.android.ui.components.GrowstuffIcons
+import org.growstuff.android.ui.components.Rule
+import org.growstuff.android.ui.components.TopBar
+import org.growstuff.android.ui.components.VerticalRule
+import org.growstuff.android.ui.components.outlined
+import org.growstuff.android.ui.theme.GrowstuffColors
+import org.growstuff.android.ui.theme.MinTapTarget
+
+@Composable
+fun SignInScreen(onSignIn: () -> Unit) {
+ val uriHandler = LocalUriHandler.current
+ Column(Modifier.fillMaxSize().background(GrowstuffColors.Beige)) {
+ TopBar()
+ Column(Modifier.weight(1f).verticalScroll(rememberScrollState())) {
+ Column(Modifier.fillMaxWidth().background(GrowstuffColors.Green).padding(24.dp)) {
+ Text(
+ stringResource(R.string.sign_in_title),
+ style = MaterialTheme.typography.displayMedium,
+ color = GrowstuffColors.White,
+ modifier = Modifier.semantics { heading() },
+ )
+ Text(
+ stringResource(R.string.sign_in_body),
+ style = MaterialTheme.typography.bodyLarge,
+ color = GrowstuffColors.White,
+ modifier = Modifier.padding(top = 14.dp),
+ )
+ }
+ Rule()
+ Image(
+ painterResource(R.drawable.sign_in_garden),
+ contentDescription = null,
+ contentScale = ContentScale.Crop,
+ alignment = Alignment.BottomCenter,
+ modifier = Modifier.fillMaxWidth().height(170.dp),
+ )
+ Rule()
+ Column(Modifier.padding(20.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
+ BlockButton(
+ stringResource(R.string.sign_in),
+ onClick = onSignIn,
+ icon = GrowstuffIcons.Arrow,
+ modifier = Modifier.fillMaxWidth(),
+ )
+ BlockButton(
+ stringResource(R.string.create_account),
+ onClick = { uriHandler.openUri(Links.SIGN_UP) },
+ primary = false,
+ icon = GrowstuffIcons.External,
+ minHeight = MinTapTarget,
+ modifier = Modifier.fillMaxWidth(),
+ )
+ Row(
+ Modifier.fillMaxWidth().height(
+ IntrinsicSize.Min,
+ ).background(GrowstuffColors.White).outlined(),
+ ) {
+ Box(
+ Modifier.width(56.dp).fillMaxHeight(),
+ contentAlignment = Alignment.Center,
+ ) {
+ Icon(GrowstuffIcons.Lock, null, Modifier.size(24.dp))
+ }
+ VerticalRule()
+ Text(
+ stringResource(R.string.sign_in_password_note),
+ style = MaterialTheme.typography.bodySmall,
+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp),
+ )
+ }
+ }
+ }
+ Rule()
+ Row(
+ Modifier.fillMaxWidth().height(
+ IntrinsicSize.Min,
+ ).background(GrowstuffColors.White).navigationBarsPadding(),
+ ) {
+ FooterLink(stringResource(R.string.privacy), Modifier.weight(1f)) {
+ uriHandler.openUri(Links.PRIVACY)
+ }
+ VerticalRule()
+ FooterLink(stringResource(R.string.open_source), Modifier.weight(1f)) {
+ uriHandler.openUri(Links.SOURCE)
+ }
+ }
+ }
+}
+
+@Composable
+private fun FooterLink(text: String, modifier: Modifier, onClick: () -> Unit) {
+ Box(
+ modifier.heightIn(min = MinTapTarget).clickable(role = Role.Button, onClick = onClick),
+ contentAlignment = Alignment.Center,
+ ) {
+ Text(text.uppercase(), style = MaterialTheme.typography.labelMedium)
+ }
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/theme/GrowstuffColors.kt b/app/src/main/kotlin/org/growstuff/android/ui/theme/GrowstuffColors.kt
new file mode 100644
index 0000000..5c9ea6f
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/theme/GrowstuffColors.kt
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.theme
+
+import androidx.compose.ui.graphics.Color
+
+/** Growstuff's design tokens. Contrast ratios are for the pairs the screens use. */
+object GrowstuffColors {
+ val Brown = Color(0xFF413F3B) // top bar; white on it 10.5:1
+ val Beige = Color(0xFFF4F2EF) // ground
+ val Green = Color(0xFF57803C) // the one green; white on it 4.6:1
+ val White = Color(0xFFFFFFFF)
+ val Black = Color(0xFF000000) // outlines and text
+ val MemberChip = Color(0xFFA4C98C) // avatars and link chips, black text on it
+ val Panel = Color(0xFFECEBE6) // group headings
+ val Red = Color(0xFFFF4D43) // the overdue heading, black text on it
+ val IdeasYellow = Color(0xFFFFF3A8) // only the "ideas for you" box
+ val Muted = Color(0xFF6C757D) // done jobs, 4.7:1 on white
+ val DayGreen = Color(0xFF3F5E2B) // due day, 7.6:1 on white
+ val DayOverdue = Color(0xFFC62828) // overdue day, 5.6:1 on white
+ val Soil = Color(0xFF6D4C41)
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/theme/Theme.kt b/app/src/main/kotlin/org/growstuff/android/ui/theme/Theme.kt
new file mode 100644
index 0000000..fb410e1
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/theme/Theme.kt
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.theme
+
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Shapes
+import androidx.compose.material3.lightColorScheme
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.unit.dp
+
+/** Thickness of the black outline around every block and control. */
+val Outline = 4.dp
+
+/** The smallest height for a main control. */
+val MinTapTarget = 56.dp
+
+private val colors = lightColorScheme(
+ primary = GrowstuffColors.Green,
+ onPrimary = GrowstuffColors.White,
+ secondary = GrowstuffColors.Brown,
+ onSecondary = GrowstuffColors.White,
+ background = GrowstuffColors.Beige,
+ onBackground = GrowstuffColors.Black,
+ surface = GrowstuffColors.White,
+ onSurface = GrowstuffColors.Black,
+ outline = GrowstuffColors.Black,
+)
+
+private val square = RoundedCornerShape(0.dp)
+
+@Composable
+fun GrowstuffTheme(content: @Composable () -> Unit) {
+ MaterialTheme(
+ colorScheme = colors,
+ typography = GrowstuffTypography,
+ shapes = Shapes(square, square, square, square, square),
+ content = content,
+ )
+}
diff --git a/app/src/main/kotlin/org/growstuff/android/ui/theme/Type.kt b/app/src/main/kotlin/org/growstuff/android/ui/theme/Type.kt
new file mode 100644
index 0000000..e6430da
--- /dev/null
+++ b/app/src/main/kotlin/org/growstuff/android/ui/theme/Type.kt
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.theme
+
+import androidx.compose.material3.Typography
+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.FontVariation
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.em
+import androidx.compose.ui.unit.sp
+import org.growstuff.android.R
+
+private fun raleway(weight: FontWeight) = Font(
+ resId = R.font.raleway,
+ weight = weight,
+ variationSettings = FontVariation.Settings(FontVariation.weight(weight.weight)),
+)
+
+val Raleway = FontFamily(
+ raleway(FontWeight.Normal),
+ raleway(FontWeight.Medium),
+ raleway(FontWeight.SemiBold),
+ raleway(FontWeight.Bold),
+ raleway(FontWeight.ExtraBold),
+)
+
+/** The wordmark face, only for the name "Growstuff". */
+val Modak = FontFamily(Font(R.font.modak))
+
+private val base = TextStyle(fontFamily = Raleway, color = GrowstuffColors.Black)
+
+val GrowstuffTypography = Typography(
+ displayMedium = base.copy(fontSize = 44.sp, lineHeight = 46.sp, fontWeight = FontWeight.ExtraBold),
+ headlineLarge = base.copy(fontSize = 36.sp, lineHeight = 38.sp, fontWeight = FontWeight.ExtraBold),
+ headlineSmall = base.copy(fontSize = 24.sp, lineHeight = 26.sp, fontWeight = FontWeight.ExtraBold),
+ titleLarge = base.copy(fontSize = 22.sp, lineHeight = 24.sp, fontWeight = FontWeight.ExtraBold),
+ titleMedium = base.copy(fontSize = 18.sp, lineHeight = 22.sp, fontWeight = FontWeight.Bold),
+ bodyLarge = base.copy(fontSize = 18.sp, lineHeight = 25.sp, fontWeight = FontWeight.Medium),
+ bodyMedium = base.copy(fontSize = 15.sp, lineHeight = 20.sp, fontWeight = FontWeight.Medium),
+ bodySmall = base.copy(fontSize = 13.sp, lineHeight = 18.sp, fontWeight = FontWeight.Medium),
+ labelLarge = base.copy(fontSize = 18.sp, fontWeight = FontWeight.ExtraBold, letterSpacing = 0.06.em),
+ labelMedium = base.copy(fontSize = 15.sp, fontWeight = FontWeight.ExtraBold, letterSpacing = 0.06.em),
+ labelSmall = base.copy(fontSize = 12.sp, fontWeight = FontWeight.ExtraBold, letterSpacing = 0.06.em),
+)
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..aa1532a
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/sign_in_garden.xml b/app/src/main/res/drawable/sign_in_garden.xml
new file mode 100644
index 0000000..33c3572
--- /dev/null
+++ b/app/src/main/res/drawable/sign_in_garden.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/font/modak.ttf b/app/src/main/res/font/modak.ttf
new file mode 100644
index 0000000..debefc9
Binary files /dev/null and b/app/src/main/res/font/modak.ttf differ
diff --git a/app/src/main/res/font/raleway.ttf b/app/src/main/res/font/raleway.ttf
new file mode 100644
index 0000000..d81d42f
Binary files /dev/null and b/app/src/main/res/font/raleway.ttf differ
diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/app/src/main/res/mipmap-anydpi/ic_launcher.xml
new file mode 100644
index 0000000..5c84730
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3f0a491
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #57803C
+ #F4F2EF
+ #413F3B
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..68f09ff
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,85 @@
+
+
+ Growstuff
+ Back
+
+
+ Grow food together.
+ Sign in to see your gardens, your jobs to do, and the gardeners around you.
+ Sign in
+ Create an account
+ You sign in on growstuff.org, in your browser. This app never sees your password.
+ Privacy
+ Open source
+
+
+ %1$s, your account
+ Hello, %1$s.
+ What shall we get our hands dirty with?
+ My gardens
+ Your beds, what you have planted, and your harvests.
+ My friends
+ Friends and neighbours, and what they have been growing.
+ My jobs
+ What needs doing in the garden.
+ Ideas for you
+ Sign out
+ Pick something on the left to get started.
+
+
+ Coming soon.
+ The seeds are in. Friends and neighbours will sprout here in a later version.
+
+
+ To do
+ Done
+ %1$s, %2$d
+
+ - We have %d suggested job for you this week
+ - We have %d suggested jobs for you this week
+
+ See ideas
+ Overdue
+ Today
+ This week
+ Later
+ Some day
+ no day yet
+ look what you grew
+ Nothing left to do.
+ The snail is impressed, and slightly jealous.
+ Nothing crossed off yet.
+ The snail is taking its time too.
+ Cross off: %1$s
+ Put back on the list: %1$s
+ Crossed off “%1$s”. The snail is impressed.
+ Undo
+ Add a job
+ Add
+ Today
+ Done %1$s
+ Planting
+ Garden
+ Seeds
+ in %1$s
+
+
+ Last watered %1$s. Pull down to water again.
+ just now
+
+ - %d minute ago
+ - %d minutes ago
+
+
+ - %d growing
+ - %d growing
+
+
+ - %d ready to harvest
+ - %d ready to harvest
+
+ Nothing growing. The soil is resting.
+ Add a garden
+ %1$s m²
+ %1$s ft²
+
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..abaced7
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/app/src/test/kotlin/org/growstuff/android/data/FixtureFiles.kt b/app/src/test/kotlin/org/growstuff/android/data/FixtureFiles.kt
new file mode 100644
index 0000000..9feb906
--- /dev/null
+++ b/app/src/test/kotlin/org/growstuff/android/data/FixtureFiles.kt
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.data
+
+import java.io.File
+import java.time.Clock
+import java.time.ZoneOffset
+import org.growstuff.android.data.fake.Fixtures
+
+/** The app's own fixtures, read from the source tree, with the clock stopped on the fixture day. */
+fun testFixtures(): Fixtures = Fixtures(
+ read = { name -> File("src/main/assets/$name").readText() },
+ clock = Clock.fixed(Fixtures.FIXTURE_DAY.atTime(9, 0).toInstant(ZoneOffset.UTC), ZoneOffset.UTC),
+)
diff --git a/app/src/test/kotlin/org/growstuff/android/data/JsonApiMappersTest.kt b/app/src/test/kotlin/org/growstuff/android/data/JsonApiMappersTest.kt
new file mode 100644
index 0000000..8a71e04
--- /dev/null
+++ b/app/src/test/kotlin/org/growstuff/android/data/JsonApiMappersTest.kt
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.data
+
+import java.time.LocalDate
+import org.growstuff.android.data.fake.Fixtures
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
+import org.junit.Test
+
+class JsonApiMappersTest {
+ private val fixtures = testFixtures()
+ private val gardens = fixtures.document("gardens").toGardens(Fixtures.FIXTURE_DAY)
+ private val jobs = fixtures.document("jobs").toJobs()
+
+ private fun garden(name: String) = gardens.single { it.name == name }
+
+ private fun job(name: String) = jobs.single { it.name == name }
+
+ @Test
+ fun `counts plantings that are not finished as growing`() {
+ assertEquals(4, garden("Bed 1, the herb bed").growingCount)
+ }
+
+ @Test
+ fun `counts growing plantings past their first harvest date as ready`() {
+ assertEquals(1, garden("Bed 2, the sunny one").readyToHarvestCount)
+ }
+
+ @Test
+ fun `counts nothing growing in a garden with only finished plantings`() {
+ assertEquals(0, garden("Bed 3, by the fence").growingCount)
+ }
+
+ @Test
+ fun `reads the due date`() {
+ assertEquals(LocalDate.of(2026, 10, 20), job("Fix the hose tap").dueDate)
+ }
+
+ @Test
+ fun `reads the day a job was finished from its timestamp`() {
+ assertEquals(LocalDate.of(2026, 10, 23), job("Net the strawberries").finishedOn)
+ }
+
+ @Test
+ fun `links a job to its planting and the planting's garden`() {
+ assertEquals(
+ JobLink(JobLink.Kind.Planting, "sunflower", "Bed 2, the sunny one"),
+ job("Plant out the sunflowers").link,
+ )
+ }
+
+ @Test
+ fun `links a job to seeds`() {
+ assertEquals(JobLink(JobLink.Kind.Seeds, "broad bean", null), job("Sow the broad beans").link)
+ }
+
+ @Test
+ fun `leaves a job without a link when it is about nothing in particular`() {
+ assertNull(job("Order more compost").link)
+ }
+}
diff --git a/app/src/test/kotlin/org/growstuff/android/ui/jobs/JobGroupsTest.kt b/app/src/test/kotlin/org/growstuff/android/ui/jobs/JobGroupsTest.kt
new file mode 100644
index 0000000..34029f8
--- /dev/null
+++ b/app/src/test/kotlin/org/growstuff/android/ui/jobs/JobGroupsTest.kt
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.jobs
+
+import java.time.LocalDate
+import org.growstuff.android.data.Job
+import org.junit.Assert.assertEquals
+import org.junit.Test
+
+class JobGroupsTest {
+ private val today = LocalDate.of(2026, 10, 24)
+
+ private fun job(name: String, due: LocalDate? = null, finishedOn: LocalDate? = null) = Job(
+ id = name,
+ name = name,
+ dueDate = due,
+ finished = finishedOn != null,
+ finishedOn = finishedOn,
+ link = null,
+ )
+
+ private fun kindOf(due: LocalDate?) = groupToDo(listOf(job("a", due)), today).single().kind
+
+ @Test
+ fun `puts a job due before today in overdue`() {
+ assertEquals(JobGroupKind.Overdue, kindOf(today.minusDays(1)))
+ }
+
+ @Test
+ fun `puts a job due today in today`() {
+ assertEquals(JobGroupKind.Today, kindOf(today))
+ }
+
+ @Test
+ fun `puts a job due in seven days in this week`() {
+ assertEquals(JobGroupKind.ThisWeek, kindOf(today.plusDays(7)))
+ }
+
+ @Test
+ fun `puts a job due in eight days in later`() {
+ assertEquals(JobGroupKind.Later, kindOf(today.plusDays(8)))
+ }
+
+ @Test
+ fun `puts a job with no day in some day`() {
+ assertEquals(JobGroupKind.SomeDay, kindOf(null))
+ }
+
+ @Test
+ fun `orders the groups soonest first`() {
+ val jobs =
+ listOf(
+ job("someday"),
+ job("week", today.plusDays(3)),
+ job("overdue", today.minusDays(2)),
+ job("today", today),
+ )
+ assertEquals(
+ listOf(
+ JobGroupKind.Overdue,
+ JobGroupKind.Today,
+ JobGroupKind.ThisWeek,
+ JobGroupKind.SomeDay,
+ ),
+ groupToDo(jobs, today).map { it.kind },
+ )
+ }
+
+ @Test
+ fun `orders done jobs most recent first`() {
+ val jobs =
+ listOf(job("old", finishedOn = today.minusDays(9)), job("new", finishedOn = today))
+ assertEquals(listOf("new", "old"), groupDone(jobs).single().jobs.map { it.name })
+ }
+
+ @Test
+ fun `has no groups when nothing is done`() {
+ assertEquals(emptyList(), groupDone(emptyList()))
+ }
+}
diff --git a/app/src/test/kotlin/org/growstuff/android/ui/jobs/JobsViewModelTest.kt b/app/src/test/kotlin/org/growstuff/android/ui/jobs/JobsViewModelTest.kt
new file mode 100644
index 0000000..a9f90eb
--- /dev/null
+++ b/app/src/test/kotlin/org/growstuff/android/ui/jobs/JobsViewModelTest.kt
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+package org.growstuff.android.ui.jobs
+
+import java.time.Clock
+import java.time.ZoneOffset
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.test.TestScope
+import kotlinx.coroutines.test.UnconfinedTestDispatcher
+import kotlinx.coroutines.test.resetMain
+import kotlinx.coroutines.test.runTest
+import kotlinx.coroutines.test.setMain
+import org.growstuff.android.data.fake.FakeJobsRepository
+import org.growstuff.android.data.fake.Fixtures
+import org.growstuff.android.data.testFixtures
+import org.junit.After
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Before
+import org.junit.Test
+
+@OptIn(ExperimentalCoroutinesApi::class)
+class JobsViewModelTest {
+ private val repository = FakeJobsRepository(testFixtures())
+ private val clock = Clock.fixed(
+ Fixtures.FIXTURE_DAY.atTime(9, 0).toInstant(ZoneOffset.UTC),
+ ZoneOffset.UTC,
+ )
+ private val viewModel by lazy { JobsViewModel(repository, clock) }
+
+ private val compost get() = repository.jobs.value.single { it.name == "Order more compost" }
+
+ @Before
+ fun setUp() {
+ Dispatchers.setMain(UnconfinedTestDispatcher())
+ }
+
+ @After
+ fun tearDown() {
+ Dispatchers.resetMain()
+ }
+
+ /** Keeps the state flowing, as the screen does while it's open. */
+ private fun TestScope.collectState() {
+ backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) { viewModel.state.collect {} }
+ }
+
+ private fun shownToDo() = viewModel.state.value.groups.flatMap { it.jobs }.map { it.name }
+
+ @Test
+ fun `keeps a crossed-off job on the to do list until the tab changes`() = runTest {
+ collectState()
+ viewModel.setFinished(compost, true)
+ assertTrue("Order more compost" in shownToDo())
+ }
+
+ @Test
+ fun `moves a crossed-off job off the to do list when the tab changes`() = runTest {
+ collectState()
+ viewModel.setFinished(compost, true)
+ viewModel.showTab(JobsTab.Done)
+ viewModel.showTab(JobsTab.ToDo)
+ assertFalse("Order more compost" in shownToDo())
+ }
+
+ @Test
+ fun `offers the crossed-off job for undo`() = runTest {
+ collectState()
+ viewModel.setFinished(compost, true)
+ assertEquals("Order more compost", viewModel.state.value.crossedOff?.name)
+ }
+
+ @Test
+ fun `puts the job back on undo`() = runTest {
+ collectState()
+ viewModel.setFinished(compost, true)
+ viewModel.undoCrossOff()
+ assertFalse(compost.finished)
+ }
+
+ @Test
+ fun `adds a job with no day`() = runTest {
+ viewModel.add(" Turn the compost ")
+ assertEquals(null, repository.jobs.first().single { it.name == "Turn the compost" }.dueDate)
+ }
+
+ @Test
+ fun `ignores a blank new job`() = runTest {
+ val before = repository.jobs.value.size
+ viewModel.add(" ")
+ assertEquals(before, repository.jobs.value.size)
+ }
+}
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..3d420fa
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+plugins {
+ alias(libs.plugins.android.application) apply false
+ alias(libs.plugins.kotlin.compose) apply false
+ alias(libs.plugins.kotlin.serialization) apply false
+ alias(libs.plugins.ktlint) apply false
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..82379f9
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,6 @@
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+org.gradle.caching=true
+org.gradle.configuration-cache=true
+android.useAndroidX=true
+android.nonTransitiveRClass=true
+kotlin.code.style=official
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
new file mode 100644
index 0000000..db6d476
--- /dev/null
+++ b/gradle/libs.versions.toml
@@ -0,0 +1,35 @@
+[versions]
+agp = "9.4.1"
+kotlin = "2.4.21"
+ktlint-gradle = "14.2.0"
+core-ktx = "1.19.1"
+activity-compose = "1.13.0"
+lifecycle = "2.11.0"
+navigation = "2.10.2"
+compose-bom = "2026.09.00"
+material3-adaptive = "1.3.0"
+kotlinx-serialization = "1.12.0"
+kotlinx-coroutines = "1.11.0"
+junit = "4.13.2"
+
+[libraries]
+androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx" }
+androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" }
+androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" }
+androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle" }
+androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation" }
+compose-bom = { module = "androidx.compose:compose-bom", version.ref = "compose-bom" }
+compose-ui = { module = "androidx.compose.ui:ui" }
+compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
+compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
+compose-material3 = { module = "androidx.compose.material3:material3" }
+compose-material3-adaptive = { module = "androidx.compose.material3.adaptive:adaptive", version.ref = "material3-adaptive" }
+kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
+kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
+junit = { module = "junit:junit", version.ref = "junit" }
+
+[plugins]
+android-application = { id = "com.android.application", version.ref = "agp" }
+kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
+kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
+ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-gradle" }
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..9fa7f28
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..91c4fc6
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,9 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
+networkTimeout=10000
+retries=0
+retryBackOffMs=500
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..249efbb
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,248 @@
+#!/bin/sh
+
+#
+# Copyright © 2015 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# gradlew start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh gradlew
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..03754c4
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,112 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem gradlew startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables, and ensure extensions are enabled
+setlocal EnableExtensions
+
+@rem Catch executions from older scripts and ensure they exit cleanly.
+@rem This can be removed once we can be reasonably confident that few people
+@rem will be migrating directly to this new wrapper.
+goto afterSafetyNet
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+goto exitWithErrorLevel
+:afterSafetyNet
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+1>&2 echo.
+1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+1>&2 echo.
+1>&2 echo Please set the JAVA_HOME variable in your environment to match the
+1>&2 echo location of your Java installation.
+
+"%COMSPEC%" /c exit 1
+goto exitWithErrorLevel
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+1>&2 echo.
+1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+1>&2 echo.
+1>&2 echo Please set the JAVA_HOME variable in your environment to match the
+1>&2 echo location of your Java installation.
+
+"%COMSPEC%" /c exit 1
+goto exitWithErrorLevel
+
+:execute
+@rem Setup the command line
+
+
+
+@rem Execute gradlew
+@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
+@rem which allows us to clear the local environment before executing the java command
+endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel
+
+@rem This label must not be changed. We rely on old scripts being able to jump to this point.
+:exitWithErrorLevel
+@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
+"%COMSPEC%" /c exit %ERRORLEVEL%
diff --git a/licenses/OFL-Modak.txt b/licenses/OFL-Modak.txt
new file mode 100644
index 0000000..061cfc2
--- /dev/null
+++ b/licenses/OFL-Modak.txt
@@ -0,0 +1,93 @@
+Copyright (c) 2015 Ek Type (www.ektype.in)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/licenses/OFL-Raleway.txt b/licenses/OFL-Raleway.txt
new file mode 100644
index 0000000..a6b73db
--- /dev/null
+++ b/licenses/OFL-Raleway.txt
@@ -0,0 +1,93 @@
+Copyright 2010 The Raleway Project Authors (impallari@gmail.com), with Reserved Font Name "Raleway".
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..f16cc99
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+pluginManagement {
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+
+plugins {
+ id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.name = "growstuff-android"
+include(":app")