# sorsergios/mascotapp architecture

> Architecture diagram of the GitHub repository sorsergios/mascotapp, 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/sorsergios/mascotapp
- Repository: https://github.com/sorsergios/mascotapp

## Overview

##### Main Components
- Android Application Shell:
- Application Class – “Mascotapp.java” which likely initializes global application state.
- UI/Presentation Layer:
- Activities – “MainActivity.java” and “SplashActivity.java” (entry points for user interaction, handling screen lifecycle).
- Fragments – “HomeFragment.java”, “FoundListFragment.java”, “LostListFragment.java”, “MyAccountOptionsFragment.java” (represent discrete UI sections).
- Layouts & Menus – XML files in the “res/layout”, “res/menu”, “res/values” directories that define the UI look and feel.
- Data and Business Logic:
- DTOs – “Book.java”, “CardDTO.java” and utility classes under “dto/util/AlertMessage.java” for data transfer and messaging.
- Tasks – “CheckTask.java”, “ConnectionCheckTask.java” which likely handle background processing or connectivity checks.
- External Integrations:
- Amazon Connectivity – “amazon/AmazonConnector.java” indicating integration with Amazon services (possibly for cloud or product API interactions).
- Testing:
- Unit and Instrumentation Tests – Files under “src/test” and “src/androidTest” showcasing the testing strategy.
- Build and Infrastructure:
- Gradle Files – “build.gradle”, “gradlew”, and the gradle wrapper directories indicate the build system used.

##### Relationships and Interactions
- The Android Application shell (Mascotapp.java) initializes global configurations and possibly injects dependencies to activities/fragments.
- The UI layer, with its primary screens (SplashActivity, MainActivity) and supporting fragments, interacts with the business logic layer either directly or asynchronously via Tasks (e.g., the connection checking tasks).
- Data represented by DTOs is likely passed between UI and backend logic (or external connectors) to maintain clear separation.
- Testing directories are separate to ensure that unit tests and UI tests exercise these components, reinforcing the separation of concerns.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The project is structured to separate UI (Activities/Fragments), data transfer objects, business logic (tasks and utilities), and external services.
- Layering: Although not explicitly MVC or MVVM, the distinct package groupings (UI in “mascotapp” and logical domain objects in “dto”, “task”, and “utils”) suggest a layered structure.
- Modularity: The project uses distinct directories for tests, resources, and main code to improve maintainability.
- Use of Gradle build system emphasizes modern Android practices.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Shell
    subgraph "Application Shell"
        APP["Mascotapp.java"]:::appShell
    end

    %% UI/Presentation Layer
    subgraph "UI/Presentation Layer"
        subgraph "Activities"
            MA["MainActivity.java"]:::activity
            SA["SplashActivity.java"]:::activity
        end
        subgraph "Fragments"
            HF["HomeFragment.java"]:::fragment
            FF["FoundListFragment.java"]:::fragment
            LF["LostListFragment.java"]:::fragment
            MAF["MyAccountOptionsFragment.java"]:::fragment
        end
        subgraph "Resources"
            AM["activity_main.xml"]:::resource
            AS["activity_splash.xml"]:::resource
            FH["fragment_home.xml"]:::resource
            MS["menu_splash.xml"]:::resource
        end
    end

    %% Data & Business Logic
    subgraph "Data & Business Logic"
        subgraph "Data Transfer Objects & Utilities"
            BOOK["Book.java"]:::dto
            CARD["CardDTO.java"]:::dto
            ALERT["AlertMessage.java"]:::dto
            CONST["Constants.java"]:::dto
        end
        subgraph "Business Logic & Tasks"
            CT["CheckTask.java"]:::task
            CCT["ConnectionCheckTask.java"]:::task
        end
    end

    %% External Integrations
    subgraph "External Integrations"
        AMAZON["AmazonConnector.java"]:::external
    end

    %% Testing
    subgraph "Testing"
        INST["InstrumentationTest (ApplicationTest.java)"]:::test
        UNIT["UnitTest (ExampleUnitTest.java)"]:::test
    end

    %% Build & Infrastructure
    subgraph "Build & Infrastructure"
        GRADLE["Gradle Build Files"]:::build
    end

    %% Connections
    APP -->|"initiates"| SA
    APP -->|"initiates"| MA

    SA -->|"loads"| AS
    MA -->|"loads"| AM

    MA -->|"hosts"| HF
    MA -->|"hosts"| FF
    MA -->|"hosts"| LF
    MA -->|"hosts"| MAF

    SA -->|"triggers"| CT
    MA -->|"triggers"| CCT

    CT -->|"uses"| BOOK
    CT -->|"uses"| CARD
    CT -->|"uses"| ALERT
    CT -->|"uses"| CONST

    CT -->|"calls"| AMAZON
    CCT -->|"calls"| AMAZON

    INST -->|"tests"| APP
    UNIT -->|"tests"| APP

    GRADLE -->|"builds"| APP

    %% Styles
    classDef appShell fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef activity fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef fragment fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef resource fill:#82E0AA,stroke:#27AE60,stroke-width:2px;
    classDef dto fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef task fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef external fill:#D6EAF8,stroke:#2471A3,stroke-width:2px;
    classDef test fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef build fill:#D5F5E3,stroke:#28B463,stroke-width:2px;

    %% Click Events
    click APP "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/app/Mascotapp.java"
    click MA "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/MainActivity.java"
    click SA "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/SplashActivity.java"
    click HF "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/HomeFragment.java"
    click FF "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/found/ui/FoundListFragment.java"
    click LF "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/lost/ui/LostListFragment.java"
    click MAF "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/myaccount/MyAccountOptionsFragment.java"
    click AM "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/res/layout/activity_main.xml"
    click AS "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/res/layout/activity_splash.xml"
    click FH "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/res/layout/fragment_home.xml"
    click MS "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/res/menu/menu_splash.xml"
    click BOOK "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/dto/Book.java"
    click CARD "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/dto/CardDTO.java"
    click ALERT "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/dto/util/AlertMessage.java"
    click CONST "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/utils/Constants.java"
    click CT "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/task/CheckTask.java"
    click CCT "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/task/ConnectionCheckTask.java"
    click AMAZON "https://github.com/sorsergios/mascotapp/blob/master/app/src/main/java/ar/com/ponele/mascotapp/amazon/AmazonConnector.java"
    click INST "https://github.com/sorsergios/mascotapp/blob/master/app/src/androidTest/java/ar/com/ponele/mascotapp/ApplicationTest.java"
    click UNIT "https://github.com/sorsergios/mascotapp/blob/master/app/src/test/java/ar/com/ponele/mascotapp/ExampleUnitTest.java"
    click GRADLE "https://github.com/sorsergios/mascotapp/blob/master/app/build.gradle"
```
