commit 6d63d9276676427aff5ec30bd4ff353927e52e51 Author: Mateusz Pstrucha Date: Tue Sep 22 19:01:07 2026 +0200 Initial Android app scaffold Compose + Material 3 with dynamic color and the branding palette as static fallback, edge-to-edge drawing, SplashScreen API, and predictive back. Adaptive launcher icon includes a monochrome variant for themed icons; the mark itself is a placeholder pending icon design. No Play Services or Firebase anywhere in the dependency tree, verified against the resolved runtime classpath. Co-Authored-By: Claude Opus 5 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1573a77 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*.iml +.gradle +/local.properties +/.idea +.DS_Store +/build +/app/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/README.md b/README.md new file mode 100644 index 0000000..ee8ea36 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# tern-android + +Android client for [Tern](../) — see [`docs/android-client-spec.md`](docs/android-client-spec.md) and [`docs/branding-spec.md`](docs/branding-spec.md). + +**Status: thin scaffold.** The server (IMAP sync + REST API) was the priority for this first pass, and the Android client is the last item in the build order anyway (`server-architecture-spec.md` §9, item 8). What's here: + +- Jetpack Compose + Material 3, Kotlin, no Play Services/Firebase anywhere in the dependency tree (§7 — hard constraint). +- Dynamic color (Material You) with the branding doc's static palette as the fallback (§2). +- Edge-to-edge drawing, `SplashScreen` API, predictive back enabled in the manifest (§3, §6). +- Adaptive-layout dependencies present for the list-detail scaffold (§4), not yet used. +- Adaptive launcher icon with a **monochrome/themed variant** (§2 / branding §2) — placeholder wing mark, since the real icon design is still an open item in the branding doc. +- `allowBackup="false"` — the mail cache shouldn't land in cloud backups (§7). + +**Not built yet:** the list-detail mail UI, Room cache, UnifiedPush receiver + `MessagingStyle` notifications, swipe actions, biometric app-lock, first-run/account-setup flow. All of those depend on client-facing server work that also isn't finished. + +## Building + +```bash +./gradlew assembleDebug +``` + +Needs an Android SDK (`ANDROID_HOME` / `local.properties`). Version pins (AGP 8.7, Kotlin 2.0.21, Compose BOM 2024.10.01, compileSdk 35) are deliberately conservative — Android Studio may offer an AGP upgrade on first open, which is fine to accept. diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..50c6cf4 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,75 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("org.jetbrains.kotlin.plugin.compose") +} + +android { + namespace = "pl.mtps.tern" + compileSdk = 35 + + defaultConfig { + applicationId = "pl.mtps.tern" + // GrapheneOS/modern-Pixel-only target (android-client-spec.md §1) — + // no need to support old platform versions for a from-scratch app. + minSdk = 29 + targetSdk = 35 + versionCode = 1 + versionName = "0.1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } + + buildFeatures { + compose = true + } + + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + implementation(platform("androidx.compose:compose-bom:2024.10.01")) + + implementation("androidx.core:core-ktx:1.13.1") + implementation("androidx.core:core-splashscreen:1.0.1") // Android 12+ SplashScreen API (§6) + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7") + implementation("androidx.activity:activity-compose:1.9.3") + + implementation("androidx.compose.ui:ui") + implementation("androidx.compose.ui:ui-graphics") + implementation("androidx.compose.ui:ui-tooling-preview") + implementation("androidx.compose.material3:material3") + implementation("androidx.compose.material3.adaptive:adaptive:1.0.0") + implementation("androidx.compose.material3.adaptive:adaptive-layout:1.0.0") + implementation("androidx.compose.material3.adaptive:adaptive-navigation:1.0.0") + implementation("androidx.compose.material:material-icons-core") + + debugImplementation("androidx.compose.ui:ui-tooling") + debugImplementation("androidx.compose.ui:ui-test-manifest") + + testImplementation("junit:junit:4.13.2") + androidTestImplementation(platform("androidx.compose:compose-bom:2024.10.01")) + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") + androidTestImplementation("androidx.compose.ui:ui-test-junit4") +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..76af304 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,2 @@ +# Add project-specific ProGuard rules here as the app grows. +# https://developer.android.com/build/shrink-code diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..cf91836 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/pl/mtps/tern/MainActivity.kt b/app/src/main/java/pl/mtps/tern/MainActivity.kt new file mode 100644 index 0000000..fb36e15 --- /dev/null +++ b/app/src/main/java/pl/mtps/tern/MainActivity.kt @@ -0,0 +1,47 @@ +package pl.mtps.tern + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +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.Modifier +import androidx.compose.ui.unit.dp +import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen +import pl.mtps.tern.ui.theme.TernTheme + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + installSplashScreen() + // Draw behind status bar and gesture nav area (§3) — Scaffold below + // handles the inset padding. + enableEdgeToEdge() + super.onCreate(savedInstanceState) + + setContent { + TernTheme { + Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> + PlaceholderScreen(Modifier.padding(innerPadding)) + } + } + } + } +} + +@Composable +private fun PlaceholderScreen(modifier: Modifier = Modifier) { + Column(modifier = modifier.padding(16.dp)) { + Text(text = "Tern", style = MaterialTheme.typography.headlineMedium) + Text( + text = "Scaffold only. The list-detail mail UI, UnifiedPush notifications, " + + "and the local Room cache land in a later phase.", + style = MaterialTheme.typography.bodyMedium, + ) + } +} diff --git a/app/src/main/java/pl/mtps/tern/TernApplication.kt b/app/src/main/java/pl/mtps/tern/TernApplication.kt new file mode 100644 index 0000000..fadb1d2 --- /dev/null +++ b/app/src/main/java/pl/mtps/tern/TernApplication.kt @@ -0,0 +1,5 @@ +package pl.mtps.tern + +import android.app.Application + +class TernApplication : Application() diff --git a/app/src/main/java/pl/mtps/tern/ui/theme/Color.kt b/app/src/main/java/pl/mtps/tern/ui/theme/Color.kt new file mode 100644 index 0000000..6f9f5c4 --- /dev/null +++ b/app/src/main/java/pl/mtps/tern/ui/theme/Color.kt @@ -0,0 +1,24 @@ +package pl.mtps.tern.ui.theme + +import androidx.compose.ui.graphics.Color + +// Static fallback palette from branding-spec.md §1. Only used when dynamic +// color isn't available — when it is, the system wallpaper palette takes over +// (android-client-spec.md §2). +// +// Note: the branding doc calls for deriving a full M3 tonal scheme from these +// five seeds (via Material Theme Builder, seeding on --accent) rather than +// hand-placing raw values into color roles. These raw values are a +// placeholder until that generation step happens. + +val LightText = Color(0xFF0C0A10) +val LightBackground = Color(0xFFF4F3F7) +val LightPrimary = Color(0xFF988FA8) +val LightSecondary = Color(0xFFC3C7D5) +val LightAccent = Color(0xFFF39A39) + +val DarkText = Color(0xFFF1EFF5) +val DarkBackground = Color(0xFF09080C) +val DarkPrimary = Color(0xFF605770) +val DarkSecondary = Color(0xFF2A2E3C) +val DarkAccent = Color(0xFFC66C0C) diff --git a/app/src/main/java/pl/mtps/tern/ui/theme/Theme.kt b/app/src/main/java/pl/mtps/tern/ui/theme/Theme.kt new file mode 100644 index 0000000..83285fa --- /dev/null +++ b/app/src/main/java/pl/mtps/tern/ui/theme/Theme.kt @@ -0,0 +1,59 @@ +package pl.mtps.tern.ui.theme + +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +enum class ThemeMode { LIGHT, DARK, SYSTEM } + +private val LightColors = lightColorScheme( + primary = LightPrimary, + secondary = LightSecondary, + tertiary = LightAccent, + background = LightBackground, + surface = LightBackground, + onBackground = LightText, + onSurface = LightText, +) + +private val DarkColors = darkColorScheme( + primary = DarkPrimary, + secondary = DarkSecondary, + tertiary = DarkAccent, + background = DarkBackground, + surface = DarkBackground, + onBackground = DarkText, + onSurface = DarkText, +) + +@Composable +fun TernTheme( + themeMode: ThemeMode = ThemeMode.SYSTEM, + // Material You wallpaper-derived color where available (§2), static + // brand palette otherwise. + dynamicColor: Boolean = true, + content: @Composable () -> Unit, +) { + val darkTheme = when (themeMode) { + ThemeMode.LIGHT -> false + ThemeMode.DARK -> true + ThemeMode.SYSTEM -> isSystemInDarkTheme() + } + + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + darkTheme -> DarkColors + else -> LightColors + } + + MaterialTheme(colorScheme = colorScheme, content = content) +} diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..c86a612 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,9 @@ + + + + + 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..b856702 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_monochrome.xml b/app/src/main/res/drawable/ic_launcher_monochrome.xml new file mode 100644 index 0000000..b88b0a2 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_monochrome.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..8fde456 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..8fde456 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.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..6b310ec --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #F4F3F7 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..5fe7298 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Tern + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..3565fa2 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,12 @@ + + + + +