Compare commits
18 Commits
2cf2dafacd
...
v0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| fb723fba68 | |||
|
|
ffc7ed414f | ||
| af75965a31 | |||
| 1b456d2133 | |||
| a826e82bdc | |||
| ed680b4482 | |||
|
|
6ebe8d69e9 | ||
|
|
0508ea9de5 | ||
|
|
ee14706d91 | ||
|
|
376663b0d8 | ||
|
|
89ff33fe3d | ||
|
|
686aee9109 | ||
|
|
bfa7757d88 | ||
|
|
fb7f2ad1f3 | ||
|
|
0593b9c60f | ||
|
|
dea5490bcf | ||
|
|
4fe8cd12cb | ||
|
|
e4f445ac75 |
91
.gitea/workflows/ci.yaml
Normal file
91
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,91 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '**'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: docker
|
||||
env:
|
||||
ANDROID_HOME: /opt/android-sdk
|
||||
ANDROID_SDK_ROOT: /opt/android-sdk
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Install Android SDK packages
|
||||
run: |
|
||||
yes | sdkmanager --licenses >/dev/null || true
|
||||
sdkmanager \
|
||||
"platform-tools" \
|
||||
"platforms;android-36" \
|
||||
"platforms;android-37.0" \
|
||||
"build-tools;36.0.0"
|
||||
|
||||
- name: Install jq
|
||||
run: |
|
||||
set -e
|
||||
SUDO=""
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
SUDO="sudo"
|
||||
fi
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y jq
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
$SUDO apk add --no-cache jq
|
||||
fi
|
||||
|
||||
- name: Setup Gradle cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
- name: Lint (debug variant only)
|
||||
run: ./gradlew lintDebug --no-daemon
|
||||
|
||||
- name: Unit tests
|
||||
run: ./gradlew testDebugUnitTest --no-daemon
|
||||
|
||||
- name: Assemble debug APK
|
||||
run: ./gradlew assembleDebug --no-daemon
|
||||
|
||||
- name: Trivy filesystem scan
|
||||
run: |
|
||||
set -e
|
||||
SUDO=""
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
SUDO="sudo"
|
||||
fi
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y wget apt-transport-https gnupg lsb-release
|
||||
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | $SUDO tee /usr/share/keyrings/trivy.gpg > /dev/null
|
||||
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb generic main" | $SUDO tee /etc/apt/sources.list.d/trivy.list
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y trivy
|
||||
fi
|
||||
trivy filesystem --severity HIGH,CRITICAL --exit-code 0 .
|
||||
continue-on-error: true
|
||||
190
.gitea/workflows/release.yaml
Normal file
190
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,190 @@
|
||||
name: Build and Release to F-Droid
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: docker
|
||||
env:
|
||||
ANDROID_HOME: /opt/android-sdk
|
||||
ANDROID_SDK_ROOT: /opt/android-sdk
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Install Android SDK packages
|
||||
run: |
|
||||
yes | sdkmanager --licenses >/dev/null || true
|
||||
sdkmanager \
|
||||
"platform-tools" \
|
||||
"platforms;android-36" \
|
||||
"platforms;android-37.0" \
|
||||
"build-tools;36.0.0"
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
# Lint already enforced on every push to main via ci.yaml.
|
||||
# Release sanity only re-runs tests + a debug build to catch
|
||||
# any tag-resolved drift (e.g. version code substitution issues).
|
||||
|
||||
- name: Unit tests
|
||||
run: ./gradlew testDebugUnitTest --no-daemon
|
||||
|
||||
- name: Assemble debug APK (sanity)
|
||||
run: ./gradlew assembleDebug --no-daemon
|
||||
|
||||
build-and-deploy:
|
||||
needs: ci
|
||||
runs-on: docker
|
||||
env:
|
||||
ANDROID_HOME: /opt/android-sdk
|
||||
ANDROID_SDK_ROOT: /opt/android-sdk
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Install Android SDK packages
|
||||
run: |
|
||||
yes | sdkmanager --licenses >/dev/null || true
|
||||
sdkmanager \
|
||||
"platform-tools" \
|
||||
"platforms;android-36" \
|
||||
"platforms;android-37.0" \
|
||||
"build-tools;36.0.0"
|
||||
|
||||
- name: Install jq
|
||||
run: |
|
||||
set -e
|
||||
SUDO=""
|
||||
if command -v sudo >/dev/null 2>&1; then SUDO="sudo"; fi
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y jq
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
$SUDO apk add --no-cache jq
|
||||
fi
|
||||
|
||||
- name: Set version from git tag
|
||||
run: |
|
||||
set -e
|
||||
RAW_TAG="${GITHUB_REF_NAME:-${GITHUB_REF##*/}}"
|
||||
VERSION="${RAW_TAG#v}"
|
||||
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
||||
MINOR=$(echo "$VERSION" | cut -d. -f2)
|
||||
PATCH=$(echo "$VERSION" | cut -d. -f3)
|
||||
MAJOR=${MAJOR:-0}; MINOR=${MINOR:-0}; PATCH=${PATCH:-0}
|
||||
VERSION_CODE=$(( MAJOR * 10000 + MINOR * 100 + PATCH ))
|
||||
echo "Version: $VERSION, VersionCode: $VERSION_CODE"
|
||||
sed -i "s/versionName = \".*\"/versionName = \"$VERSION\"/" app/build.gradle.kts
|
||||
sed -i "s/versionCode = .*/versionCode = $VERSION_CODE/" app/build.gradle.kts
|
||||
grep -E 'versionName|versionCode' app/build.gradle.kts
|
||||
|
||||
- name: Setup Android Keystore
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
mkdir -p app
|
||||
echo "$KEYSTORE_BASE64" | base64 --decode > app/upload-keystore.jks
|
||||
cat > key.properties <<EOF
|
||||
storePassword=$KEY_PASSWORD
|
||||
keyPassword=$KEY_PASSWORD
|
||||
keyAlias=$KEY_ALIAS
|
||||
storeFile=upload-keystore.jks
|
||||
EOF
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
- name: Build release APK
|
||||
run: ./gradlew assembleRelease --no-daemon
|
||||
|
||||
- name: Setup F-Droid Server Tools
|
||||
run: |
|
||||
SUDO=""
|
||||
if command -v sudo >/dev/null 2>&1; then SUDO="sudo"; fi
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y sshpass python3-pip
|
||||
pip3 install --break-system-packages --upgrade fdroidserver
|
||||
|
||||
- name: Initialize or fetch F-Droid Repository
|
||||
env:
|
||||
HOST: ${{ secrets.HETZNER_HOST }}
|
||||
USER: ${{ secrets.HETZNER_USER }}
|
||||
PASS: ${{ secrets.HETZNER_PASS }}
|
||||
run: |
|
||||
mkdir -p fdroid
|
||||
sshpass -p "$PASS" sftp -o StrictHostKeyChecking=no "$USER@$HOST" <<'SFTP'
|
||||
-mkdir dev
|
||||
-mkdir dev/fdroid
|
||||
-mkdir dev/fdroid/repo
|
||||
SFTP
|
||||
sshpass -p "$PASS" scp -o StrictHostKeyChecking=no -r "$USER@$HOST:dev/fdroid/." fdroid/ || (cd fdroid && fdroid init)
|
||||
|
||||
- name: Ensure F-Droid repo signing key and icon
|
||||
run: |
|
||||
cd fdroid
|
||||
mkdir -p repo/icons
|
||||
if [ ! -f keystore.p12 ]; then
|
||||
fdroid update --create-key
|
||||
fi
|
||||
|
||||
- name: Copy new APK to repo
|
||||
run: |
|
||||
set -e
|
||||
mkdir -p fdroid/repo
|
||||
REF_NAME="${GITHUB_REF_NAME:-${GITHUB_REF##*/}}"
|
||||
SAFE_REF_NAME="$(echo "$REF_NAME" | tr '/ ' '__' | tr -cd '[:alnum:]_.-')"
|
||||
if [ -z "$SAFE_REF_NAME" ]; then
|
||||
SAFE_REF_NAME="${GITHUB_SHA:-manual}"
|
||||
fi
|
||||
cp app/build/outputs/apk/release/app-release.apk "fdroid/repo/calendula_${SAFE_REF_NAME}.apk"
|
||||
|
||||
- name: Copy metadata to F-Droid repo
|
||||
run: |
|
||||
mkdir -p fdroid/metadata
|
||||
cp -r fdroid-metadata/* fdroid/metadata/
|
||||
|
||||
- name: Generate F-Droid Index
|
||||
run: |
|
||||
cd fdroid
|
||||
fdroid update -c
|
||||
|
||||
- name: Upload Repo to Hetzner
|
||||
env:
|
||||
HOST: ${{ secrets.HETZNER_HOST }}
|
||||
USER: ${{ secrets.HETZNER_USER }}
|
||||
PASS: ${{ secrets.HETZNER_PASS }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
SSH_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=20"
|
||||
sshpass -p "$PASS" sftp $SSH_OPTS "$USER@$HOST" <<'SFTP'
|
||||
-mkdir dev
|
||||
-mkdir dev/fdroid
|
||||
-mkdir dev/fdroid/repo
|
||||
SFTP
|
||||
sshpass -p "$PASS" scp $SSH_OPTS -r fdroid/. "$USER@$HOST:dev/fdroid/"
|
||||
@@ -5,11 +5,11 @@ See full design spec: `docs/superpowers/specs/2026-06-08-calendar-app-design.md`
|
||||
## V1 Scope (Variant "B")
|
||||
|
||||
### Validated (shipped)
|
||||
- (none yet — first milestone in progress)
|
||||
- Foundation & CI infrastructure — v0.1.0 (2026-06-08)
|
||||
|
||||
### Active (V1)
|
||||
|
||||
- [ ] Foundation & CI infrastructure
|
||||
- [x] Foundation & CI infrastructure
|
||||
- [ ] Data Layer over `CalendarContract`
|
||||
- [ ] Permission flow (`READ_CALENDAR`)
|
||||
- [ ] Month view (S1)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
| Version | Milestone | Status |
|
||||
|---|---|---|
|
||||
| v0.1 | Foundation & CI | in progress |
|
||||
| v0.1 | Foundation & CI | complete |
|
||||
| v0.2 | Data Layer & Permission Flow | pending |
|
||||
| v0.3 | Month view | pending |
|
||||
| v0.4 | Week view | pending |
|
||||
|
||||
@@ -5,17 +5,18 @@
|
||||
## Status
|
||||
|
||||
**Milestone:** v0.1 — Foundation & CI
|
||||
**Phase:** Implementation in progress (Plan 01 active)
|
||||
**Phase:** Plan 01 complete; ready to start Plan 02
|
||||
|
||||
## Progress
|
||||
|
||||
- [x] Design spec written and committed (`docs/superpowers/specs/2026-06-08-calendar-app-design.md`)
|
||||
- [x] V1 design decisions resolved (App name "Calendula", icon, seed color)
|
||||
- [x] Plan 01 written (`docs/superpowers/plans/2026-06-08-01-foundation.md`)
|
||||
- [ ] Plan 01 executed
|
||||
- [x] Plan 01 written and executed (`docs/superpowers/plans/2026-06-08-01-foundation.md`)
|
||||
- [x] Foundation lands: theme, icon, i18n, Hilt, DataStore, CI green
|
||||
- [ ] Plan 02 written (Data Layer & Permission Flow)
|
||||
|
||||
## Next
|
||||
|
||||
1. Execute Plan 01 to land foundation
|
||||
2. Write and execute Plan 02 (Data Layer & Permission Flow)
|
||||
1. Write Plan 02: Data Layer & Permission Flow
|
||||
2. Execute Plan 02
|
||||
3. Iterate on UI design (mockups) before screens are built
|
||||
|
||||
34
CHANGELOG.md
34
CHANGELOG.md
@@ -7,9 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.1.1] — 2026-06-08
|
||||
|
||||
### Fixed
|
||||
- F-Droid metadata format: renamed locale dirs from `de/` to `de-DE/`,
|
||||
`short_description.txt` to `summary.txt`, `full_description.txt` to
|
||||
`description.txt` (fastlane format that fdroidserver actually reads,
|
||||
matching the working HouseHoldKeaper convention)
|
||||
- Added `icon.png` (512x512) per locale; fdroidserver does NOT
|
||||
auto-extract icons from APKs that only contain XML adaptive icons
|
||||
(which is what minSdk-29 apps produce), so the app was rendered
|
||||
blank-iconed in F-Droid clients
|
||||
|
||||
### Changed
|
||||
- CI pipeline cleanup: `lintDebug`/`testDebugUnitTest` instead of full
|
||||
`lint`/`test` (cuts ~50% of lint work since release variant lint is
|
||||
redundant for V1 single-variant build)
|
||||
- Release workflow drops the lint step from its CI-sanity job since
|
||||
the same lint already ran via `ci.yaml` when the underlying commit
|
||||
hit main
|
||||
|
||||
## [0.1.0] — 2026-06-08
|
||||
|
||||
### Added
|
||||
- Initial project scaffold with Material 3 Expressive theme
|
||||
- Adaptive launcher icon (numeral "1" on slate squircle, referencing *kalendae*)
|
||||
- Initial project scaffold (Gradle Kotlin DSL, Version Catalog, Hilt, DataStore)
|
||||
- Material 3 Expressive theme with Dynamic Color (API 31+) and slate-derived fallback
|
||||
- Adaptive launcher icon — stylized "1" on slate squircle (references *kalendae*)
|
||||
- German + English localization infrastructure
|
||||
- Hilt + DataStore dependency injection and preferences setup
|
||||
- Gitea CI/CD workflows for build, test, lint, and release
|
||||
- Permission declaration for `READ_CALENDAR` (no UI flow yet — that's Plan 02)
|
||||
- Gitea CI workflow: lint, unit tests, debug build, Trivy scan
|
||||
- Gitea release workflow: signed release APK + F-Droid metadata sync to Hetzner
|
||||
- F-Droid metadata stubs (DE + EN short/full descriptions)
|
||||
- `.planning/` project-tracking documents
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import java.util.Properties
|
||||
import java.io.FileInputStream
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
@@ -5,9 +8,16 @@ plugins {
|
||||
alias(libs.plugins.hilt)
|
||||
}
|
||||
|
||||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||
val keystoreProperties = Properties().apply {
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
load(FileInputStream(keystorePropertiesFile))
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "de.jeanlucmakiola.calendula"
|
||||
compileSdk = 36
|
||||
compileSdk = 37
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "de.jeanlucmakiola.calendula"
|
||||
@@ -19,6 +29,17 @@ android {
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
create("release") {
|
||||
keyAlias = keystoreProperties["keyAlias"] as String
|
||||
keyPassword = keystoreProperties["keyPassword"] as String
|
||||
storeFile = file(keystoreProperties["storeFile"] as String)
|
||||
storePassword = keystoreProperties["storePassword"] as String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
@@ -27,6 +48,9 @@ android {
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
}
|
||||
debug {
|
||||
applicationIdSuffix = ".debug"
|
||||
@@ -50,7 +74,10 @@ android {
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.all { it.useJUnitPlatform() }
|
||||
unitTests {
|
||||
all { it.useJUnitPlatform() }
|
||||
isReturnDefaultValues = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +90,7 @@ kotlin {
|
||||
dependencies {
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||
implementation(libs.androidx.lifecycle.runtime.compose)
|
||||
implementation(libs.androidx.activity.compose)
|
||||
|
||||
implementation(platform(libs.androidx.compose.bom))
|
||||
@@ -72,10 +100,14 @@ dependencies {
|
||||
implementation(libs.androidx.material3)
|
||||
|
||||
implementation(libs.hilt.android)
|
||||
implementation(libs.androidx.hilt.navigation.compose)
|
||||
ksp(libs.hilt.compiler)
|
||||
|
||||
implementation(libs.androidx.datastore.preferences)
|
||||
|
||||
implementation(libs.kotlinx.datetime)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
|
||||
debugImplementation(libs.androidx.ui.tooling)
|
||||
debugImplementation(libs.androidx.ui.test.manifest)
|
||||
|
||||
@@ -83,9 +115,12 @@ dependencies {
|
||||
testRuntimeOnly(libs.junit.jupiter.engine)
|
||||
testRuntimeOnly(libs.junit.platform.launcher)
|
||||
testImplementation(libs.truth)
|
||||
testImplementation(libs.turbine)
|
||||
testImplementation(libs.kotlinx.coroutines.test)
|
||||
|
||||
androidTestImplementation(libs.androidx.junit)
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
androidTestImplementation(libs.androidx.test.rules)
|
||||
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||
androidTestImplementation(libs.androidx.ui.test.junit4)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package de.jeanlucmakiola.calendula
|
||||
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class MainActivitySmokeTest {
|
||||
|
||||
@get:Rule
|
||||
val composeTestRule = createAndroidComposeRule<MainActivity>()
|
||||
|
||||
@Test
|
||||
fun appName_isDisplayed_onLaunch() {
|
||||
composeTestRule.onNodeWithText("Calendula").assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun tagline_isDisplayed_onLaunch() {
|
||||
composeTestRule.onNodeWithText("A modern calendar.").assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,7 @@
|
||||
tools:targetApi="35">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Calendula">
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package de.jeanlucmakiola.calendula
|
||||
|
||||
import android.app.Application
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
/**
|
||||
* Application entry point. Registered as android:name=".CalendulaApp"
|
||||
* in AndroidManifest.xml. Hilt initializes its component graph here.
|
||||
*/
|
||||
@HiltAndroidApp
|
||||
class CalendulaApp : Application()
|
||||
@@ -0,0 +1,59 @@
|
||||
package de.jeanlucmakiola.calendula
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
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.Scaffold
|
||||
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.tooling.preview.Preview
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import de.jeanlucmakiola.calendula.ui.theme.CalendulaTheme
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContent {
|
||||
CalendulaTheme {
|
||||
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
|
||||
PlaceholderScreen(modifier = Modifier.padding(innerPadding))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PlaceholderScreen(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.app_name),
|
||||
style = MaterialTheme.typography.displayMedium,
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.app_tagline),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun PlaceholderPreview() {
|
||||
CalendulaTheme { PlaceholderScreen() }
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package de.jeanlucmakiola.calendula.data.calendar
|
||||
|
||||
import android.provider.CalendarContract
|
||||
|
||||
internal object CalendarProjection {
|
||||
val COLUMNS: Array<String> = arrayOf(
|
||||
CalendarContract.Calendars._ID,
|
||||
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
|
||||
CalendarContract.Calendars.ACCOUNT_NAME,
|
||||
CalendarContract.Calendars.ACCOUNT_TYPE,
|
||||
CalendarContract.Calendars.CALENDAR_COLOR,
|
||||
CalendarContract.Calendars.VISIBLE,
|
||||
)
|
||||
|
||||
const val IDX_ID = 0
|
||||
const val IDX_DISPLAY_NAME = 1
|
||||
const val IDX_ACCOUNT_NAME = 2
|
||||
const val IDX_ACCOUNT_TYPE = 3
|
||||
const val IDX_COLOR = 4
|
||||
const val IDX_VISIBLE = 5
|
||||
}
|
||||
|
||||
internal object InstanceProjection {
|
||||
val COLUMNS: Array<String> = arrayOf(
|
||||
CalendarContract.Instances._ID,
|
||||
CalendarContract.Instances.EVENT_ID,
|
||||
CalendarContract.Instances.CALENDAR_ID,
|
||||
CalendarContract.Instances.TITLE,
|
||||
CalendarContract.Instances.BEGIN,
|
||||
CalendarContract.Instances.END,
|
||||
CalendarContract.Instances.ALL_DAY,
|
||||
CalendarContract.Instances.EVENT_COLOR,
|
||||
CalendarContract.Instances.CALENDAR_COLOR,
|
||||
CalendarContract.Instances.EVENT_LOCATION,
|
||||
)
|
||||
|
||||
const val IDX_INSTANCE_ID = 0
|
||||
const val IDX_EVENT_ID = 1
|
||||
const val IDX_CALENDAR_ID = 2
|
||||
const val IDX_TITLE = 3
|
||||
const val IDX_BEGIN = 4
|
||||
const val IDX_END = 5
|
||||
const val IDX_ALL_DAY = 6
|
||||
const val IDX_EVENT_COLOR = 7
|
||||
const val IDX_CALENDAR_COLOR = 8
|
||||
const val IDX_LOCATION = 9
|
||||
}
|
||||
|
||||
internal object EventDetailProjection {
|
||||
val COLUMNS: Array<String> = arrayOf(
|
||||
CalendarContract.Events._ID,
|
||||
CalendarContract.Events.TITLE,
|
||||
CalendarContract.Events.DESCRIPTION,
|
||||
CalendarContract.Events.ORGANIZER,
|
||||
CalendarContract.Events.RRULE,
|
||||
CalendarContract.Events.EVENT_COLOR,
|
||||
CalendarContract.Events.CALENDAR_COLOR,
|
||||
CalendarContract.Events.DTSTART,
|
||||
CalendarContract.Events.DTEND,
|
||||
CalendarContract.Events.ALL_DAY,
|
||||
CalendarContract.Events.EVENT_LOCATION,
|
||||
CalendarContract.Events.CALENDAR_ID,
|
||||
)
|
||||
|
||||
const val IDX_EVENT_ID = 0
|
||||
const val IDX_TITLE = 1
|
||||
const val IDX_DESCRIPTION = 2
|
||||
const val IDX_ORGANIZER = 3
|
||||
const val IDX_RRULE = 4
|
||||
const val IDX_EVENT_COLOR = 5
|
||||
const val IDX_CALENDAR_COLOR = 6
|
||||
const val IDX_DTSTART = 7
|
||||
const val IDX_DTEND = 8
|
||||
const val IDX_ALL_DAY = 9
|
||||
const val IDX_LOCATION = 10
|
||||
const val IDX_CALENDAR_ID = 11
|
||||
}
|
||||
|
||||
internal object AttendeeProjection {
|
||||
val COLUMNS: Array<String> = arrayOf(
|
||||
CalendarContract.Attendees.ATTENDEE_NAME,
|
||||
CalendarContract.Attendees.ATTENDEE_EMAIL,
|
||||
CalendarContract.Attendees.ATTENDEE_STATUS,
|
||||
)
|
||||
|
||||
const val IDX_NAME = 0
|
||||
const val IDX_EMAIL = 1
|
||||
const val IDX_STATUS = 2
|
||||
}
|
||||
|
||||
internal object Fallbacks {
|
||||
const val UNNAMED_CALENDAR = "(Unbenannter Kalender)"
|
||||
const val UNTITLED_EVENT = "(Ohne Titel)"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package de.jeanlucmakiola.calendula.data.calendar
|
||||
|
||||
import kotlin.time.Instant
|
||||
|
||||
fun Long.toKotlinInstantFromEpochMillis(): Instant = Instant.fromEpochMilliseconds(this)
|
||||
|
||||
fun Instant.toEpochMillis(): Long = toEpochMilliseconds()
|
||||
@@ -0,0 +1,54 @@
|
||||
package de.jeanlucmakiola.calendula.domain
|
||||
|
||||
import kotlin.time.Instant
|
||||
|
||||
data class CalendarSource(
|
||||
val id: Long,
|
||||
val displayName: String,
|
||||
val accountName: String,
|
||||
val accountType: String,
|
||||
val color: Int,
|
||||
val isVisibleInSystem: Boolean,
|
||||
)
|
||||
|
||||
data class EventInstance(
|
||||
val instanceId: Long,
|
||||
val eventId: Long,
|
||||
val calendarId: Long,
|
||||
val title: String,
|
||||
val start: Instant,
|
||||
val end: Instant,
|
||||
val isAllDay: Boolean,
|
||||
val color: Int,
|
||||
val location: String?,
|
||||
)
|
||||
|
||||
data class EventDetail(
|
||||
val instance: EventInstance,
|
||||
val description: String?,
|
||||
val organizer: String?,
|
||||
val attendees: List<Attendee>,
|
||||
val rrule: String?,
|
||||
)
|
||||
|
||||
data class Attendee(
|
||||
val name: String,
|
||||
val email: String?,
|
||||
val status: AttendeeStatus,
|
||||
)
|
||||
|
||||
enum class AttendeeStatus {
|
||||
Accepted,
|
||||
Declined,
|
||||
Tentative,
|
||||
NeedsAction,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
enum class FailureReason {
|
||||
PermissionRevoked,
|
||||
NoCalendarsConfigured,
|
||||
ProviderUnavailable,
|
||||
EventNotFound,
|
||||
Unknown,
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package de.jeanlucmakiola.calendula.ui.theme
|
||||
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
/**
|
||||
* Seed color anchoring the entire palette. See spec section 12.
|
||||
* Desaturated slate blue-gray; distinct from HouseHoldKeaper's sage.
|
||||
*/
|
||||
val CalendulaSeed: Color = Color(0xFF5C6B7A)
|
||||
|
||||
/**
|
||||
* Fallback light scheme used on devices that don't support dynamic color
|
||||
* (API < 31) or when the user disables it. The real palette is derived by
|
||||
* Material's tonal-palette generator from CalendulaSeed at runtime; these
|
||||
* constants are a hand-picked subset that approximates that result.
|
||||
*/
|
||||
val CalendulaLightFallback = lightColorScheme(
|
||||
primary = Color(0xFF3B5364),
|
||||
onPrimary = Color(0xFFFFFFFF),
|
||||
primaryContainer = Color(0xFFCBE6FA),
|
||||
onPrimaryContainer = Color(0xFF001E2E),
|
||||
secondary = Color(0xFF526070),
|
||||
onSecondary = Color(0xFFFFFFFF),
|
||||
background = Color(0xFFFBFCFE),
|
||||
onBackground = Color(0xFF191C1F),
|
||||
surface = Color(0xFFFBFCFE),
|
||||
onSurface = Color(0xFF191C1F),
|
||||
)
|
||||
|
||||
val CalendulaDarkFallback = darkColorScheme(
|
||||
primary = Color(0xFFA3CBE2),
|
||||
onPrimary = Color(0xFF003348),
|
||||
primaryContainer = Color(0xFF21495F),
|
||||
onPrimaryContainer = Color(0xFFCBE6FA),
|
||||
secondary = Color(0xFFB9C8DA),
|
||||
onSecondary = Color(0xFF243240),
|
||||
background = Color(0xFF101316),
|
||||
onBackground = Color(0xFFE1E3E6),
|
||||
surface = Color(0xFF101316),
|
||||
onSurface = Color(0xFFE1E3E6),
|
||||
)
|
||||
@@ -0,0 +1,40 @@
|
||||
package de.jeanlucmakiola.calendula.ui.theme
|
||||
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
||||
/**
|
||||
* App theme. Honors:
|
||||
* - System light/dark.
|
||||
* - Dynamic Color on API 31+, else falls back to the hand-tuned scheme
|
||||
* derived from [CalendulaSeed].
|
||||
*
|
||||
* The Settings screen (later) can override useDynamicColor and themePreference,
|
||||
* but the V1 foundation just follows the system.
|
||||
*/
|
||||
@Composable
|
||||
fun CalendulaTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
dynamicColor: Boolean = true,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val colorScheme = when {
|
||||
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||
val ctx = LocalContext.current
|
||||
if (darkTheme) dynamicDarkColorScheme(ctx) else dynamicLightColorScheme(ctx)
|
||||
}
|
||||
darkTheme -> CalendulaDarkFallback
|
||||
else -> CalendulaLightFallback
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
typography = CalendulaTypography,
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package de.jeanlucmakiola.calendula.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
|
||||
/**
|
||||
* Default Material 3 Expressive typography. Custom font + tuned scale will
|
||||
* land in a later UI-design iteration; the defaults are intentional for V1
|
||||
* scaffolding to keep the foundation lean.
|
||||
*/
|
||||
val CalendulaTypography = Typography()
|
||||
@@ -0,0 +1,26 @@
|
||||
package de.jeanlucmakiola.calendula.data.calendar
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import kotlin.time.Instant
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class TimeBridgeTest {
|
||||
|
||||
@Test
|
||||
fun `epoch millis round-trips through Instant`() {
|
||||
val original = 1_717_840_800_000L // 2024-06-08T10:00:00Z
|
||||
val instant = original.toKotlinInstantFromEpochMillis()
|
||||
assertThat(instant.toEpochMillis()).isEqualTo(original)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `zero millis maps to Instant epoch`() {
|
||||
assertThat(0L.toKotlinInstantFromEpochMillis()).isEqualTo(Instant.fromEpochMilliseconds(0L))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `negative epoch millis is supported`() {
|
||||
val original = -1_000_000L
|
||||
assertThat(original.toKotlinInstantFromEpochMillis().toEpochMillis()).isEqualTo(original)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package de.jeanlucmakiola.calendula.domain
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import kotlin.time.Instant
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ModelsTest {
|
||||
|
||||
@Test
|
||||
fun `CalendarSource is a data class with structural equality`() {
|
||||
val a = CalendarSource(1L, "Work", "x@y", "com.google", 0xFF112233.toInt(), true)
|
||||
val b = CalendarSource(1L, "Work", "x@y", "com.google", 0xFF112233.toInt(), true)
|
||||
assertThat(a).isEqualTo(b)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `EventInstance is a data class with structural equality`() {
|
||||
val start = Instant.fromEpochMilliseconds(0L)
|
||||
val end = Instant.fromEpochMilliseconds(3_600_000L)
|
||||
val a = EventInstance(10L, 1L, 1L, "Meet", start, end, false, 0xFF000000.toInt(), null)
|
||||
val b = EventInstance(10L, 1L, 1L, "Meet", start, end, false, 0xFF000000.toInt(), null)
|
||||
assertThat(a).isEqualTo(b)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `AttendeeStatus enum has all five variants`() {
|
||||
assertThat(AttendeeStatus.values().toSet()).isEqualTo(
|
||||
setOf(
|
||||
AttendeeStatus.Accepted,
|
||||
AttendeeStatus.Declined,
|
||||
AttendeeStatus.Tentative,
|
||||
AttendeeStatus.NeedsAction,
|
||||
AttendeeStatus.Unknown,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `FailureReason enum has all five variants`() {
|
||||
assertThat(FailureReason.values().toSet()).isEqualTo(
|
||||
setOf(
|
||||
FailureReason.PermissionRevoked,
|
||||
FailureReason.NoCalendarsConfigured,
|
||||
FailureReason.ProviderUnavailable,
|
||||
FailureReason.EventNotFound,
|
||||
FailureReason.Unknown,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `EventDetail composes EventInstance plus extras`() {
|
||||
val instance = EventInstance(
|
||||
instanceId = 10L,
|
||||
eventId = 1L,
|
||||
calendarId = 1L,
|
||||
title = "Meet",
|
||||
start = Instant.fromEpochMilliseconds(0L),
|
||||
end = Instant.fromEpochMilliseconds(60_000L),
|
||||
isAllDay = false,
|
||||
color = 0xFFAABBCC.toInt(),
|
||||
location = null,
|
||||
)
|
||||
val detail = EventDetail(
|
||||
instance = instance,
|
||||
description = "Brief description",
|
||||
organizer = "x@y",
|
||||
attendees = listOf(Attendee("Alice", "alice@x", AttendeeStatus.Accepted)),
|
||||
rrule = "FREQ=WEEKLY",
|
||||
)
|
||||
assertThat(detail.instance.title).isEqualTo("Meet")
|
||||
assertThat(detail.attendees).hasSize(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package de.jeanlucmakiola.calendula.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ColorSchemeTest {
|
||||
|
||||
@Test
|
||||
fun `seed color matches design spec slate`() {
|
||||
// The seed color must remain stable - the design is anchored to it.
|
||||
// Change this only if the spec is updated.
|
||||
assertThat(CalendulaSeed).isEqualTo(Color(0xFF5C6B7A))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `light fallback scheme uses seed as primary derivation source`() {
|
||||
val scheme = CalendulaLightFallback
|
||||
// Primary should be a recognizable derivative of the seed (not neutral gray)
|
||||
assertThat(scheme.primary).isNotEqualTo(Color.Black)
|
||||
assertThat(scheme.primary).isNotEqualTo(Color.White)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `dark fallback scheme differs from light`() {
|
||||
assertThat(CalendulaDarkFallback.background).isNotEqualTo(CalendulaLightFallback.background)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
BIN
fdroid-metadata/de.jeanlucmakiola.calendula/de-DE/icon.png
Normal file
BIN
fdroid-metadata/de.jeanlucmakiola.calendula/de-DE/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
fdroid-metadata/de.jeanlucmakiola.calendula/en-US/icon.png
Normal file
BIN
fdroid-metadata/de.jeanlucmakiola.calendula/en-US/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
@@ -17,6 +17,12 @@ junitPlatform = "6.1.0"
|
||||
truth = "1.4.5"
|
||||
androidxJunit = "1.3.0"
|
||||
espressoCore = "3.7.0"
|
||||
kotlinxDatetime = "0.7.0"
|
||||
kotlinxCoroutines = "1.10.2"
|
||||
turbine = "1.2.0"
|
||||
hiltNavigationCompose = "1.3.0"
|
||||
lifecycleCompose = "2.10.0"
|
||||
androidxTestRules = "1.7.0"
|
||||
|
||||
[libraries]
|
||||
# AndroidX core
|
||||
@@ -53,6 +59,25 @@ truth = { group = "com.google.truth", name = "truth", version.ref = "truth" }
|
||||
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidxJunit" }
|
||||
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||
|
||||
# Domain time
|
||||
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" }
|
||||
|
||||
# Coroutines (transitively pulled by hilt-android, pinned explicit)
|
||||
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
|
||||
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
|
||||
|
||||
# Test - Flow assertions
|
||||
turbine = { group = "app.cash.turbine", name = "turbine", version.ref = "turbine" }
|
||||
|
||||
# Hilt navigation-compose (for hiltViewModel() in Composables)
|
||||
androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" }
|
||||
|
||||
# Lifecycle compose (for collectAsStateWithLifecycle)
|
||||
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycleCompose" }
|
||||
|
||||
# Android tests - GrantPermissionRule
|
||||
androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidxTestRules" }
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
|
||||
Reference in New Issue
Block a user