# idgleb/controlimc architecture

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

- Interactive diagram: https://gitdiagram.com/idgleb/controlimc
- Repository: https://github.com/idgleb/controlimc

## Overview

##### Main Components
- Android Application Module: Represent the single “app” module that includes the entire Android application.
- UI Layer:
- Activities like ImcCalculatorActivity and ResoltIMCActivity serve as the entry points for user interaction.
- Layout Resources under app/src/main/res/layout define user interface screens.
- Presentation/Logic Layer:
- CurrentViewModel is used for managing UI-related data and handling business logic (suggesting an MVVM pattern).
- Resource Components:
- Testing:
- Separate directories for Android Instrumentation Tests (app/src/androidTest) and Unit Tests (app/src/test) indicate a commitment to quality and could be included to show testing boundaries in the architecture.

##### Relationships and Interactions
- The UI layer (Activities) interacts with the ViewModel(s) (e.g., CurrentViewModel) to process input, display calculated results, and manage state.
- The activities retrieve user input (weight, height) and send that to the ViewModel, which executes the IMC calculation logic before handing back the calculated value/result.
- Layout resource files provide the visual structure and are consumed by the UI components.
- The Gradle configuration files (build.gradle.kts, settings.gradle.kts, and the Gradle wrapper files) indicate the build processes and dependency management setup, which is crucial when representing deployment/build pipelines.

##### Architectural Patterns and Technologies
- MVVM Pattern: The presence of a ViewModel (CurrentViewModel) suggests that data binding and separation of concerns are featured. Show how Activities (View) react to changes in the ViewModel (Model) and update the UI.
- Android SDK & Gradle: Include how Gradle orchestrates builds and dependency management, and the AndroidManifest.xml which configures core application settings.
- Testing Strategy: Illustrate that separate testing components are built for unit and instrumentation tests, ensuring a robust application.

## Diagram (Mermaid)

```mermaid
flowchart TB
    AAM["Android Application Module"]:::app

    subgraph "UI Layer"
        UC1["ImcCalculatorActivity"]:::activity
        UC2["ResoltIMCActivity"]:::activity
    end

    subgraph "Business Logic/Presentation"
        VB["CurrentViewModel"]:::viewmodel
    end

    subgraph "Resources"
        L["Layout Files"]:::resource
        D["Drawable Assets"]:::resource
        M["Mipmap Assets"]:::resource
        X["XML & Values Files"]:::resource
    end

    subgraph "Testing"
        AT["Android Instrumentation Tests"]:::testing
        UT["Unit Tests"]:::testing
    end

    subgraph "Build & Configuration"
        GBS["Gradle Build Scripts"]:::gradle
        GW["Gradle Wrapper"]:::gradle
    end

    %% Containment arrows from main module to key components
    AAM -->|"contains"| UC1
    AAM -->|"contains"| UC2
    AAM -->|"contains"| VB
    AAM -->|"contains"| L
    AAM -->|"contains"| AT
    AAM -->|"configured_by"| GBS

    %% UI Layer interactions with Business Logic and Resources
    UC1 -->|"sendsData"| VB
    UC2 -->|"sendsData"| VB
    UC1 -->|"uses"| L
    UC2 -->|"uses"| L

    %% Testing relationships
    AT -->|"tests"| UC1
    UT -->|"tests"| VB

    %% Build & Configuration interactions
    GBS -->|"builds"| VB
    GW -->|"builds"| VB

    %% Click Events
    click AAM "https://github.com/idgleb/controlimc/tree/main/app"
    click UC1 "https://github.com/idgleb/controlimc/blob/main/app/src/main/java/com/ursolgleb/controlimc/ImcCalculatorActivity.kt"
    click UC2 "https://github.com/idgleb/controlimc/blob/main/app/src/main/java/com/ursolgleb/controlimc/ResoltIMCActivity.kt"
    click VB "https://github.com/idgleb/controlimc/blob/main/app/src/main/java/com/ursolgleb/controlimc/CurrentViewModel.kt"
    click L "https://github.com/idgleb/controlimc/tree/main/app/src/main/res/layout"
    click D "https://github.com/idgleb/controlimc/tree/main/app/src/main/res/drawable"
    click M "https://github.com/idgleb/controlimc/tree/main/app/src/main/res/mipmap-anydpi-v26"
    click X "https://github.com/idgleb/controlimc/tree/main/app/src/main/res/xml"
    click AT "https://github.com/idgleb/controlimc/tree/main/app/src/androidTest"
    click UT "https://github.com/idgleb/controlimc/tree/main/app/src/test"
    click GBS "https://github.com/idgleb/controlimc/blob/main/build.gradle.kts"
    click GW "https://github.com/idgleb/controlimc/tree/main/gradle/wrapper"

    %% Styles
    classDef app fill:#FFD700,stroke:#DAA520,stroke-width:2px;
    classDef activity fill:#FFCCCC,stroke:#990000,stroke-width:2px;
    classDef viewmodel fill:#CCFFCC,stroke:#009900,stroke-width:2px;
    classDef resource fill:#FFFFCC,stroke:#CCCC00,stroke-width:2px;
    classDef testing fill:#CCE5FF,stroke:#3366CC,stroke-width:2px;
    classDef gradle fill:#E6E6FA,stroke:#8A2BE2,stroke-width:2px;
```
