How rokiden/midandpad-dj works
1. What this repository is
- This is a single-purpose Android app called Midandpad, an MIDI controller for Android.
- The repo is centered around one mobile application module (app) with no backend service or multi-module architecture.
2. Top-level system boundary
- The application sits entirely on-device: user interaction happens in the app UI, and MIDI output is sent from the phone/tablet to an external MIDI target.
- There is no evidence of a server, cloud sync, or web layer; the key external boundary is the Android MIDI ecosystem / connected MIDI device.
3. App entry and screen flow
- MainActivity.kt is the likely Android entry point, with Splash.kt as the initial loading/branding screen.
- The main experience is split across several dedicated screens:
- MainScreen.kt for the primary controller surface
- ExploreScreen.kt for browsing/selecting content or presets
- BtnConfigScreen.kt and BarConfigScreen.kt for configuration workflows
- TouchCalibration.kt for input calibration
- AndroidManifest.xml and the XML layouts under res/layout define how these screens are launched and arranged.
4. UI composition
- The app appears to use classic Android XML layouts rather than a single declarative UI stack.
- Reusable custom UI pieces are implemented as Kotlin classes such as:
- EventButton, CalibrationButton
- VerticalSlider, CCBar
- NoteRow, PresetItem
- PropertiesView
- These components are backed by specialized layouts like button_note.xml, button_control.xml, button_program.xml, button_chord.xml, noterow.xml, and mixer.xml.
5. MIDI generation subsystem
- MIDI behavior is concentrated in MidiHelper.kt, MidiConfig.kt, and MidiConfig-related data structures.
- The app supports multiple MIDI action types, reflected by the config classes:
- ButtonNoteCfg
- ButtonControlCfg
- ButtonProgramCfg
- ButtonChordCfg
- This suggests the UI maps user gestures to different kinds of MIDI messages: notes, control changes, program changes, and chords.
6. Configuration model
- ConfigParams.kt likely holds the shared state and parameters that connect the UI to MIDI behavior.
- The config screens and custom view classes indicate a two-layer model:
- screen-specific editing UIs
- shared configuration/state objects used at runtime
- MidiConfig.kt and the button config classes are the main boundary between “what the user designed” and “what the controller sends”.
7. Persistence and backup
- MidandpadDB.kt is the app’s persistence layer for storing configurations/presets.
- BackupDatabase.kt indicates the app can export or restore saved data, which is important for a controller app where users build custom setups.
- The presence of res/xml/backup_rules.xml and data_extraction_rules.xml shows Android-managed backup/restore integration is also configured.
8. Touch and calibration pipeline
- TouchCalibration.kt and CalibrationButton.kt suggest the app includes an explicit calibration workflow for touch mapping.
- This matters for a MIDI controller UI because button positions, sliders, and pads need predictable touch areas, especially on different screen sizes.
- Calibration data likely feeds back into the configuration and rendering logic used by the main controller screen.
9. Main interaction modes
- The layouts and classes indicate at least three interaction families:
- note/pad triggering (NoteRow, button_note.xml)
- continuous controls (VerticalSlider, CCBar, button_control.xml)
- program/chord/preset actions (ButtonProgramCfg, ButtonChordCfg, PresetItem)
- This implies the main screen is a configurable MIDI surface rather than a fixed instrument UI.
10. Assets and presentation layer
- The app includes many vector drawables for note durations and UI state, plus custom icons and status shapes.
- Strings are localized in English and Spanish (values/strings.xml, values-es/strings.xml), so the UI is multilingual.
- Theme, sizes, margins, and custom attrs are centralized in res/values, which supports consistent styling across the controller screens.
11. Build, release, and distribution
- The project is built with Gradle Kotlin DSL (build.gradle.kts, app/build.gradle.kts).
- GitHub Actions workflows (build-apk.yml, build-release-apk.yml) automate APK generation.
- fastlane/metadata indicates the app is prepared for Play Store-style release metadata and screenshots, so distribution is part of the repo architecture.
12. Overall data flow
- A typical flow is: user touches a custom control → screen/component uses calibration and config state → MIDI helper constructs the outgoing MIDI event → event is sent to an external MIDI destination.
- Configuration changes flow in the opposite direction into persistence: config screen → database/backup layer → restored on next launch.
13. How to diagram it
- A good architecture diagram would show:
- Android app shell / MainActivity
- navigation to the main controller, config screens, calibration, and splash
- shared config/state layer
- MIDI message generation layer
- persistence/backup layer
- custom reusable UI components feeding the main controller and config screens
- external MIDI device boundary on the output side
Main entry points: MainActivity.kt MainActivity · maincontainer.xml XML layouts · MainScreen.kt MainScreen · BtnConfigScreen.kt BtnConfigScreen
Components 21
Android app
Single-module Midandpad application code and resources
- MainActivity · App entry and screen host
app/src/main/java/org/gnu/itsmoroto/midandpad/MainActivity.kt - Splash · Initial branding/loading screen
app/src/main/java/org/gnu/itsmoroto/midandpad/Splash.kt - MainScreen · Primary MIDI performance surface
app/src/main/java/org/gnu/itsmoroto/midandpad/MainScreen.kt - ExploreScreen · Browse and select content or presets
app/src/main/java/org/gnu/itsmoroto/midandpad/ExploreScreen.kt - BtnConfigScreen · Edit button-trigger mappings
app/src/main/java/org/gnu/itsmoroto/midandpad/BtnConfigScreen.kt - BarConfigScreen · Edit continuous-control mappings
app/src/main/java/org/gnu/itsmoroto/midandpad/BarConfigScreen.kt - TouchCalibration · Calibrate touch targets and layout mapping
app/src/main/java/org/gnu/itsmoroto/midandpad/TouchCalibration.kt - ConfigParams · Runtime parameters shared across screens
app/src/main/java/org/gnu/itsmoroto/midandpad/ConfigParams.kt - MidiConfig · Shared MIDI configuration model
app/src/main/java/org/gnu/itsmoroto/midandpad/MidiConfig.kt - MidiHelper · Builds and sends MIDI messages
app/src/main/java/org/gnu/itsmoroto/midandpad/MidiHelper.kt - MidandpadDB · Stores controller setups and presets
app/src/main/java/org/gnu/itsmoroto/midandpad/MidandpadDB.kt - BackupDatabase · Export and restore app data
app/src/main/java/org/gnu/itsmoroto/midandpad/BackupDatabase.kt - Pad controls · Event and calibration buttons
app/src/main/java/org/gnu/itsmoroto/midandpad/EventButton.kt - Control widgets · Sliders, bars, and note rows
app/src/main/java/org/gnu/itsmoroto/midandpad/VerticalSlider.kt - PropertiesView · Shared property editing view
app/src/main/java/org/gnu/itsmoroto/midandpad/PropertiesView.kt - Button cfgs · Note, control, program, and chord configs
app/src/main/java/org/gnu/itsmoroto/midandpad/ButtonNoteCfg.kt - AndroidManifest · Declares app components and launch wiring
app/src/main/AndroidManifest.xml
Build and release
Gradle, CI, and store metadata
- Build and release · Gradle, GitHub Actions, and store metadata
build.gradle.kts
Resources
Layouts, drawables, strings, themes, and XML resources
- XML layouts · Screen and widget layouts
app/src/main/res/layout/maincontainer.xml - Styles and assets · Drawables, strings, themes, sizes, and attrs
app/src/main/res/values/strings.xml
Other components
- MIDI device · Connected hardware or Android MIDI endpoint
Connections 27
- AndroidManifest → MainActivity: launches · Declares the entry activity
- MainActivity → Splash: shows · Starts with the splash screen
- MainActivity → MainScreen: navigates · Opens the primary controller surface
- MainActivity → ExploreScreen: navigates · Opens preset/content browsing
- MainActivity → BtnConfigScreen: navigates · Opens button mapping editor
- MainActivity → BarConfigScreen: navigates · Opens continuous-control editor
- MainActivity → TouchCalibration: navigates · Opens touch calibration
- MainScreen → Pad controls: uses · Renders pad and trigger controls
- MainScreen → Control widgets: uses · Renders mixer and bar controls
- MainScreen → ConfigParams: reads · Consumes shared controller state
- MainScreen → MidiHelper: sends · Converts interaction into MIDI output
- ExploreScreen → MidandpadDB: reads · Loads stored presets and setups
- BtnConfigScreen → PropertiesView: uses · Edits button properties
- BarConfigScreen → PropertiesView: uses · Edits bar properties
- TouchCalibration → Pad controls: uses · Calibrates touch targets
- Button cfgs → MidiConfig: defines · Specialized action variants feed the shared MIDI model
- MidiConfig → MidiHelper: drives · Defines what message to generate
- ConfigParams → MidiConfig: binds · Connects runtime state to MIDI setup
- MidandpadDB → BackupDatabase: syncs · Persisted data can be backed up or restored
- XML layouts → MainActivity: inflates · Activity and screen layouts
- XML layouts → MainScreen: inflates · Main controller layout
- XML layouts → BtnConfigScreen: inflates · Button config layout
- XML layouts → BarConfigScreen: inflates · Bar config layout
- XML layouts → TouchCalibration: inflates · Calibration layout
- Styles and assets → XML layouts: supports · Themes, strings, sizes, attrs, and drawable assets
- Build and release → AndroidManifest: packages · Builds the Android app bundle/APK
- MidiHelper → MIDI device: outputs · Sends MIDI events to external target