# unizar-30226-2025-10/frontend-movil architecture

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

- Interactive diagram: https://gitdiagram.com/unizar-30226-2025-10/frontend-movil
- Repository: https://github.com/unizar-30226-2025-10/frontend-movil

## Overview

- Application Layer (UI and Presentation):
- Activities: These are represented in directories like app/src/main/java/com/example/myapplication/activities (for login, home, profile, etc.). Each activity (e.g., MainActivity, Home, Login, Perfil) should be shown as a separate UI component.
- Adapters: Components for rendering lists in the UI (for instance, Adapters under Buscador and Home directories) should be grouped as “UI Adapters”. Include individual elements like AlbumListAdapter, ArtistasListAdapter, etc.
- UI Themes and Resources: Represent the Android layout XML files (in app/src/main/res/layout), drawables, and themes. These resources comprise the visual styling that supports the UI components.

- Network / I/O Layer:
- API Service: Under app/src/main/java/com/example/myapplication/io/ApiService.kt, the module responsible for communicating with external services. Represent this as the “Network Manager” or "API Client".
- Request and Response Classes: Display the various request and response objects (in directories io/request and io/response) that illustrate how data is packaged and interpreted when communicating with the server.

- Managers and Utilities:
- WebSocket Manager: Found under the managers directory (WebSocketManager.kt) for managing real-time communication.
- Utility Classes: Such as Preferencias.kt, handling preferences and settings.
- The Application Class “MiApp.kt”: Acts as the global application context, initialization point, or dependency injector setup if applicable.

##### Detail the Relationships and Data Flow
- User interactions progressing from UI components (activities, fragments, adapters) to the Network Layer when making API calls.
- The API Service sending/receiving data through the corresponding Request/Response classes.
- WebSocketManager’s interactions with the UI or business logic for real-time updates.
- How utility components like Preferencias are accessed by different parts of the UI layer.
- For example, when a login occurs, the Login activity calls a method on the ApiService with a LoginRequest, and the response is parsed into a LoginResponse to update UI components.

##### Architectural Patterns
- While this project follows a fairly standard Android client architecture (using Activities, Adapters, and network calls), note any implicit separation of concerns:
- The separation between the presentation layer (UI activities and adapters) and the communication layer (API service with request/response objects) is key.
- Even if there isn’t a full MVP/MVVM separation explicitly shown, the clear division among UI, network, and business logic (managers/utilities) is an important architectural principle.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer: UI Components
    subgraph "Presentation Layer: UI Components"
        MA("MainActivity"):::ui
        LA("Login Activity"):::ui
        HA("Home Activity"):::ui
        PA("Profile Activity"):::ui

        subgraph "UI Adapters"
            BA("Buscador Adapter"):::adapter
            HAd("Home Adapter"):::adapter
        end
    end

    %% Presentation Layer: UI Resources
    subgraph "Presentation Layer: UI Resources"
        Layout("Layout XML"):::resource
        Theme("UI Theme Files"):::resource
    end

    %% Network / I/O Layer
    subgraph "Network / I/O Layer"
        API("API Service"):::network
        Req("Request Classes"):::network
        Res("Response Classes"):::network
    end

    %% Managers & Utilities
    subgraph "Managers & Utilities"
        WS("WebSocket Manager"):::manager
        Prefer("Utility: Preferencias"):::manager
        MiApp("App Class: MiApp"):::appClass
    end

    %% Data Flow Connections
    LA -->|"apiCall"| API
    API -->|"processResponse"| Res
    Res -->|"updateUI"| LA

    HA -->|"renders"| HAd
    MA -->|"uses"| BA

    Layout -->|"appliedTo"| MA
    Layout -->|"appliedTo"| LA
    Theme -->|"styledBy"| MA
    Theme -->|"styledBy"| LA

    WS -->|"realTimeUpdates"| HA
    Prefer -->|"settings"| LA
    MiApp -->|"initializes"| MA
    MiApp -->|"injects"| API

    HA -->|"usesAdapter"| BA

    %% Click Events
    click MA "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/activities"
    click LA "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/activities"
    click HA "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/activities"
    click PA "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/activities"
    click BA "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/Adapters/Buscador"
    click HAd "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/Adapters/Home"
    click Layout "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/res/layout"
    click Theme "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/ui/theme"
    click API "https://github.com/unizar-30226-2025-10/frontend-movil/blob/main/app/src/main/java/com/example/myapplication/io/ApiService.kt"
    click Req "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/io/request"
    click Res "https://github.com/unizar-30226-2025-10/frontend-movil/tree/main/app/src/main/java/com/example/myapplication/io/response"
    click WS "https://github.com/unizar-30226-2025-10/frontend-movil/blob/main/app/src/main/java/com/example/myapplication/managers/WebSocketManager.kt"
    click Prefer "https://github.com/unizar-30226-2025-10/frontend-movil/blob/main/app/src/main/java/com/example/myapplication/utils/Preferencias.kt"
    click MiApp "https://github.com/unizar-30226-2025-10/frontend-movil/blob/main/app/src/main/java/com/example/myapplication/MiApp.kt"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef adapter fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef resource fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef network fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef manager fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef appClass fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
```
