# keidan/hexviewer architecture

> Architecture diagram of the GitHub repository keidan/hexviewer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keidan/hexviewer
- Repository: https://github.com/keidan/hexviewer

## Overview

HexViewer is an Android file viewer/editor. The main workflow opens a selected file, presents its contents as hexadecimal or plain text, supports searching and hex editing, and saves changes. Recent and partial-open flows and settings are distinct capabilities. The graph uses documented features and SOURCE INDEX references; unsampled implementation details are represented conservatively, so some subsystem links are omitted rather than inferred.

Main entry points: [`app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java`](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java) (Main screen), [`app/src/main/java/fr/ralala/hexviewer/models/lines/LineEntry.java`](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/models/lines/LineEntry.java) (Line model), [`app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragment.java`](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragment.java) (Settings screens), [`app/src/main/java/fr/ralala/hexviewer/ui/launchers/LauncherOpen.java`](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/launchers/LauncherOpen.java) (Open file flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and navigation"]
  node_main["Main screen<br/>[MainActivity.java]"]
  node_recent["Recent files"]
end

subgraph group_content["File content workflows"]
  node_open["Open file flow<br/>[LauncherOpen.java]"]
  node_partial["Partial open"]
  node_filedata["File metadata<br/>[FileData.java]"]
  node_open_task["Open task<br/>[TaskOpen.java]"]
  node_open_processor["File reader"]
  node_save_task["Save task<br/>[TaskSave.java]"]
  node_save_processor["File writer"]
  node_raw["Raw bytes<br/>[RawBuffer.java]"]
end

subgraph group_display["Viewing and editing"]
  node_lines["Line model<br/>[LineEntry.java]"]
  node_formatter["Hex formatting<br/>[SysHelper.java]"]
  node_search["File search<br/>[SearchEngine.java]"]
  node_list_adapter["Content list"]
  node_edit["Hex editing"]
  node_undo["Undo redo<br/>[UnDoRedo.java]"]
end

subgraph group_support["Settings and state"]
  node_appctx["App configuration"]
  node_settings["Settings screens"]
  node_settings_lists["Display preferences"]
end

node_user(("Android user"))

node_user -->|"uses"| node_main
node_main -->|"launches"| node_open
node_main -->|"opens partially"| node_partial
node_main -->|"opens recent"| node_recent
node_main -->|"starts save"| node_save_task
node_main -.->|"searches file"| node_search
node_main -->|"opens editing"| node_edit
node_open -.->|"describes file"| node_filedata
node_open_task -.->|"delegates reading"| node_open_processor
node_save_task -->|"delegates writing"| node_save_processor
node_formatter -->|"formats bytes"| node_raw
node_lines -->|"stores bytes"| node_raw
node_list_adapter -->|"lists entries"| node_lines
node_search -->|"searches entries"| node_lines
node_edit -.->|"tracks edits"| node_undo
node_main -->|"uses settings"| node_appctx
node_settings -->|"opens preferences"| node_settings_lists
node_settings -.->|"configures app"| node_appctx

click node_main "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java"
click node_open "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/launchers/LauncherOpen.java"
click node_partial "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/PartialOpenActivity.java"
click node_recent "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/RecentlyOpenActivity.java"
click node_filedata "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/models/FileData.java"
click node_open_task "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/tasks/TaskOpen.java"
click node_open_processor "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/utils/io/file/FileOpenProcessor.java"
click node_save_task "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/tasks/TaskSave.java"
click node_save_processor "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/utils/io/file/FileSaveProcessor.java"
click node_raw "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/models/RawBuffer.java"
click node_lines "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/models/lines/LineEntry.java"
click node_formatter "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/utils/system/SysHelper.java"
click node_search "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/search/SearchEngine.java"
click node_list_adapter "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/adapters/SearchableListArrayAdapter.java"
click node_edit "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/LineUpdateActivity.java"
click node_undo "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/undoredo/UnDoRedo.java"
click node_appctx "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/application/ApplicationCtx.java"
click node_settings "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragment.java"
click node_settings_lists "https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragmentListsPortrait.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_recent,node_user toneBlue
class node_open,node_partial,node_filedata,node_open_task,node_open_processor,node_save_task,node_save_processor,node_raw toneAmber
class node_lines,node_formatter,node_search,node_list_adapter,node_edit,node_undo toneMint
class node_appctx,node_settings,node_settings_lists toneRose
```

## Components

### App entry and navigation

- [Main screen](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java): `app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java`
- [Recent files](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/RecentlyOpenActivity.java): `app/src/main/java/fr/ralala/hexviewer/ui/activities/RecentlyOpenActivity.java`

### File content workflows

- [Open file flow](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/launchers/LauncherOpen.java): `app/src/main/java/fr/ralala/hexviewer/ui/launchers/LauncherOpen.java`
- [Partial open](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/PartialOpenActivity.java): `app/src/main/java/fr/ralala/hexviewer/ui/activities/PartialOpenActivity.java`
- [File metadata](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/models/FileData.java): `app/src/main/java/fr/ralala/hexviewer/models/FileData.java`
- [Open task](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/tasks/TaskOpen.java): `app/src/main/java/fr/ralala/hexviewer/ui/tasks/TaskOpen.java`
- [File reader](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/utils/io/file/FileOpenProcessor.java): `app/src/main/java/fr/ralala/hexviewer/utils/io/file/FileOpenProcessor.java`
- [Save task](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/tasks/TaskSave.java): `app/src/main/java/fr/ralala/hexviewer/ui/tasks/TaskSave.java`
- [File writer](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/utils/io/file/FileSaveProcessor.java): `app/src/main/java/fr/ralala/hexviewer/utils/io/file/FileSaveProcessor.java`
- [Raw bytes](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/models/RawBuffer.java): `app/src/main/java/fr/ralala/hexviewer/models/RawBuffer.java`

### Viewing and editing

- [Line model](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/models/lines/LineEntry.java): `app/src/main/java/fr/ralala/hexviewer/models/lines/LineEntry.java`
- [Hex formatting](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/utils/system/SysHelper.java): `app/src/main/java/fr/ralala/hexviewer/utils/system/SysHelper.java`
- [File search](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/search/SearchEngine.java): `app/src/main/java/fr/ralala/hexviewer/search/SearchEngine.java`
- [Content list](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/adapters/SearchableListArrayAdapter.java): `app/src/main/java/fr/ralala/hexviewer/ui/adapters/SearchableListArrayAdapter.java`
- [Hex editing](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/activities/LineUpdateActivity.java): `app/src/main/java/fr/ralala/hexviewer/ui/activities/LineUpdateActivity.java`
- [Undo redo](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/undoredo/UnDoRedo.java): `app/src/main/java/fr/ralala/hexviewer/ui/undoredo/UnDoRedo.java`

### Settings and state

- [App configuration](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/application/ApplicationCtx.java): `app/src/main/java/fr/ralala/hexviewer/application/ApplicationCtx.java`
- [Settings screens](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragment.java): `app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragment.java`
- [Display preferences](https://github.com/keidan/hexviewer/blob/master/app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragmentListsPortrait.java): `app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragmentListsPortrait.java`

### Other components

- **Android user**

## Connections

- Android user → Main screen: uses (evidence: `README.md`)
- Main screen → Open file flow: launches (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java`)
- Main screen → Partial open: opens partially (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java`)
- Main screen → Recent files: opens recent (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java`)
- Main screen → Save task: starts save (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java`)
- Main screen → File search: searches file
- Main screen → Hex editing: opens editing (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java`)
- Open file flow → File metadata: describes file
- Open task → File reader: delegates reading
- Save task → File writer: delegates writing (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/tasks/TaskSave.java`)
- Hex formatting → Raw bytes: formats bytes (evidence: `app/src/main/java/fr/ralala/hexviewer/utils/system/SysHelper.java`)
- Line model → Raw bytes: stores bytes (evidence: `app/src/main/java/fr/ralala/hexviewer/models/lines/LineEntry.java`)
- Content list → Line model: lists entries (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/adapters/SearchableListArrayAdapter.java`)
- File search → Line model: searches entries (evidence: `app/src/main/java/fr/ralala/hexviewer/search/SearchEngine.java`)
- Hex editing → Undo redo: tracks edits
- Main screen → App configuration: uses settings (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/activities/MainActivity.java`)
- Settings screens → Display preferences: opens preferences (evidence: `app/src/main/java/fr/ralala/hexviewer/ui/fragments/SettingsFragment.java`)
- Settings screens → App configuration: configures app
