Snapshot of the Umamo working tree as it is
Uploaded as-is from /home/litruv/dev/vtsmaker/umamo on 2026-11-03. 1347 files. Includes the uncommitted work in progress in :edit, :runtime, and :ui, and the untracked files under module/edit/src/jvmAndroidMain/. History is not carried over. The source repo is https://github.com/umamoorg/umamo.
@@ -0,0 +1,82 @@
|
||||
// :android (app/android) — Android entrypoint (Activity + Compose + GLSurfaceView viewport).
|
||||
// A plain Android application module (not KMP): it consumes the shared KMP libraries.
|
||||
// :android — Android 起動点(Activity + Compose + GLSurfaceView ビューポート)。
|
||||
|
||||
plugins {
|
||||
// AGP 9+ has built-in Kotlin support, so the org.jetbrains.kotlin.android plugin is gone —
|
||||
// applying it now errors. AGP compiles Kotlin itself; the Compose compiler plugin hooks in.
|
||||
alias(libs.plugins.androidApplication)
|
||||
alias(libs.plugins.composeMultiplatform)
|
||||
alias(libs.plugins.composeCompiler)
|
||||
}
|
||||
|
||||
// Resolve the application version from ProjectInfo.kt (see gradle/project-version.gradle.kts) so
|
||||
// versionName never drifts from what the About dialog shows.
|
||||
apply(from = rootProject.file("gradle/project-version.gradle.kts"))
|
||||
val umamoVersion = extra["umamoVersion"] as String
|
||||
|
||||
android {
|
||||
namespace = "org.umamo.editor.android"
|
||||
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
||||
|
||||
defaultConfig {
|
||||
// applicationId is the permanent Play identity; it intentionally differs from `namespace`
|
||||
// so org.umamo stays a clean umbrella for a future viewer app.
|
||||
applicationId = "org.umamo.editor"
|
||||
minSdk = libs.versions.android.minSdk.get().toInt()
|
||||
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
||||
// versionCode is Play's monotonic release counter — bumped by hand on release; it cannot be
|
||||
// derived from a semver string.
|
||||
versionCode = 1
|
||||
versionName = umamoVersion
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
// Keep AGP's Java compilation in lockstep with Kotlin's JDK 21 target (otherwise the
|
||||
// "inconsistent JVM target" error bites the moment any Java source appears).
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
packaging {
|
||||
resources {
|
||||
excludes += "/META-INF/LICENSE.md"
|
||||
excludes += "/META-INF/LICENSE-notice.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(21)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":ui"))
|
||||
implementation(project(":runtime"))
|
||||
// Editing core (EditorSession / Selection model): the Android host creates a per-document session
|
||||
// the same way the desktop does; declared directly for parity with :runtime / :render.
|
||||
implementation(project(":edit"))
|
||||
implementation(project(":render"))
|
||||
// androidAppStorage + the per-OS config/data dirs the settings live in; also pulls FileKit
|
||||
// (api-exposed by :storage), whose Android pickers MainActivity initialises with FileKit.init.
|
||||
implementation(project(":storage"))
|
||||
// The Settings type returned by LocalSettings: :ui depends on :settings only via implementation, so
|
||||
// MainActivity needs it on its own classpath to read settings.getString / observe settings.changes.
|
||||
implementation(project(":settings"))
|
||||
|
||||
// setContent { } lives in androidx.activity.compose.
|
||||
implementation(libs.androidx.activity.compose)
|
||||
// Direct Compose Multiplatform coordinates via the version catalog — the old `compose.runtime`
|
||||
// plugin aliases were deprecated in CMP 1.10/1.11. The artifacts still redirect to
|
||||
// androidx.compose on this Android target (Gradle metadata), so resolution is unchanged; see the
|
||||
// catalog note on the `compose-*` entries and the matching :ui commonMain block.
|
||||
implementation(libs.compose.runtime)
|
||||
implementation(libs.compose.foundation)
|
||||
implementation(libs.compose.ui)
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Minimal manifest: one launcher Activity. Uses a platform Material theme so no AppCompat
|
||||
/ res/values theme setup is needed for the scaffold. namespace (build.gradle.kts) supplies
|
||||
the package, so the manifest carries no package attribute (AGP requirement). -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="Umamo"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@android:style/Theme.Material.NoActionBar">
|
||||
|
||||
<!-- singleTask: a document opened from another app while the editor runs is delivered to THIS activity
|
||||
(onNewIntent), where the shell asks about unsaved changes, rather than stacking a second editor. -->
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Umamo documents (docs/format/UMA.md § 2), from a provider that knows the type. -->
|
||||
<intent-filter android:label="Umamo">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="content" />
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="application/vnd.umamo.uma+zip" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Most file managers do not know the type and report a generic one, so those are matched by NAME:
|
||||
pathSuffix where the platform has it (API 31), and the pathPattern ladder below it - a pattern's
|
||||
".*" stops at the first dot, so each extra dot in a path needs a pattern of its own. A file that
|
||||
matches by name and is not a UMA is refused by the loader's own check of the content. -->
|
||||
<intent-filter android:label="Umamo">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="content" />
|
||||
<data android:scheme="file" />
|
||||
<data android:host="*" />
|
||||
<data android:mimeType="application/octet-stream" />
|
||||
<data android:mimeType="application/zip" />
|
||||
<data android:pathSuffix=".uma" />
|
||||
<data android:pathPattern=".*\\.uma" />
|
||||
<data android:pathPattern=".*\\..*\\.uma" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.uma" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\.uma" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,118 @@
|
||||
package org.umamo.editor.android
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import io.github.vinceglb.filekit.FileKit
|
||||
import io.github.vinceglb.filekit.dialogs.init
|
||||
import org.umamo.storage.androidAppStorage
|
||||
import org.umamo.ui.ProvideSettings
|
||||
import org.umamo.ui.app.EditorApp
|
||||
import org.umamo.ui.app.HostOpenRequests
|
||||
import org.umamo.ui.app.rememberDocumentFileFor
|
||||
import org.umamo.ui.app.rememberEditorSessionFor
|
||||
import org.umamo.ui.app.rememberExitGuard
|
||||
import org.umamo.ui.document.Document
|
||||
import org.umamo.ui.document.newBlankDocument
|
||||
import org.umamo.ui.theme.ProvideAppThemeFromSettings
|
||||
import org.umamo.ui.theme.UmamoTheme
|
||||
|
||||
/**
|
||||
* Android entrypoint. Mounts the same shared [EditorApp] shell desktop runs - the full File / Edit /
|
||||
* Workspace / Help menu bar, document open/save through the SAF picker, the per-document editing
|
||||
* session, area tree, command palette, and the Preferences window - over the Android storage/settings
|
||||
* foundation. The 2D GL viewport is the one piece still platform-deferred: viewport areas render
|
||||
* placeholders (viewportServiceFactory = null) until the GLES sibling of the desktop render service
|
||||
* lands; the platform split stays confined to the viewport, as intended.
|
||||
*/
|
||||
class MainActivity : ComponentActivity() {
|
||||
/**
|
||||
* Documents another app hands over - a `.uma` tapped in a file manager arrives as a VIEW intent - waiting for
|
||||
* the shell to open them. Held by the activity so an intent delivered to the running editor (onNewIntent)
|
||||
* reaches the same shell as the one that launched it.
|
||||
*/
|
||||
private val openRequests = HostOpenRequests()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
// Only a fresh launch reads the launching intent: a recreated activity (a rotation the manifest does not
|
||||
// absorb, a process restore) would otherwise reopen the file over whatever the rigger has open by then.
|
||||
if (savedInstanceState == null) {
|
||||
openFrom(intent)
|
||||
}
|
||||
// FileKit owns the activity-result registry its open/save pickers dispatch through, so it must be
|
||||
// initialised once with the Activity before any file dialog (or a .clip read) runs.
|
||||
FileKit.init(this)
|
||||
val storage = androidAppStorage(this)
|
||||
setContent {
|
||||
// ProvideSettings loads settings asynchronously and gates the tree until they are ready; Android
|
||||
// has no zero-window hazard (that is desktop-only), so the async load is safe here. UmamoTheme
|
||||
// wraps the whole content (matching desktop's Main) so LocalUmamoColors resolves to the active
|
||||
// scheme for everything created here, including the future GLES viewport host.
|
||||
ProvideSettings(storage) {
|
||||
ProvideAppThemeFromSettings {
|
||||
UmamoTheme {
|
||||
// The editor always has a document: it starts in a new, empty one.
|
||||
var document by remember { mutableStateOf<Document?>(newBlankDocument()) }
|
||||
val session = rememberEditorSessionFor(document)
|
||||
val documentFile = rememberDocumentFileFor(document)
|
||||
val exitGuard = rememberExitGuard()
|
||||
// Back leaves the app (on Android 8 to 11 it destroys the root activity, edits and all), so
|
||||
// while the document is dirty it asks through the same guard as File > Exit - and while a
|
||||
// save is being written it goes through the guard too, which waits for the file to land.
|
||||
// A clean, idle document keeps the platform's own back behavior.
|
||||
val dirty = session?.dirty?.collectAsState()?.value == true
|
||||
BackHandler(enabled = dirty || documentFile?.saving == true) {
|
||||
exitGuard.request { finish() }
|
||||
}
|
||||
EditorApp(
|
||||
document = document,
|
||||
session = session,
|
||||
documentFile = documentFile,
|
||||
onOpen = { document = it },
|
||||
onExit = { finish() },
|
||||
exitGuard = exitGuard,
|
||||
// The GLES puppet render service is the remaining platform work; until it lands the
|
||||
// shared shell runs fully (menus, document, panels, thumbnails) with placeholder viewports.
|
||||
viewportServiceFactory = null,
|
||||
openRequests = openRequests,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A VIEW intent delivered while the editor is already running: the manifest makes the activity singleTask, so
|
||||
* a second document opens here - through the shell's unsaved-changes check - instead of in a second activity.
|
||||
*
|
||||
* @param Intent intent The new intent.
|
||||
*/
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
setIntent(intent)
|
||||
openFrom(intent)
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards the document a VIEW intent names to the shell. The uri string is the same form the recent-files
|
||||
* list stores, so the shell opens it the way it opens a recent file. The grant behind it is usually read-only
|
||||
* and never persistable: a Save to it can fail into the save alert (Save As works), and the recent entry it
|
||||
* leaves can fail later as the soft miss a stored uri already is.
|
||||
*
|
||||
* @param Intent? intent The intent to read.
|
||||
*/
|
||||
private fun openFrom(intent: Intent?) {
|
||||
if (intent?.action == Intent.ACTION_VIEW) {
|
||||
intent.data?.let { documentUri -> openRequests.request(documentUri.toString()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Adaptive launcher icon (API 26+; minSdk is 26, so this covers every target device). The OS
|
||||
masks the two layers to the device shape (circle/squircle/rounded square). Background is the
|
||||
solid backdrop color; foreground is the mascot rendered into the central safe zone. The legacy
|
||||
mipmap-*/ic_launcher.png bitmaps remain only as a fallback for contexts that request a raw icon. -->
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Round-mask variant of the adaptive icon. Same two layers as ic_launcher.xml; the OS applies the
|
||||
round mask. android:roundIcon in the manifest points here for launchers that request the round form. -->
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Backdrop color for the adaptive launcher icon's background layer. Keep in sync with the
|
||||
`background` variable in docs/design/appicon/generate.sh (which bakes the same backdrop into the
|
||||
opaque desktop/window/legacy bitmaps) so a re-skin changes every surface together. -->
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFFFF</color>
|
||||
</resources>
|
||||