# elimu-ai/launcher architecture

> Architecture diagram of the GitHub repository elimu-ai/launcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/elimu-ai/launcher
- Repository: https://github.com/elimu-ai/launcher

## Overview

##### Project type and high-level purpose
- This is a mobile-only, full-front-end Android application (“Launcher”) written in Kotlin/Java, which depends on an external Appstore app (with its own ContentProvider) to retrieve the list of educational apps.
- It has no backend servers of its own; instead it integrates with the Appstore via Android’s ContentResolver/ContentProvider mechanism.

##### File structure to discover architectural boundaries
- Top-level Gradle scripts & config (`settings.gradle`, `build.gradle`, `gradle.properties`, wrappers) define build system.
- `app/src/main/java/ai/elimu/launcher` contains:
- `BaseApplication.kt` – entry point for app-wide initialization.
- `MainActivity.kt` & `HomeScreensActivity.kt` – primary UI controllers.
- `ui/` – Fragment classes for each HomeScreen.
- `util/CursorToApplicationConverter.kt` – transforms raw ContentProvider cursor into domain models.
- `app/src/main/res` holds the UI resources: layouts, drawables, styles.

##### README for integration details
- The Launcher fetches apps from the Appstore’s ContentProvider.
- Each “spacecraft” in the UI represents a category/unlocked skill (EGRA/EGMA).
- It depends on the external Appstore APK being installed on the device.

##### Main components and their interactions
a. Android Platform (OS)
b. Launcher App
– Application object (`BaseApplication`)
– Activities & Fragments (UI layer)
– Utility & data‐mapping layer (`CursorToApplicationConverter`)
– Android resources (layouts, drawables, strings)
c. Appstore App (external)
– ContentProvider exposing metadata about available educational apps
– Underlying SQLite DB or storage

##### Relationships / data flows
1. On startup, `BaseApplication` initializes global state.
2. `HomeScreensActivity` uses Android’s `ContentResolver` to query Appstore’s ContentProvider URI.
3. ContentProvider reads underlying DB, returns a Cursor.
4. `CursorToApplicationConverter` maps Cursor rows into `Application` domain objects.

##### Architectural patterns & principles
- Android’s component model (Application → Activity → Fragment) for lifecycle and UI separation.
- ContentProvider pattern for decoupled data sharing between separate apps.
- Utility (Converter) class encapsulates data‐mapping logic, separating UI from raw cursor data.

##### Essential elements
– Labels for URIs, Intent actions, and key classes

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Build Pipeline"
        SETTINGS["settings.gradle"]:::external
        BUILDROOT["build.gradle (root)"]:::external
        APPBUILD["app/build.gradle"]:::external
        PROPS["gradle.properties"]:::external
        WRAPPER["gradle-wrapper.properties"]:::external
        GRADLEW["gradlew / gradlew.bat"]:::external
    end

    subgraph "Android OS"
        OS["Android OS"]:::os
    end

    subgraph "Launcher App"
        subgraph "Application Layer"
            BaseApp["BaseApplication"]:::presentation
            MainActivity["MainActivity"]:::presentation
            HomeScreensActivity["HomeScreensActivity"]:::presentation
        end
        subgraph "UI Layer"
            Frag1["Fragment Screen 1"]:::presentation
            Frag2["Fragment Screen 2"]:::presentation
            Frag3["Fragment Screen 3"]:::presentation
            Frag4["Fragment Screen 4"]:::presentation
            Resources["Android Resources"]:::presentation
        end
        subgraph "Domain/Utility Layer"
            Converter["CursorToApplicationConverter"]:::domain
        end
        subgraph "Data Integration Layer"
            Resolver["ContentResolver"]:::integration
            Provider["Appstore ContentProvider"]:::integration
        end
    end

    subgraph "External Storage"
        DB["Appstore SQLite DB"]:::external
    end

    subgraph "Educational Apps"
        Apps["Educational Apps"]:::external
    end

    BaseApp --> MainActivity
    BaseApp --> HomeScreensActivity
    HomeScreensActivity --> Resolver
    Resolver --> Provider
    Provider --> DB
    Provider -->|returns Cursor| Converter
    Converter --> Frag1
    Converter --> Frag2
    Converter --> Frag3
    Converter --> Frag4
    Frag1 -->|renders UI| Resources
    Frag2 -->|renders UI| Resources
    Frag3 -->|renders UI| Resources
    Frag4 -->|renders UI| Resources
    Frag1 -->|user tap: Intent| OS
    Frag2 -->|user tap: Intent| OS
    Frag3 -->|user tap: Intent| OS
    Frag4 -->|user tap: Intent| OS
    OS -->|routes Intent| Apps

    click BaseApp "https://github.com/elimu-ai/launcher/blob/main/app/src/main/java/ai/elimu/launcher/BaseApplication.kt"
    click MainActivity "https://github.com/elimu-ai/launcher/blob/main/app/src/main/java/ai/elimu/launcher/MainActivity.kt"
    click HomeScreensActivity "https://github.com/elimu-ai/launcher/blob/main/app/src/main/java/ai/elimu/launcher/ui/HomeScreensActivity.kt"
    click Frag1 "https://github.com/elimu-ai/launcher/blob/main/app/src/main/res/layout/fragment_home_screen1.xml"
    click Frag2 "https://github.com/elimu-ai/launcher/blob/main/app/src/main/res/layout/fragment_home_screen2.xml"
    click Frag3 "https://github.com/elimu-ai/launcher/blob/main/app/src/main/res/layout/fragment_home_screen3.xml"
    click Frag4 "https://github.com/elimu-ai/launcher/blob/main/app/src/main/res/layout/fragment_home_screen4.xml"
    click Resources "https://github.com/elimu-ai/launcher/tree/main/app/src/main/res/"
    click Converter "https://github.com/elimu-ai/launcher/blob/main/app/src/main/java/ai/elimu/launcher/util/CursorToApplicationConverter.kt"
    click SETTINGS "https://github.com/elimu-ai/launcher/blob/main/settings.gradle"
    click BUILDROOT "https://github.com/elimu-ai/launcher/blob/main/build.gradle"
    click APPBUILD "https://github.com/elimu-ai/launcher/blob/main/app/build.gradle"
    click PROPS "https://github.com/elimu-ai/launcher/blob/main/gradle.properties"
    click WRAPPER "https://github.com/elimu-ai/launcher/blob/main/gradle/wrapper/gradle-wrapper.properties"
    click GRADLEW "https://github.com/elimu-ai/launcher/tree/main/gradlew"

    classDef presentation fill:#D6EAF8,stroke:#1B4F72,color:#0B5345
    classDef domain fill:#D5F5E3,stroke:#196F3D,color:#0B5345
    classDef integration fill:#FAD7A0,stroke:#B9770E,color:#7D6608
    classDef external fill:#D7DBDD,stroke:#626567,color:#1C2833
    classDef os stroke-dasharray: 5 5,stroke:#5D6D7E,fill:#F2F4F4,color:#2E4053
```
