# alif20iq-gif/padfix-android architecture

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

- Interactive diagram: https://gitdiagram.com/alif20iq-gif/padfix-android
- Repository: https://github.com/alif20iq-gif/padfix-android

## Overview

Padfix Android combines a native controller-correction backend with an Android control surface. The main workflow is: the user starts Padfix, the app launches the backend through Shizuku, the backend reads a physical controller, calibrates and corrects analog input, and emits a virtual gamepad; the app displays the local dashboard and polls backend status for notifications. The dashboard also offers local preset management. The C excerpts are partial, so internal backend stages are shown as responsibilities rather than unsupported call-level flows.

Main entry points: [`app/src/main/java/id/padfix/android/MainActivity.kt`](https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/java/id/padfix/android/MainActivity.kt) (Main activity), [`native/padfix.c`](https://github.com/alif20iq-gif/padfix-android/blob/main/native/padfix.c) (Padfix backend), [`app/src/main/assets/index.html`](https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/assets/index.html) (Dashboard and presets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android wrapper"]
  node_activity["Main activity<br/>[MainActivity.kt]"]
  node_webview["Dashboard WebView<br/>[MainActivity.kt]"]
  node_statuspoll["Status polling<br/>[MainActivity.kt]"]
end

subgraph group_backend["Input backend"]
  node_native["Padfix backend<br/>[padfix.c]"]
  node_calibration["Calibration and correction<br/>[padfix.c]"]
  node_http["Local dashboard server<br/>[padfix.c]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard["Dashboard and presets<br/>[index.html]"]
end

node_user(("User"))
node_shizuku["Shizuku shell"]
node_physical["Physical controller"]
node_virtual["Virtual gamepad"]

node_user -->|"starts or stops"| node_activity
node_activity -->|"launches backend"| node_shizuku
node_shizuku -->|"runs process"| node_native
node_physical -->|"provides input"| node_native
node_native -->|"calibrates and corrects"| node_calibration
node_calibration -->|"emits corrected input"| node_virtual
node_native -->|"serves locally"| node_http
node_activity -->|"loads dashboard URL"| node_webview
node_webview -->|"renders asset"| node_dashboard
node_activity -->|"polls backend"| node_statuspoll
node_statuspoll -->|"requests status"| node_http
node_dashboard -.->|"uses local API"| node_http

click node_activity "https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/java/id/padfix/android/MainActivity.kt"
click node_webview "https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/java/id/padfix/android/MainActivity.kt"
click node_statuspoll "https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/java/id/padfix/android/MainActivity.kt"
click node_native "https://github.com/alif20iq-gif/padfix-android/blob/main/native/padfix.c"
click node_calibration "https://github.com/alif20iq-gif/padfix-android/blob/main/native/padfix.c"
click node_http "https://github.com/alif20iq-gif/padfix-android/blob/main/native/padfix.c"
click node_dashboard "https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/assets/index.html"

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_activity,node_webview,node_statuspoll,node_user toneBlue
class node_native,node_calibration,node_http toneAmber
class node_dashboard toneMint
class node_shizuku,node_physical,node_virtual toneIndigo
```

## Components

### Android wrapper

- [Main activity](https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/java/id/padfix/android/MainActivity.kt): `app/src/main/java/id/padfix/android/MainActivity.kt`
- [Dashboard WebView](https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/java/id/padfix/android/MainActivity.kt): `app/src/main/java/id/padfix/android/MainActivity.kt`
- [Status polling](https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/java/id/padfix/android/MainActivity.kt): `app/src/main/java/id/padfix/android/MainActivity.kt`

### Input backend

- [Padfix backend](https://github.com/alif20iq-gif/padfix-android/blob/main/native/padfix.c): `native/padfix.c`
- [Calibration and correction](https://github.com/alif20iq-gif/padfix-android/blob/main/native/padfix.c): `native/padfix.c`
- [Local dashboard server](https://github.com/alif20iq-gif/padfix-android/blob/main/native/padfix.c): `native/padfix.c`

### Dashboard

- [Dashboard and presets](https://github.com/alif20iq-gif/padfix-android/blob/main/app/src/main/assets/index.html): `app/src/main/assets/index.html`

### Other components

- **User**
- **Shizuku shell**
- **Physical controller**
- **Virtual gamepad**

## Connections

- User → Main activity: starts or stops (evidence: `README.md`)
- Main activity → Shizuku shell: launches backend (evidence: `app/src/main/java/id/padfix/android/MainActivity.kt`)
- Shizuku shell → Padfix backend: runs process
- Physical controller → Padfix backend: provides input (evidence: `README.md`)
- Padfix backend → Calibration and correction: calibrates and corrects (evidence: `README.md`)
- Calibration and correction → Virtual gamepad: emits corrected input (evidence: `README.md`)
- Padfix backend → Local dashboard server: serves locally (evidence: `native/padfix.c`)
- Main activity → Dashboard WebView: loads dashboard URL (evidence: `app/src/main/java/id/padfix/android/MainActivity.kt`)
- Dashboard WebView → Dashboard and presets: renders asset (evidence: `README.md`)
- Main activity → Status polling: polls backend (evidence: `app/src/main/java/id/padfix/android/MainActivity.kt`)
- Status polling → Local dashboard server: requests status (evidence: `app/src/main/java/id/padfix/android/MainActivity.kt`)
- Dashboard and presets → Local dashboard server: uses local API
