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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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/
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -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.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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.
75 changes: 75 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
}
5 changes: 5 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Keep kotlinx.serialization generated serializers.
-keepclassmembers @kotlinx.serialization.Serializable class ** {
*** Companion;
kotlinx.serialization.KSerializer serializer(...);
}
28 changes: 28 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".GrowstuffApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Growstuff">
<activity
android:name=".MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>
</manifest>
42 changes: 42 additions & 0 deletions app/src/main/assets/fixtures/gardens.json
Original file line number Diff line number Diff line change
@@ -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" } }
]
}
11 changes: 11 additions & 0 deletions app/src/main/assets/fixtures/job_ideas.json
Original file line number Diff line number Diff line change
@@ -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" } }
]
}
50 changes: 50 additions & 0 deletions app/src/main/assets/fixtures/jobs.json
Original file line number Diff line number Diff line change
@@ -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" } }
]
}
9 changes: 9 additions & 0 deletions app/src/main/assets/fixtures/member.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"data": [
{
"type": "members",
"id": "1",
"attributes": { "login_name": "brenda", "slug": "brenda" }
}
]
}
Loading
Loading