arch-android

Ergonomic toolkit for app architecture: state machines for view/scene orchestration, storage abstractions with persisted delegates, recycler utilities, foldable posture helpers and a lightweight context provider.

Android JVM
GitHub stars0
Open issues0
LicenseApache License 2.0
Creation date2 months ago

Last activityabout 2 months ago
Latest release1.0.0 (about 2 months ago)

Arch Android Toolkit

A Kotlin-first Android toolkit with APIs designed to fit well in KMP projects (Android source set) while keeping day-to-day Android development ergonomic.

Maven Central License Kotlin Lint Test Coverage


✨ Features

  • State machines for view and scene orchestration (StateMachine, ViewStateMachine, SceneStateMachine).
  • Storage abstractions with in-memory and SharedPreferences implementations.
  • Delegates for persisted properties to reduce boilerplate for cached/config values.
  • Recycler adapter utilities including generic binders and sticky-header support.
  • Foldable helpers to react to hinge/posture changes.
  • Application context provider with ContextProvider.

📦 Installation

// build.gradle.kts

// If your project is KMP
kotlin {
    sourceSets {
        androidMain {
            dependencies {
                implementation("io.github.matheus-corregiari:arch-android:<latest-version>")
            }
        }
    }
}

// If your project is only Android
dependencies {
    implementation("io.github.matheus-corregiari:arch-android:<latest-version>")
}

🛠️ Usage

1) Configure storage at startup

class App : Application() {
    override fun onCreate() {
        super.onCreate()

        Storage.KeyValue.init(this)
        ContextProvider.init(this)
    }
}

2) Build a simple state machine

val machine = ViewStateMachine()
machine.setup {
    state(0) { visibles(viewA); gones(viewB) }
    state(1) { visibles(viewB); gones(viewA) }
}

machine.changeState(0)

3) Persist a typed config value

val darkMode = ConfigValue(
    name = "dark_mode",
    default = false,
    storage = { Storage.KeyValue.regular }
)

darkMode.set(true)
val enabled = darkMode.get()

🌍 Platform Support

Target Support
Android

This module is Android-focused, but the public API style favors KMP-friendly usage from androidMain and shared architecture layers.

🏗️ Built With

Tool Version
Kotlin 2.3.10
Gradle 9.3.1
Java 21

🔍 Quality Notes

  • KDocs are written in English and optimized for Dokka rendering.
  • ContextProvider uses WeakReference to reduce Activity leak risk.
  • ObservableValue maintains an internal coroutine scope; prefer lifecycle-bounded instances.

🤝 Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you'd like to contribute code, please fork the repository and submit a pull request.

Please read CONTRIBUTING for a straightforward, KMP-focused workflow.

📚 Documentation

For detailed API information, please refer to the KDocs.

📄 License

Copyright 2025 Matheus Corregiari

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

    http://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.
Android JVM
GitHub stars0
Open issues0
LicenseApache License 2.0
Creation date2 months ago

Last activityabout 2 months ago
Latest release1.0.0 (about 2 months ago)

Arch Android Toolkit

A Kotlin-first Android toolkit with APIs designed to fit well in KMP projects (Android source set) while keeping day-to-day Android development ergonomic.

Maven Central License Kotlin Lint Test Coverage


✨ Features

  • State machines for view and scene orchestration (StateMachine, ViewStateMachine, SceneStateMachine).
  • Storage abstractions with in-memory and SharedPreferences implementations.
  • Delegates for persisted properties to reduce boilerplate for cached/config values.
  • Recycler adapter utilities including generic binders and sticky-header support.
  • Foldable helpers to react to hinge/posture changes.
  • Application context provider with ContextProvider.

📦 Installation

// build.gradle.kts

// If your project is KMP
kotlin {
    sourceSets {
        androidMain {
            dependencies {
                implementation("io.github.matheus-corregiari:arch-android:<latest-version>")
            }
        }
    }
}

// If your project is only Android
dependencies {
    implementation("io.github.matheus-corregiari:arch-android:<latest-version>")
}

🛠️ Usage

1) Configure storage at startup

class App : Application() {
    override fun onCreate() {
        super.onCreate()

        Storage.KeyValue.init(this)
        ContextProvider.init(this)
    }
}

2) Build a simple state machine

val machine = ViewStateMachine()
machine.setup {
    state(0) { visibles(viewA); gones(viewB) }
    state(1) { visibles(viewB); gones(viewA) }
}

machine.changeState(0)

3) Persist a typed config value

val darkMode = ConfigValue(
    name = "dark_mode",
    default = false,
    storage = { Storage.KeyValue.regular }
)

darkMode.set(true)
val enabled = darkMode.get()

🌍 Platform Support

Target Support
Android

This module is Android-focused, but the public API style favors KMP-friendly usage from androidMain and shared architecture layers.

🏗️ Built With

Tool Version
Kotlin 2.3.10
Gradle 9.3.1
Java 21

🔍 Quality Notes

  • KDocs are written in English and optimized for Dokka rendering.
  • ContextProvider uses WeakReference to reduce Activity leak risk.
  • ObservableValue maintains an internal coroutine scope; prefer lifecycle-bounded instances.

🤝 Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you'd like to contribute code, please fork the repository and submit a pull request.

Please read CONTRIBUTING for a straightforward, KMP-focused workflow.

📚 Documentation

For detailed API information, please refer to the KDocs.

📄 License

Copyright 2025 Matheus Corregiari

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

    http://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.