# ninashine/programmation-mobile architecture

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

- Interactive diagram: https://gitdiagram.com/ninashine/programmation-mobile
- Repository: https://github.com/ninashine/programmation-mobile

## Overview

##### Main Components
- Overall Repository: Emphasize that the repository contains multiple independent Android app projects – each is a separate module (e.g., TP1 – an Agenda or event app; TP2 – sensor and hardware interaction app; Train – a ticket and payment/booking app; TP3 – an app with user accounts and local database using Room; TP2_suite and TP3_suite – extended or suite versions).
- For each project/app:
– Presentation Layer: Activities (e.g., MainActivity, AddEventActivity, etc.), fragments (in TP3, TP3_suite) and UI components (XML layouts, theme definitions).
– Business/Logic Layer: The Kotlin/Java classes handling control flow (Adapters, Services like SNCFService, and other handler classes).
– Data Layer: In some modules (e.g., in TP3 with its database package containing PlanningDao, UserDao, and UserDatabase) components related to data storage and retrieval.
– Testing Layer: Unit tests and instrumented tests are present in each app module.
– Build & Configuration: Gradle scripts, properties files, Proguard rules, and dependency configurations.

##### Relationships and Interactions
- Within each mobile application, illustrate the separation between the UI (Activities, Fragments, Adapters), the underlying business logic/services (for instance, handling sensor events in TP2 or calling external APIs in the Train project), and the data storage components.
- How UI actions (e.g., button clicks in an Activity) trigger business operations that may then query a local database (TP3) or communicate with external services (as seen in the Train project with SNCFService).

##### Important Architectural Patterns and Design Principles
- Standard Android Architecture: All projects follow Android Studio’s typical project structure (activity, layout, resource separation).
- Modularization: Each TP project is modular – it is its own Gradle module with independent build configurations and testing suites.
- Testing Inclusion: Note the presence of both unit tests and instrumented tests which are part of the quality assurance flow.

##### Relevant Technologies, Frameworks, and Tools
- Android Studio is the IDE used, and Gradle is the build tool; list these components.
- Kotlin (and/or Java) are used for application logic.
- The Android SDK is fundamental, with resources (XML layouts, theming, etc.) and standard libraries.
- For the TP3 projects, mention the usage of local databases (Room or SQLite via data access objects like UserDao).
- Testing frameworks (JUnit for unit tests, Espresso for instrumented tests) should be referenced as part of the testing components.

##### Instructing the Principal Software Engineer
- “TP1 - Agenda App”
. UI: MainActivity, AddEventActivity, EventsAdapter, XML layouts.
. Logic: Business operations tied to event management.
. Configuration: Gradle build, manifest file.
- “TP2 - Sensor App”
. UI: Sensor-related Activities (AccelerometerActivity, GeoLocationActivity, etc.).
. Logic: SensorAdapters and sensor handling code.
- “Train App”
. UI: MainActivity, PaymentActivity, ResultsActivity.
. Service Layer: SNCFService handling API calls.
- “TP3 - User & Planning App”
. UI: Login/Inscription screens, Planning screens.
. Data: Database (UserDatabase, PlanningDao) with model classes.

##### Detail and Clarity
- You do not need to overly subordinate every file, but capture the essential structure:
- The file tree shows that the structure exactly mirrors standard Android app architecture – so focus on the conceptual layers rather than every single directory.

## Diagram (Mermaid)

```mermaid
flowchart TD
    OR["Overall Repository"]:::repo
    TST["Testing Suite: Unit Tests & Instrumented Tests"]:::test

    OR -->|"contains"| A1["TP1 - Agenda App: UI (MainActivity, AddEventActivity)"]:::ui
    OR -->|"contains"| B1["TP1 - Appel App: UI (MainActivity, SecondActivity, ThirdActivity)"]:::ui
    OR -->|"contains"| C1["TP1 - Train App: UI (MainActivity, PaymentActivity, ResultsActivity)"]:::ui
    OR -->|"contains"| D1["TP2 - Sensor App: UI (AccelerometerActivity, GeoLocationActivity)"]:::ui
    OR -->|"contains"| E1["TP2_suite - Extended Sensor App: UI (DetailPaysFragment, ListePaysFragment, MainActivity)"]:::ui
    OR -->|"contains"| F1["TP3 - User & Planning App: UI (Connexion, Inscription, Planning)"]:::ui
    OR -->|"contains"| G1["TP3_suite - Extended User App: UI (MainActivity, DisplayActivity)"]:::ui

    OR -->|"tested by"| TST

    subgraph "TP1 - Agenda App"
        A1 --> A2["Logic: Adapters & Controllers"]:::logic
        A2 --> A3["Resources: Layouts, Drawables, XML"]:::res
    end

    subgraph "TP1 - Appel App"
        B1 --> B2["Resources: Layouts, Themes, Drawables"]:::res
    end

    subgraph "TP1 - Train App"
        C1 --> C2["Logic: SNCFService & Adapters"]:::logic
        C2 --> C3["Resources: Layouts, Drawables, XML"]:::res
        C2 -->|"calls"| C4["External API: SNCF"]:::external
    end

    subgraph "TP2 - Sensor App"
        D1 --> D2["Logic: SensorAdapters & Event Handlers"]:::logic
        D2 --> D3["Resources: Layouts, Drawables, Values"]:::res
    end

    subgraph "TP2_suite - Extended Sensor App"
        E1 --> E2["Logic: Pays-related Classes"]:::logic
        E2 --> E3["Resources: Layouts, Animations, etc."]:::res
    end

    subgraph "TP3 - User & Planning App"
        F1 --> F2["Data: Local Database (UserDatabase, PlanningDao, UserDao)"]:::data
        F1 --> F3["Resources: Layouts, Navigation, Drawables"]:::res
    end

    subgraph "TP3_suite - Extended User App"
        G1 --> G2["Logic: HtmlDownloadService, UserLinks"]:::logic
        G1 --> G3["Resources: XML Configurations, Layouts"]:::res
    end

    %% Click Events for Component Mapping
    click OR "https://github.com/ninashine/programmation-mobile/tree/main/Root"
    click A1 "https://github.com/ninashine/programmation-mobile/tree/main/TP1/agenda/app/src/main/java/com/example/agenda"
    click A3 "https://github.com/ninashine/programmation-mobile/tree/main/TP1/agenda/app/src/main/res"
    click B1 "https://github.com/ninashine/programmation-mobile/tree/main/TP1/appel/app/src/main/java/com/example/td1"
    click B2 "https://github.com/ninashine/programmation-mobile/tree/main/TP1/appel/app/src/main/res"
    click C1 "https://github.com/ninashine/programmation-mobile/tree/main/TP1/train/app/src/main/java/com/example/train"
    click C3 "https://github.com/ninashine/programmation-mobile/tree/main/TP1/train/app/src/main/res"
    click D1 "https://github.com/ninashine/programmation-mobile/tree/main/TP2/app/src/main/java/com/example/tp2"
    click D3 "https://github.com/ninashine/programmation-mobile/tree/main/TP2/app/src/main/res"
    click E1 "https://github.com/ninashine/programmation-mobile/tree/main/TP2_suite/app/src/main/java/com/example/tp2_suite"
    click E3 "https://github.com/ninashine/programmation-mobile/tree/main/TP2_suite/app/src/main/res"
    click F1 "https://github.com/ninashine/programmation-mobile/tree/main/tp3/app/src/main/java/com/example/tp3"
    click F3 "https://github.com/ninashine/programmation-mobile/tree/main/tp3/app/src/main/res"
    click G1 "https://github.com/ninashine/programmation-mobile/tree/main/tp3_suite/app/src/main/java/com/example/tp3_suite"
    click G3 "https://github.com/ninashine/programmation-mobile/tree/main/tp3_suite/app/src/main/res"

    %% Class Definitions for Styles
    classDef repo fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef ui fill:#AED6F1,stroke:#333,stroke-width:2px;
    classDef logic fill:#A3E4D7,stroke:#333,stroke-width:2px;
    classDef data fill:#F9E79F,stroke:#333,stroke-width:2px;
    classDef res fill:#F5B7B1,stroke:#333,stroke-width:2px;
    classDef external fill:#BFC9CA,stroke:#333,stroke-dasharray: 5,5,stroke-width:2px;
    classDef test fill:#D5F5E3,stroke:#27AE60,stroke-dasharray: 5,5,stroke-width:2px;
```
