commit adfd95fc38d7891f58f2644ba00740b9b72479e6 Author: Hadrian Burkhardt Date: Wed Oct 14 14:55:10 2026 +0200 M0: project scaffold (Gradle 9.3.1 / AGP 9.1.0, Compose shell, storage permissions) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e09e2e --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +# Android / Gradle +*.iml +.gradle/ +.kotlin/ +/local.properties +/.idea/ +.DS_Store +build/ +/captures +.externalNativeBuild +.cxx + +# Build outputs +*.apk +*.aab +*.ap_ +*.dex + +# Signing material — never commit keys! +*.keystore +*.jks +keystore.properties +!debug.keystore + +# Generated data — regenerated on demand, never committed +fixtures/ +store-assets/raw-screenshots/ +demo-files/ + +# Note that the *finished* store assets are not ignored: the icon, the feature graphic and +# `store-assets/screenshots/` are committed beside the code that produces them. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4b5f9ee --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to File Manager are documented in this file. + +The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the +project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +`versionCode` and `versionName` are defined in `app/build.gradle.kts`. Each Play +upload needs a **higher `versionCode`** than every previous upload. + +## [Unreleased] + +### Added + +- **M0 — project scaffold.** Gradle 9.3.1 / AGP 9.1.0 build with a version catalog, + `de.softwareapp_hb.filemanager` app module, a Compose Material 3 shell with the + branded blue theme (dynamic colour on Android 12+), an adaptive launcher icon, and + the storage-access permission set (all files access + SAF fallback). Debug APK + builds, installs and runs on an AOSP Android 12 AVD. diff --git a/README.md b/README.md new file mode 100644 index 0000000..684e794 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# File Manager + +An **ad-free**, **one-time-paid** Android file manager. It browses and manages the +files on your device — locally, with no ads, no account and no analytics. + +Nothing ever leaves the device: the app declares no network permission and contains +no advertising or tracking SDKs. + +> **Working title.** The display name and the store listing are decided before the +> first Play upload (see [docs/ROADMAP.md](docs/ROADMAP.md), M10). The `applicationId` +> is already fixed and can never change after the first release. + +## Status + +**M0 — toolchain & scaffold: done.** The project builds, installs and runs a themed +Compose shell. See [docs/ROADMAP.md](docs/ROADMAP.md) for the full milestone plan. + +## Tech stack + +| Area | Choice | +|---|---| +| Language | Kotlin 2.4.10 (using AGP 9 *built-in Kotlin*) | +| UI | Jetpack Compose, BOM 2026.06.01, Material 3 | +| Build | Gradle 9.3.1, Android Gradle Plugin 9.1.0 | +| Storage access | `MANAGE_EXTERNAL_STORAGE` ("All files access") with a Storage Access Framework fallback | +| Archives | Apache Commons Compress (pure Java — no NDK) | +| SDK levels | `compileSdk`/`targetSdk` 36, `minSdk` 26 | + +`targetSdk` is 36 because Google Play requires new apps and updates to target +Android 16 (API 36) from 31 August 2026. + +## Project layout + +``` +app/src/main/java/de/softwareapp_hb/filemanager/ +├── core/ Pure-Kotlin engine (no Android imports!) — paths, sorting, formatting, +│ search matching, copy/move planning, conflict policy +├── data/ Storage backends (all-files access + SAF), volumes, bookmarks, +│ file operations, archives, deletion +├── domain/ Browser + operation controllers, models, permission state +├── service/ Foreground service for long-running file operations +├── ui/ Compose theme, browser screen, components, ViewModels +└── text/ Domain enum → string-resource mapping +app/src/test/java/… JVM unit tests for the core engine +``` + +`core/` deliberately has **no Android dependencies**, so the trickiest logic is +covered by fast JVM tests. + +## Building + +Prerequisites: + +- JDK 17+ (JDK 25 verified) +- Android SDK with `platforms;android-36` and `build-tools;36.0.0` + +```bash +# Tell Gradle where the SDK lives (this file is git-ignored) +echo "sdk.dir=$HOME/Android/Sdk" > local.properties + +./gradlew :app:assembleDebug # debug APK +./gradlew :app:testDebugUnitTest # JVM unit tests for the engine +./gradlew :app:lintDebug # Android Lint +./gradlew :app:bundleRelease # Play upload bundle (.aab) +``` + +Release signing is optional and driven by a git-ignored `keystore.properties` +(see `keystore.properties.example`); without it the release build still runs +R8/minification but produces an unsigned artefact. + +## Tracked in git + +- Source, resources and Gradle build files. +- `docs/` — roadmap and release documentation. +- `PRIVACY.md`, `CHANGELOG.md`, and (from M10) `store-assets/`. + +Not tracked: `local.properties`, `keystore.properties`, `*.jks`, build outputs. + +## Licence + +Proprietary — all rights reserved. diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..b7d0372 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,186 @@ +import java.util.Properties +import org.gradle.api.tasks.testing.Test + +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.compose) +} + +// Optional release signing. +// +// Create a `keystore.properties` file in the project ROOT (it is git-ignored; see +// keystore.properties.example) with: +// +// storeFile=/absolute/path/to/upload-keystore.jks +// storePassword=******** +// keyAlias=upload +// keyPassword=******** +// +// Without that file the release build still runs R8/minification but produces an +// unsigned APK, which is fine for local checks but cannot be uploaded to Play. +val keystorePropertiesFile = rootProject.file("keystore.properties") +val keystoreProperties = Properties().apply { + if (keystorePropertiesFile.exists()) { + keystorePropertiesFile.inputStream().use { load(it) } + } +} +val hasReleaseSigning = keystoreProperties.getProperty("storeFile") != null + +if (hasReleaseSigning) { + // Fail early and readably instead of letting signReleaseBundle blow up later + // with an opaque NullPointerException. + val missing = listOf("storePassword", "keyAlias") + .filter { keystoreProperties.getProperty(it).isNullOrBlank() } + check(missing.isEmpty()) { + "keystore.properties is incomplete — missing: ${missing.joinToString()}" + } +} + +android { + namespace = "de.softwareapp_hb.filemanager" + compileSdk = 36 + + defaultConfig { + applicationId = "de.softwareapp_hb.filemanager" + minSdk = 26 + targetSdk = 36 + versionCode = 1 + versionName = "1.0.0" + + vectorDrawables { + useSupportLibrary = true + } + } + + signingConfigs { + if (hasReleaseSigning) { + create("release") { + storeFile = file(keystoreProperties.getProperty("storeFile")) + storePassword = keystoreProperties.getProperty("storePassword") + keyAlias = keystoreProperties.getProperty("keyAlias") + // Falls back to the store password. That matches reality: PKCS12 + // keystores (the default on modern JDKs) cannot have a key password + // that differs from the store password, and leaving this null makes + // AGP's signReleaseBundle crash with an NPE. + keyPassword = keystoreProperties.getProperty("keyPassword") + ?: keystoreProperties.getProperty("storePassword") + } + } + } + + buildTypes { + debug { + applicationIdSuffix = ".debug" + versionNameSuffix = "-debug" + } + release { + if (hasReleaseSigning) { + signingConfig = signingConfigs.getByName("release") + } + isMinifyEnabled = true + isShrinkResources = true + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro", + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + buildFeatures { + compose = true + } + + testOptions { + unitTests { + // Robolectric needs the merged resources and manifest to stand up the framework. + isIncludeAndroidResources = true + } + } + + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } + + lint { + // Dependency versions are pinned deliberately — Compose 1.12+/Coil 3.6+ need + // compileSdk 37, which AGP 9.1 does not support yet (see the README version + // note). These advisories are noise rather than signal here. + disable += setOf( + "GradleDependency", + "AndroidGradlePluginVersion", + "NewerVersionAvailable", + ) + } +} + +kotlin { + compilerOptions { + // With AGP built-in Kotlin this already defaults to + // android.compileOptions.targetCompatibility; set explicitly for clarity. + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + +// Robolectric reflects into JDK internals (notably java.io.FileDescriptor), which the module +// system blocks from JDK 17 onwards. Without these it fails with "Failed to interact with raw +// FileDescriptor internals". +tasks.withType().configureEach { + jvmArgs( + "--add-opens=java.base/java.io=ALL-UNNAMED", + "--add-opens=java.base/java.lang=ALL-UNNAMED", + "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED", + "--add-opens=java.base/java.util=ALL-UNNAMED", + "--add-opens=java.base/java.text=ALL-UNNAMED", + "--add-opens=java.base/java.nio=ALL-UNNAMED", + "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED", + // Robolectric reaches FileDescriptor internals through jdk.internal.access.SharedSecrets, and + // that needs an *export* rather than an *open*: without it the run dies with + // "IllegalAccessException ... module java.base does not export jdk.internal.access". + "--add-exports=java.base/jdk.internal.access=ALL-UNNAMED", + "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", + "--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED", + ) + maxHeapSize = "2g" + testLogging { showStandardStreams = true } +} + +dependencies { + implementation(libs.androidx.core.ktx) + // SAF backend for the "All files access denied" fallback path. + implementation(libs.androidx.documentfile) + + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.lifecycle.runtime.compose) + implementation(libs.androidx.lifecycle.viewmodel.compose) + + implementation(libs.androidx.activity.compose) + + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.graphics) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.material3) + implementation(libs.androidx.compose.material.icons.core) + implementation(libs.androidx.compose.material.icons.extended) + + implementation(libs.kotlinx.coroutines.android) + + // Image loading for thumbnails and the built-in image viewer. + implementation(libs.coil.compose) + + // ZIP/TAR/GZ archive support. Pure Java — no native code, no NDK. + implementation(libs.commons.compress) + + debugImplementation(libs.androidx.compose.ui.tooling) + + testImplementation(libs.junit) + // Runs the real Android framework on the JVM, so the data layer is testable without a device. + testImplementation(libs.robolectric) +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..38c1caa --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# ProGuard/R8 rules for the release build. +# +# The app relies on reflection only indirectly (Compose, Coil, AndroidX ship their +# own consumer rules), so we keep this list intentionally short. + +# Keep line numbers so crash reports stay readable without the original class names. +-keepattributes SourceFile,LineNumberTable +-renamesourcefileattribute SourceFile + +# Coroutines: keep the internal classes R8 sometimes struggles to strip correctly. +-dontwarn kotlinx.coroutines.** + +# Commons Compress discovers codecs and archive formats reflectively in a few +# places; keep the annotated and provider classes so extraction keeps working +# after shrinking. +-keep class org.apache.commons.compress.** { *; } +-dontwarn org.apache.commons.compress.** diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d131230 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/de/softwareapp_hb/filemanager/FileManagerApplication.kt b/app/src/main/java/de/softwareapp_hb/filemanager/FileManagerApplication.kt new file mode 100644 index 0000000..a65aa98 --- /dev/null +++ b/app/src/main/java/de/softwareapp_hb/filemanager/FileManagerApplication.kt @@ -0,0 +1,13 @@ +package de.softwareapp_hb.filemanager + +import android.app.Application + +/** + * Application entry point. + * + * Deliberately lightweight: the app has no dependency-injection graph, no analytics + * and no network access. From M2 this will own the browser/operations controller so + * that navigation and long-running file operations survive activity recreation; the + * storage layer and preference stores are opened lazily where they are used. + */ +class FileManagerApplication : Application() diff --git a/app/src/main/java/de/softwareapp_hb/filemanager/MainActivity.kt b/app/src/main/java/de/softwareapp_hb/filemanager/MainActivity.kt new file mode 100644 index 0000000..806446c --- /dev/null +++ b/app/src/main/java/de/softwareapp_hb/filemanager/MainActivity.kt @@ -0,0 +1,29 @@ +package de.softwareapp_hb.filemanager + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.ui.Modifier +import de.softwareapp_hb.filemanager.ui.browser.BrowserScreen +import de.softwareapp_hb.filemanager.ui.theme.FileManagerTheme + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + enableEdgeToEdge() + super.onCreate(savedInstanceState) + setContent { + FileManagerTheme { + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colorScheme.background, + ) { + BrowserScreen() + } + } + } + } +} diff --git a/app/src/main/java/de/softwareapp_hb/filemanager/ui/browser/BrowserScreen.kt b/app/src/main/java/de/softwareapp_hb/filemanager/ui/browser/BrowserScreen.kt new file mode 100644 index 0000000..f74b91d --- /dev/null +++ b/app/src/main/java/de/softwareapp_hb/filemanager/ui/browser/BrowserScreen.kt @@ -0,0 +1,56 @@ +package de.softwareapp_hb.filemanager.ui.browser + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +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.unit.dp +import de.softwareapp_hb.filemanager.R + +/** + * The browser screen. + * + * M0 scaffold: it establishes the Compose shell (edge-to-edge scaffold, themed top + * bar, empty state) that the storage layer and file list will be wired into in M2/M4. + */ +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun BrowserScreen(modifier: Modifier = Modifier) { + Scaffold( + modifier = modifier.fillMaxSize(), + topBar = { + TopAppBar(title = { Text(text = stringResource(R.string.app_name)) }) + }, + ) { innerPadding -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(innerPadding) + .padding(horizontal = 32.dp), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, + ) { + Text( + text = stringResource(R.string.empty_state_title), + style = MaterialTheme.typography.titleLarge, + ) + Spacer(Modifier.height(8.dp)) + Text( + text = stringResource(R.string.empty_state_body), + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } + } +} diff --git a/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Color.kt b/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Color.kt new file mode 100644 index 0000000..3a7afc4 --- /dev/null +++ b/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Color.kt @@ -0,0 +1,27 @@ +package de.softwareapp_hb.filemanager.ui.theme + +import androidx.compose.ui.graphics.Color + +// Brand palette: a calm blue ("files and folders") accent with a teal secondary. +// Only the roles the app actually uses are overridden; the rest come from the +// Material 3 baseline, which keeps the scheme consistent. + +val BluePrimaryLight = Color(0xFF1565C0) +val BlueOnPrimaryLight = Color(0xFFFFFFFF) +val BlueContainerLight = Color(0xFFD6E3FF) +val BlueOnContainerLight = Color(0xFF001B3D) +val TealSecondaryLight = Color(0xFF00696E) +val SurfaceLight = Color(0xFFFFFBFE) +val SurfaceVariantLight = Color(0xFFE0E2EC) +val OnSurfaceLight = Color(0xFF1A1C1E) +val ErrorLight = Color(0xFFBA1A1A) + +val BluePrimaryDark = Color(0xFFA8C8FF) +val BlueOnPrimaryDark = Color(0xFF00315F) +val BlueContainerDark = Color(0xFF004787) +val BlueOnContainerDark = Color(0xFFD6E3FF) +val TealSecondaryDark = Color(0xFF4CDADE) +val SurfaceDark = Color(0xFF111318) +val SurfaceVariantDark = Color(0xFF44474E) +val OnSurfaceDark = Color(0xFFE2E2E6) +val ErrorDark = Color(0xFFFFB4AB) diff --git a/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Theme.kt b/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Theme.kt new file mode 100644 index 0000000..8c4bb58 --- /dev/null +++ b/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Theme.kt @@ -0,0 +1,64 @@ +package de.softwareapp_hb.filemanager.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 + +private val LightColors = lightColorScheme( + primary = BluePrimaryLight, + onPrimary = BlueOnPrimaryLight, + primaryContainer = BlueContainerLight, + onPrimaryContainer = BlueOnContainerLight, + secondary = TealSecondaryLight, + background = SurfaceLight, + surface = SurfaceLight, + surfaceVariant = SurfaceVariantLight, + onSurface = OnSurfaceLight, + error = ErrorLight, +) + +private val DarkColors = darkColorScheme( + primary = BluePrimaryDark, + onPrimary = BlueOnPrimaryDark, + primaryContainer = BlueContainerDark, + onPrimaryContainer = BlueOnContainerDark, + secondary = TealSecondaryDark, + background = SurfaceDark, + surface = SurfaceDark, + surfaceVariant = SurfaceVariantDark, + onSurface = OnSurfaceDark, + error = ErrorDark, +) + +/** + * App theme. Uses Material You dynamic colour on Android 12+ when available and + * falls back to the branded blue scheme otherwise. + */ +@Composable +fun FileManagerTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + dynamicColor: Boolean = true, + content: @Composable () -> Unit, +) { + 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, + typography = FileManagerTypography, + content = content, + ) +} diff --git a/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Type.kt b/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Type.kt new file mode 100644 index 0000000..44273fb --- /dev/null +++ b/app/src/main/java/de/softwareapp_hb/filemanager/ui/theme/Type.kt @@ -0,0 +1,9 @@ +package de.softwareapp_hb.filemanager.ui.theme + +import androidx.compose.material3.Typography + +/** + * The app sticks with the Material 3 default type scale; a dedicated object keeps + * a single place to tune typography later. + */ +val FileManagerTypography = Typography() 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..a0c1e46 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,10 @@ + + + + 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..2c54a32 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_notification.xml b/app/src/main/res/drawable/ic_notification.xml new file mode 100644 index 0000000..519b9de --- /dev/null +++ b/app/src/main/res/drawable/ic_notification.xml @@ -0,0 +1,15 @@ + + + + + + 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..b3e26b4 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml new file mode 100644 index 0000000..b3e26b4 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml new file mode 100644 index 0000000..50fe6aa --- /dev/null +++ b/app/src/main/res/values-night/colors.xml @@ -0,0 +1,5 @@ + + + #111318 + #1565C0 + diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..3cf2d56 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,9 @@ + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f9914d5 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #FFFBFE + #1565C0 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..79a616f --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,16 @@ + + + File Manager + + + Your files, without the clutter + Ad-free, account-free and completely offline. Browsing is wired up next. + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..6c570c6 --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..c86f570 --- /dev/null +++ b/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..d32ddbb --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..0b90cd8 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,10 @@ +// Top-level build file. Plugins are declared here (without applying them) so the +// versions are resolved once for the whole build, and applied per-module. +// +// NOTE: since AGP 9.0 Kotlin support is built into AGP ("built-in Kotlin"), so the +// `org.jetbrains.kotlin.android` plugin must NOT be applied anymore. Only the +// Compose compiler plugin is still applied explicitly. +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.compose) apply false +} diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md new file mode 100644 index 0000000..4b52d65 --- /dev/null +++ b/docs/ROADMAP.md @@ -0,0 +1,38 @@ +# Roadmap + +File Manager is built against a fixed milestone plan (**M0–M10**). This file is the +single source of truth for what is done and what remains. + +Legend: ✅ done · 🚧 in progress · ⏳ not started · 💡 candidate (proposed, not scheduled) + +## Milestones + +| # | Milestone | Status | Evidence / notes | +|---|---|---|---| +| M0 | Toolchain & scaffold | ✅ | Gradle 9.3.1 + AGP 9.1.0 wrapper, version catalog, app module, Compose theme, debug APK builds, installs and runs on the `phone` AVD: package `de.softwareapp_hb.filemanager.debug`, `versionCode 1`, `minSdk 26`/`targetSdk 36`, **no `INTERNET` permission**, `lintDebug` clean (one expected `UnusedResources` for the not-yet-used notification icon) | +| M1 | Pure-Kotlin core + JVM tests | ⏳ | `StoragePath`/`FileEntry`, sort comparators, name/MIME/category classification, human-readable size/date, search matcher, copy/move planner, conflict policy — `core/` has **no Android imports** | +| M2 | Storage layer | ⏳ | `StorageSource` interface with `AllFilesSource` (`MANAGE_EXTERNAL_STORAGE`) and `SafSource` (persisted tree URIs); `VolumeRepository` (`StorageManager`/`StorageVolume`, `StatFs`); permission + all-files-access state machine | +| M3 | Operations engine + service | ⏳ | create/rename/copy/move/delete, recursive copy with progress + cancellation, conflict resolution, trash via MediaStore, foreground service + progress notification | +| M4 | Compose UI | ⏳ | browser list/grid, breadcrumb + up navigation, sort/filter sheet, multi-select action bar, details sheet, permission prompts, theme | +| M5 | Analysis, archives, viewers | ⏳ | disk-usage analysis, large-file finder, ZIP/TAR/GZ via Commons Compress, image viewer, text editor | +| M6 | Release config & Play readiness | ⏳ | R8/minify, optional signing, `.aab`; [PLAY_RELEASE_CHECKLIST](PLAY_RELEASE_CHECKLIST.md) (incl. the **Permissions Declaration Form**), [PRIVACY.md](../PRIVACY.md), README | +| M7 | On-device validation & hardening | ⏳ | AVD + real-device checks, per-operation error boundaries, edge-case fixtures | +| M8 | Localisation groundwork | ⏳ | every user-visible string in `res/values/strings.xml` with real ``; `text/` mapping | +| M9 | Monetisation | ⏳ | **one-time paid** — price set only in the Play Console before the first upload; no Billing code and no `BILLING` permission | +| M10 | Store assets | ⏳ | icon/feature-graphic generators, per-form-factor screenshots, [STORE_LISTING](STORE_LISTING.md); display name confirmed | + +## Key decisions + +| Decision | Choice | Rationale | +|---|---|---| +| Language / UI | Kotlin + Jetpack Compose | Mirrors the sibling app's proven, installed toolchain; no NDK | +| Storage access | `MANAGE_EXTERNAL_STORAGE` first, SAF fallback | Google Play explicitly permits "All files access" for file managers; SAF keeps the app usable if the user declines | +| Connectivity | Local-first (no `INTERNET` in v1) | Preserves the "nothing leaves the device" claim and keeps the Data Safety form trivial | +| Monetisation | One-time paid, price in Console | No Billing code; free → paid is impossible after the first upload, so the price must be set beforehand | + +## Deliberately deferred (post-1.0) + +- Dual-pane view; cloud storage (Drive/OneDrive/Dropbox/…); network clients + (SMB/FTP/SFTP/WebDAV); FTP/Web server. +- App manager (`QUERY_ALL_PACKAGES`), APK installation (`REQUEST_INSTALL_PACKAGES`). +- RAR/7z archives; root explorer; encryption vault; themes/icon packs. diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..620f1c7 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,20 @@ +# Project-wide Gradle settings. + +# JVM memory for the Gradle daemon (large Android builds need headroom). +org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8 + +# Build performance. +org.gradle.parallel=true +org.gradle.caching=true + +# AndroidX is required for Jetpack libraries. +android.useAndroidX=true + +# Only generate R class entries for the module's own resources (faster builds). +android.nonTransitiveRClass=true + +# Let the Android Gradle Plugin auto-download any missing SDK components +# (platform/build-tools) using the licenses that were accepted during setup. +android.builder.sdkDownload=true + +kotlin.code.style=official diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..527f4bf --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,62 @@ +[versions] +agp = "9.1.0" +kotlin = "2.4.10" + +# AndroidX / Compose +coreKtx = "1.18.0" +lifecycle = "2.10.0" +activityCompose = "1.13.0" +# SAF backend: DocumentFile over a persisted tree URI. +documentfile = "1.1.0" +# Compose BOM 2026.06.01 -> Compose UI/foundation 1.11.4, material3 1.4.0. +# Newer BOMs (2026.08.00+) ship Compose 1.12.x, which requires compileSdk 37 — +# that is newer than what AGP 9.1.0 supports (36) and newer than the API level +# Google Play requires for targetSdk, so we deliberately stay on 1.11.4. +composeBom = "2026.06.01" +# Coil 3.6.x requires compileSdk 37; 3.5.0 requires 36. +coil = "3.5.0" + +# Kotlin libraries +coroutines = "1.9.0" + +# Archives. Commons Compress is pure Java (zip/tar/gzip/bzip2/xz, 7z read), +# so it adds no native code and therefore no NDK dependency to the build. +commonsCompress = "1.27.1" + +# Testing +junit = "4.13.2" +robolectric = "4.17" + +[libraries] +androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } +androidx-documentfile = { group = "androidx.documentfile", name = "documentfile", version.ref = "documentfile" } + +androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } +androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" } +androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycle" } + +androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } + +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } +androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" } +androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } +androidx-compose-material-icons-core = { group = "androidx.compose.material", name = "material-icons-core" } +androidx-compose-material-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended" } + +kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" } + +coil-compose = { group = "io.coil-kt.coil3", name = "coil-compose", version.ref = "coil" } + +commons-compress = { group = "org.apache.commons", name = "commons-compress", version.ref = "commonsCompress" } + +junit = { group = "junit", name = "junit", version.ref = "junit" } +robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +# NOTE: `org.jetbrains.kotlin.android` is intentionally absent — AGP 9.x provides +# built-in Kotlin support and applying that plugin is now an error. +kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..61285a6 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..5f38436 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..adff685 --- /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 +# + +############################################################################## +# +# Gradle 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 Gradle +# +# 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/HEAD/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..e509b2d --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,93 @@ +@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 Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +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 + +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. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +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. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/keystore.properties.example b/keystore.properties.example new file mode 100644 index 0000000..8811336 --- /dev/null +++ b/keystore.properties.example @@ -0,0 +1,24 @@ +# Template for release signing. Copy to `keystore.properties` and fill in real values. +# +# `keystore.properties` is git-ignored and must NEVER be committed. +# +# Generate an upload keystore (keep the file and passwords safe — losing the +# upload key means you cannot ship updates to Google Play): +# +# keytool -genkeypair -v \ +# -keystore filemanager-upload.jks \ +# -alias upload \ +# -keyalg RSA -keysize 4096 -validity 10000 +# +# Then enable Play App Signing in the Play Console and register this key as the +# *upload* key (Google keeps the app signing key). + +# Path to your keystore (absolute is safest). +storeFile=/absolute/path/to/filemanager-upload.jks +storePassword=change-me +keyAlias=upload + +# Optional — defaults to storePassword when omitted or left blank. +# PKCS12 keystores (the default on modern JDKs) cannot have a key password that +# differs from the store password, so this is normally the same value. +keyPassword=change-me diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..97a2c39 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,24 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "FileManager" +include(":app")