# jack-d1/lightmeter architecture

> Architecture diagram of the GitHub repository jack-d1/lightmeter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jack-d1/lightmeter
- Repository: https://github.com/jack-d1/lightmeter

## Overview

##### Main Components
- Android Application Module ("app"): This is the core of the project and contains all the application code, resources, and manifest.
- Activities (UI Components): The project includes multiple activities such as MainActivity, AperturePriorityActivity, ShutterPriorityActivity, CustomValuesActivity, and SettingsActivity. Each represents different screens or modes in the app.
- Resources: Organized under app/src/main/res (layouts, drawables, values, XML configurations) which form the visual and configuration layer of the app.
- Android Manifest: Located in app/src/main/AndroidManifest.xml, it defines key components like activities and permissions.
- Build and Dependency Management: Gradle configuration files (build.gradle, settings.gradle, gradle.properties, and the Gradle wrapper) control the build process and specify dependencies.
- Testing: The project includes an androidTest directory for instrumentation tests that verify app behavior on devices.
- CI/CD Integration: The .github/workflows folder with main.yml implies the use of GitHub Actions to automate build/test processes.

##### Relationships and Interaction
- The Activities interact with one another; for example, MainActivity likely serves as a landing screen which then routes to either Aperture or Shutter Priority modes.
- UI components (layouts in the res/layout folders) feed data into the activities and vice versa.
- The Android Manifest ties together the app’s components providing declarations, intent filters, and permissions.
- Gradle build files aggregate dependencies, compile options, and resource linking, ensuring that all components integrate seamlessly.
- Instrumentation tests in androidTest simulate user interaction with these activities, ensuring the user experience remains intact.

##### Detailed Step-by-Step Construction
a. Start by drawing a top-level block labeled “Light Meter Application (Android)” and subdivide it into core subsystems.
c. A block representing “Resources”, linking it to UI components to denote usage of layouts, drawables, and string values.
d. Insert a block for “Configuration & Build”, including the Gradle build files, and highlight the GitHub Actions CI/CD process.
e. “Testing” block which connects with the application core to run instrumentation tests.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Core
    subgraph "Application Core"
        nodeApp["Android Application Module"]:::appcore
        nodeManifest["AndroidManifest.xml"]:::config
    end

    %% UI Layer
    subgraph "UI Layer"
        mainActivity["MainActivity"]:::activity
        aperture["AperturePriorityActivity"]:::activity
        shutter["ShutterPriorityActivity"]:::activity
        custom["CustomValuesActivity"]:::activity
        settings["SettingsActivity"]:::activity
    end

    %% Resources Layer
    subgraph "Resources Layer"
        resources["Resources (Layouts, Drawables, Values, XML)"]:::resource
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        gradle["Gradle Build Files"]:::build
        githubActions["GitHub Actions CI/CD"]:::build
    end

    %% Testing
    subgraph "Testing"
        tests["Instrumentation Tests"]:::test
    end

    %% Connections
    nodeApp --> nodeManifest
    nodeManifest --> mainActivity
    nodeManifest --> aperture
    nodeManifest --> shutter
    nodeManifest --> custom
    nodeManifest --> settings

    mainActivity -->|"navigates"| aperture
    mainActivity -->|"navigates"| shutter
    mainActivity -->|"navigates"| custom
    mainActivity -->|"navigates"| settings

    resources --> mainActivity
    resources --> aperture
    resources --> shutter
    resources --> custom
    resources --> settings

    gradle -->|"builds"| nodeApp
    githubActions -->|"triggers"| gradle
    tests -->|"validates"| nodeApp

    %% Click Events
    click nodeApp "https://github.com/jack-d1/lightmeter/tree/master/app/"
    click mainActivity "https://github.com/jack-d1/lightmeter/blob/master/app/src/main/java/com/jack/lightmeter/MainActivity.kt"
    click aperture "https://github.com/jack-d1/lightmeter/blob/master/app/src/main/java/com/jack/lightmeter/AperturePriorityActivity.kt"
    click shutter "https://github.com/jack-d1/lightmeter/blob/master/app/src/main/java/com/jack/lightmeter/ShutterPriorityActivity.kt"
    click custom "https://github.com/jack-d1/lightmeter/blob/master/app/src/main/java/com/jack/lightmeter/CustomValuesActivity.kt"
    click settings "https://github.com/jack-d1/lightmeter/blob/master/app/src/main/java/com/jack/lightmeter/SettingsActivity.kt"
    click resources "https://github.com/jack-d1/lightmeter/tree/master/app/src/main/res"
    click nodeManifest "https://github.com/jack-d1/lightmeter/blob/master/app/src/main/AndroidManifest.xml"
    click gradle "https://github.com/jack-d1/lightmeter/blob/master/app/build.gradle"
    click tests "https://github.com/jack-d1/lightmeter/tree/master/app/src/androidTest"
    click githubActions "https://github.com/jack-d1/lightmeter/blob/master/.github/workflows/main.yml"

    %% Styles
    classDef appcore fill:#fde2e2,stroke:#b30000,stroke-width:2px;
    classDef config fill:#e2f7fd,stroke:#0077b3,stroke-width:2px;
    classDef activity fill:#e2eafc,stroke:#3333cc,stroke-width:2px;
    classDef resource fill:#f3e2fd,stroke:#8a2be2,stroke-width:2px;
    classDef build fill:#e2fde2,stroke:#008000,stroke-width:2px;
    classDef test fill:#fff2cc,stroke:#b38f00,stroke-width:2px;
```
