# fossifyorg/file-manager architecture

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

- Interactive diagram: https://gitdiagram.com/fossifyorg/file-manager
- Repository: https://github.com/fossifyorg/file-manager

## Overview

##### Main Components
- UI Layer – This consists of Activities (e.g., MainActivity, DecompressActivity, FavoritesActivity, etc.), Fragments (e.g., ItemsFragment, RecentsFragment, StorageFragment, MyViewPagerFragment), Dialogs (e.g., SaveAsDialog, ChangeSortingDialog), Adapters (e.g., ItemsAdapter, DecompressItemsAdapter), and Views (like GestureEditText). These elements form the entry points and interactive components for users.
- Business & Domain Logic – Organize core logic such as file management operations, model definitions (ListItem), helper utilities (RootHelpers, Config, Constants), and interface contracts (e.g., ItemOperationsListener). This layer processes file system commands, encryption/security, and any custom business logic.
- Data & Resource Management – This includes the resource files (layouts, drawables, menus, strings in multiple languages, etc.), Android Manifest configuration, and any assets needed for theming and customization.
- Build & Deployment – Components like build.gradle.kts, fastlane configurations (metadata, screenshots, etc.), and Gradle wrappers signify how the project is built, tested, and deployed rather than runtime architecture. These components should be tangentially noted.
- External Services/Platform Integration – While the app doesn’t rely on remote servers, it leverages Android’s file system APIs, security modules (lock/pattern/fingerprint), and local storage mechanisms. Also note integration with app stores (e.g., Google Play, F-Droid, etc.) as indicated by the README badges.

##### Relationships and Interactions
- The UI Layer components (Activities, Fragments, Dialogs, Adapters) interact closely. For example, an Activity dispatches a call to a Fragment, which might then utilize the Adapter to display a list of files.
- The UI calls into the business logic (helpers, models, interfaces) that manage file operations like compression, decompression, and secure access.
- Resource management supports the UI and business logic by providing layouts, string resources, and drawable assets.
- Build and deployment configurations ensure that the app is compiled accurately and packaged for distribution, but these don’t interact directly with runtime components aside from the necessary configuration files.

##### Lay Out Architectural Patterns
- The project appears to follow a separation of concerns approach by clearly delineating UI (activities, fragments) from business logic (helpers and models). While it is not explicitly stated whether MVVM, MVP, or another pattern is used, the compartmentalization is similar in spirit.

##### Components
- Main Screening Components:
- Activities (MainActivity, DecompressActivity, FavoritesActivity, etc.)
- Fragments (ItemsFragment, RecentsFragment, StorageFragment)
- Dialogs (ChangeSorting, SaveAs, etc.) and Adapters (for populating lists and grids)
- Business Logic:
- Helpers (Config, Constants, RootHelpers)
- Models (ListItem)
- Interfaces (ItemOperationsListener)
- Resource & Assets:
- Android Res folder contents (layouts, drawables, strings, menus, etc.)
- Build & Deployment Layer:
- Gradle build scripts and fastlane files (indicate these as “build pipeline/configuration” rather than runtime components)
- External/Platform Services:
- Android OS APIs for file system access, security modules (password/pattern/fingerprint locks), and possibly file permissions management
- Deployment & Distribution Channels:
- Components such as Google Play and F-Droid distribution as external endpoints for the delivered application.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer Subgraph
    subgraph "UI Layer"
        A1["Activity: MainActivity"]:::ui
        A2["Activity: DecompressActivity"]:::ui
        A3["Activity: FavoritesActivity"]:::ui
        F1["Fragment: ItemsFragment"]:::ui
        F2["Fragment: RecentsFragment"]:::ui
        F3["Fragment: StorageFragment"]:::ui
        F4["Fragment: MyViewPagerFragment"]:::ui
        D1["Dialog: SaveAsDialog"]:::ui
        D2["Dialog: ChangeSortingDialog"]:::ui
        AD1["Adapter: ItemsAdapter"]:::ui
        AD2["Adapter: DecompressItemsAdapter"]:::ui
        CV1["Custom View: GestureEditText"]:::ui
    end

    %% Business & Domain Logic Subgraph
    subgraph "Business & Domain Logic"
        H1["Helper: Config"]:::logic
        H2["Helper: Constants"]:::logic
        H3["Helper: RootHelpers"]:::logic
        M1["Model: ListItem"]:::logic
        I1["Interface: ItemOperationsListener"]:::logic
    end

    %% Data & Resource Management Subgraph
    subgraph "Data & Resource Management"
        RES["Android Resources"]:::res
    end

    %% Build & Deployment Subgraph
    subgraph "Build & Deployment"
        BD["Build Scripts & Config"]:::build
    end

    %% External & Platform Services Subgraph
    subgraph "External & Platform Services"
        EXT["Android APIs & App Stores"]:::external
    end

    %% Relationships
    %% UI interactions
    A1 -->|"calls"| F1
    A1 -->|"opens"| D1
    A1 -->|"utilizes"| CV1
    F1 -->|"populates"| AD1
    F1 -->|"invokes"| H3
    F2 -->|"calls"| H1
    D2 --- A3

    %% Business logic interactions
    H3 -->|"manages"| M1
    %% UI components also use helpers and interfaces
    F3 -->|"uses"| I1

    %% Support from Resources
    RES -->|"supports"| A1
    RES -->|"supports"| H3

    %% Build pipeline links (tangential)
    BD -->|"builds"| A1
    BD -->|"builds"| H1

    %% External Services
    A1 -->|"accesses"| EXT
    H2 -->|"configured_by"| EXT

    %% Click Events for UI Layer
    click A1 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/activities"
    click A2 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/activities"
    click A3 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/activities"
    click F1 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/fragments"
    click F2 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/fragments"
    click F3 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/fragments"
    click F4 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/fragments"
    click D1 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/dialogs"
    click D2 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/dialogs"
    click AD1 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/adapters"
    click AD2 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/adapters"
    click CV1 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/views"

    %% Click Events for Business & Domain Logic
    click H1 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/helpers"
    click H2 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/helpers"
    click H3 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/helpers"
    click M1 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/models"
    click I1 "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/kotlin/org/fossify/filemanager/interfaces"

    %% Click Events for Data & Resource Management
    click RES "https://github.com/fossifyorg/file-manager/tree/master/app/src/main/res"

    %% Click Events for Build & Deployment
    click BD "https://github.com/fossifyorg/file-manager/blob/master/app/build.gradle.kts"

    %% Styles
    classDef ui fill:#bbf,stroke:#333,stroke-width:2px;
    classDef logic fill:#f96,stroke:#333,stroke-width:2px;
    classDef res fill:#cfc,stroke:#333,stroke-width:2px;
    classDef build fill:#fcf,stroke:#333,stroke-width:2px;
    classDef external fill:#ff9,stroke:#333,stroke-width:2px;
```
