# cylonid/nativealphaforandroid architecture

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

- Interactive diagram: https://gitdiagram.com/cylonid/nativealphaforandroid
- Repository: https://github.com/cylonid/nativealphaforandroid

## Overview

##### Main Components

a. User Interface Layer:
- Main Activity (Entry point)
- WebView Activities (Individual web app instances)
- Settings Activities (Global and per-webapp)
- News Activity
- About Activity

b. Core Components:
- WebView Management System
- Sandbox Management (Premium feature)
- Data Management Layer
- Settings Management
- Biometric Authentication System (Premium feature)

c. Utility Layer:
- Resource Management
- Localization Utils
- Context Extensions
- Entry Point Utils

##### Architecture Pattern
- Model: Located in com.cylonid.nativealpha.model
- View: XML layouts in res/layout
- Controllers/ViewModels: Activities and Fragments

##### Key Relationships to Highlight

**[User Interface Layer]**
- ↑↓
**[Core Components Layer]**
- ↑↓
**[Utility Layer]**
- ↑↓
**[Android System WebView]**

##### Specific Component Details

- MainActivity  |---->| WebAppListFragment|

- ↓                      ↓

- WebViewActivity|<--->|    WebApp Model   |

- ↓                      ↓

- SandboxManager|<--->| DataManager       |

##### Important Features to Highlight

- Sandbox Container System
- Biometric Access Control
- WebView Configuration
- Dark Mode Management

##### Data Flow Indicators

- User interaction flow
- Data persistence flow
- WebView content loading
- Security check points

##### External Dependencies

- Android System WebView
- Biometric APIs
- File System
- AdBlock Plus WebView

##### Implementation Details

Implementation aspects:
- Kotlin/Java interop
- Resource management
- Permission handling
- Cache management

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef util fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef model fill:#1abc9c,stroke:#16a085,color:white

    %% User Interface Layer
    subgraph UI
        MA["Main Activity"]:::ui
        WVA["WebView Activity"]:::ui
        SA["Settings Activity"]:::ui
        WAS["WebApp Settings"]:::ui
        NA["News Activity"]:::ui
        AA["About Activity"]:::ui
        WAL["WebApp List UI"]:::ui
    end

    %% Core Components Layer
    subgraph Core
        WVM["WebView Management"]:::core
        SM["Sandbox Management"]:::core
        DM["Data Management"]:::core
        SGM["Settings Management"]:::core
        BA["Biometric Auth"]:::security
    end

    %% Model Layer
    subgraph Model
        WM["WebApp Model"]:::model
        SBM["Sandbox Model"]:::model
    end

    %% Utility Layer
    subgraph Utils
        RM["Resource Management"]:::util
        LU["Localization Utils"]:::util
        CE["Context Extensions"]:::util
        EPU["Entry Point Utils"]:::util
    end

    %% External Systems
    ASW["Android System WebView"]:::external
    BioAPI["Biometric APIs"]:::external
    FS["File System"]:::external
    ABW["AdBlock Plus WebView"]:::external

    %% Relationships
    MA --> WAL
    WAL --> WM
    WVA --> WM
    WM --> DM
    SM --> SBM
    WVM --> ASW
    BA --> BioAPI
    DM --> FS
    WVM --> ABW
    SA --> SGM
    WAS --> WM
    NA --> DM
    AA --> LU

    %% Utility connections
    RM --> WVM
    LU --> MA
    CE --> WVA
    EPU --> MA

    %% Click events for file navigation
    click MA "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/MainActivity.kt"
    click WVA "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/WebViewActivity.java"
    click SA "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/SettingsActivity.java"
    click WAS "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/WebAppSettingsActivity.java"
    click NA "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/kotlin/com/cylonid/nativealpha/activities/NewsActivity.kt"
    click AA "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/AboutActivity.java"
    click WAL "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/kotlin/com/cylonid/nativealpha/fragments/webapplist/WebAppListFragment.kt"
    click WVM "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/util/WebViewLauncher.kt"
    click SM "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/model/SandboxManager.java"
    click DM "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/model/DataManager.java"
    click SGM "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/model/GlobalSettings.kt"
    click BA "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/kotlin/com/cylonid/nativealpha/helper/BiometricPromptHelper.kt"
    click WM "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/kotlin/com/cylonid/nativealpha/model/WebApp.kt"
    click SBM "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/model/Sandbox.java"
    click RM "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/util/ResourceImageGetter.kt"
    click LU "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/java/com/cylonid/nativealpha/util/LocUtils.kt"
    click CE "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/kotlin/com/cylonid/nativealpha/util/ContextExtensions.kt"
    click EPU "https://github.com/cylonid/NativeAlphaForAndroid/blob/dev/app/src/main/kotlin/com/cylonid/nativealpha/util/EntryPointUtils.kt"
```
