# arlaudcyril/test-android-app architecture

> Architecture diagram of the GitHub repository arlaudcyril/test-android-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arlaudcyril/test-android-app
- Repository: https://github.com/arlaudcyril/test-android-app

## Overview

##### Project type and purpose
- This is an Android mobile application project (the “app” module) that uses Kotlin and Java, coupled with an Android UI widget library (the “CountryCodePicker” module). The app appears to be a cryptocurrency/fiat wallet or trading client (package name com.Lyber) that interacts with remote REST APIs and Firebase Cloud Messaging.

##### File structure
- Top-level modules:
- CountryCodePicker: A standalone AAR library providing a country-picker UI component (BottomSheetDialogView, adapter, listeners, resources).
- app: The main Android application.
- app/src/main:
- AndroidManifest.xml, resources (layouts, drawables, navigation graph, animations, fonts).
- java/com/Lyber: subdivided into models, network, services, ui (activities, fragments, adapters), utils, viewmodels.
- assets and google-services.json (for FCM).
- Configuration/build files: build.gradle at project and module level, gradle wrapper, ProGuard rules, keystore, settings.gradle.

##### Architectural clues
- The code follows MVVM (Model-View-ViewModel):
- View layer: Activities & Fragments, Adapters
- ViewModel layer: NetworkViewModel, ProfileViewModel, etc.
- Model layer: data classes under models, localDataModels.
- Network: Api.kt and RestClient.kt likely wrap Retrofit/OkHttp to call remote RESTful endpoints.
- Services: MyFirebaseMessagingService handles push notifications.
- Utilities: PreferenceManager, EncryptionHelper, KeyStoreHelper for local storage/security; CommonMethods for business utilities.

##### Main components
a. App module
1) UI Layer
- Activities (e.g., SplashActivity, WebViewActivity)
- Fragments (hundreds of feature-specific fragments, bottom sheets, dialogs)
- Adapters (RecyclerView, bottom sheet list adapters)
2) ViewModels
- Exposed to UI via LiveData/StateFlow
3) Data Layer
- Models (remote and local data structures)
- Network (RestClient → Retrofit → HTTP)
- Local persistence (PreferenceManager, KeyStore, optional Room if present)
4) Services
- Firebase Cloud Messaging (push notifications)
b. CountryCodePicker library
- BottomSheetDialogView, adapter, listeners, XML layouts & drawables – consumed by UI Fragments for country selection
c. External services
- Remote REST API servers
- Firebase Cloud Messaging
d. Build & deployment
- Gradle build scripts, ProGuard/R8 obfuscation, signing with key.jks
- Output APK/AAB

##### Relationships and data flows
- UI (Activity/Fragment) → invokes ViewModel methods
- ViewModel → uses RestClient/Api to fetch/send data
- RestClient → HTTP → Remote API
- API response → parsed into Model → returned to ViewModel → updates UI via LiveData
- UI may call CountryCodePicker library component for country selection
- FirebaseMessagingService → receives push → notifies app via internal broadcast or LiveData → UI updates

##### Architectural patterns & principles
- MVVM separation of concerns
- Single-Activity pattern with Navigation Component (nav_graph.xml)
- Repository-style data access (RestClient hides network details)
- Modularization: reusable CountryCodePicker component
- Secure local storage: KeyStoreHelper, EncryptionHelper, PreferenceManager

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CountryCodePicker Library
    subgraph "CountryCodePicker Library"
        CCP["CountryCodePicker AAR"]:::external
    end

    %% App Module Layers
    subgraph "App Module"
        direction TB
        %% Presentation Layer
        subgraph "Presentation (UI)" 
            direction TB
            Activities["Activities"]:::presentation
            Fragments["Fragments"]:::presentation
            Adapters["Adapters"]:::presentation
        end

        %% ViewModel Layer
        subgraph "ViewModels" 
            direction TB
            VMs["ViewModels"]:::business
        end

        %% Data Layer
        subgraph "Data"
            direction TB
            Models["Models"]:::data
            API["Api Interface"]:::network
            Client["RestClient"]:::network
            subgraph "Local Storage & Security"
                PrefMgr["PreferenceManager"]:::util
                Encrypt["EncryptionHelper"]:::util
                KeyStore["KeyStoreHelper"]:::util
            end
        end

        %% Services
        subgraph "Services"
            FCMService["MyFirebaseMessagingService"]:::external
        end
    end

    %% External Services
    REST["REST API Servers"]:::external
    FCM["Firebase Cloud Messaging"]:::external

    %% Build & Config
    subgraph "Build & Config"
        Manifest["AndroidManifest.xml"]:::util
        NavGraph["nav_graph.xml"]:::util
        GServices["google-services.json"]:::util
        KeyJKS["key.jks"]:::util
        RootGradle["build.gradle (root)"]:::util
        AppGradle["app/build.gradle"]:::util
    end

    %% Relationships
    CCP -->|provides UI component| Fragments
    Activities -->|invokes| VMs
    Fragments -->|binds to| VMs
    VMs -->|calls| Client
    Client -->|implements| API
    Client -->|HTTP/HTTPS| REST
    REST -->|JSON response| Client
    Client -->|returns models| VMs
    VMs -->|updates via LiveData| Fragments
    Fragments -->|uses| Adapters
    Activities -->|launches| Fragments
    FCM -->|push notification| FCMService
    FCMService -->|notifies| VMs

    %% Build relationships
    Manifest --> Activities
    Manifest --> Fragments
    NavGraph --> Activities
    GServices --> FCMService
    KeyJKS --> AppGradle
    RootGradle --> AppGradle

    %% Click Events
    click CCP "https://github.com/arlaudcyril/test-android-app/tree/main/CountryCodePicker/"
    click Activities "https://github.com/arlaudcyril/test-android-app/tree/main/app/src/main/java/com/Lyber/ui/activities/"
    click Fragments "https://github.com/arlaudcyril/test-android-app/tree/main/app/src/main/java/com/Lyber/ui/fragments/"
    click Adapters "https://github.com/arlaudcyril/test-android-app/tree/main/app/src/main/java/com/Lyber/ui/adapters/"
    click VMs "https://github.com/arlaudcyril/test-android-app/tree/main/app/src/main/java/com/Lyber/viewmodels/"
    click Models "https://github.com/arlaudcyril/test-android-app/tree/main/app/src/main/java/com/Lyber/models/"
    click API "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/java/com/Lyber/network/Api.kt"
    click Client "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/java/com/Lyber/network/RestClient.kt"
    click FCMService "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/java/com/Lyber/services/MyFirebaseMessagingService.kt"
    click PrefMgr "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/java/com/Lyber/utils/PreferenceManager.kt"
    click Encrypt "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/java/com/Lyber/utils/EncryptionHelper.kt"
    click KeyStore "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/java/com/Lyber/utils/KeyStoreHelper.kt"
    click NavGraph "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/res/navigation/nav_graph.xml"
    click Manifest "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/AndroidManifest.xml"
    click GServices "https://github.com/arlaudcyril/test-android-app/blob/main/app/google-services.json"
    click KeyJKS "https://github.com/arlaudcyril/test-android-app/blob/main/app/src/main/key.jks"
    click RootGradle "https://github.com/arlaudcyril/test-android-app/blob/main/build.gradle"
    click AppGradle "https://github.com/arlaudcyril/test-android-app/blob/main/app/build.gradle"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#0275d8,color:#000
    classDef business fill:#DFFFD0,stroke:#5cb85c,color:#000
    classDef data fill:#FFE8D0,stroke:#f0ad4e,color:#000
    classDef network fill:#FFE8D0,stroke:#f0ad4e,color:#000
    classDef util fill:#F0F0F0,stroke:#6c757d,color:#000
    classDef external fill:#E8E8E8,stroke:#6c757d,color:#000
```
