How tuuhin/recorderapp works
Project type and purpose
• This is a modularized Android application (“RecorderApp”) built in Kotlin.
• It follows a clean-architecture style: UI layer (Jetpack Compose + Compose Navigation), domain/use-case layer, data layer (multiple feature/data modules), and platform/infrastructure (Room, DataStore, WorkManager, Android Services).
• Purpose: capture audio, store metadata, organize with categories/bookmarks, play media, expose widgets and shortcuts.
High-level file-structure analysis
• Top-level modules:
– app: the Android application entrypoint, manifest, DI graph (RecorderApp.kt), NavHost, build scripts, schema migrations.
– build-logic: custom Gradle plugins for Android, Hilt, Room, Protobuf.
– core/ui & core/utils: shared UI components, themes, animations, common helpers.
– data/\*: one module per domain (bookmarks, categories, database, datastore, interactions, location, player, recorder, recordings, use_case, worker).
– feature/\*: UI-feature modules (recorder UI, player UI, recordings list, categories picker, editor, settings, widget).
• Each data module has data-API (implementation) + domain API + DI module.
• feature modules depend on use_case modules; use_case depends on data modules.
• app module wires everything together with Hilt, provides navigation routes.
a. Main components:
– Presentation Layer:
• Single Activity (MainActivity) hosting Compose NavHost.
• Feature UIs (feature/recorder, feature/player, feature/recordings, feature/categories, feature/settings, feature/widget, feature/editor).
– Domain/Use-Case Layer:
• Use cases in data/use_case module (e.g. CombineRecordingSources, PhoneStateObserverUseCase).
– Data Layer:
• Recorder Service (foreground service for audio capture).
• Player Service (MediaPlayerService for playback).
• Room database (data/database module).
• Proto DataStore (data/datastore module).
• Interactions (shortcuts, sharing, Bluetooth, phone-state).
• Location provider (optional geotagging).
• Worker (WorkManager tasks: remove trash, update paths).
• File providers (for recordings and bookmarks export).
– Cross-cutting:
• Hilt DI graph (bindings from all modules).
• Protobuf codegen for settings & widgets.
• Shared core/ui and core/utils.
– External Android OS: AudioRecord, MediaCodec, MediaSession, NotificationManager, WorkManager, ContentResolver, DataStore API.
b. Interactions & data flows:
1. User taps “Record” in UI → ViewModel (feature) → UseCase (start recording) → Recorder Service (data/recorder) → AudioRecord API → Room or file.
2. Service emits amplitude → ViewModel observes via Flow → UI amplitude graph.
3. Stop recording → use case writes metadata into Room (data/database) + stores settings in DataStore.
4. User navigates to “Recordings” → ViewModel → UseCase fetch recordings → Data providers (data/recordings) → ContentResolver/File system → returns list.
5. Play media → ViewModel → UseCase → PlayerService → ExoPlayer/MediaSession → Notification controls.
6. Categories/bookmarks creation → UseCase → repository → Room or CSV exporter (data/bookmarks).
7. Widgets update via Proto buffers (feature/widget + broadcast receivers).
8. Scheduled cleanup via WorkManager (data/worker).
c. Architectural patterns & design principles
• Clean Architecture: separation of presentation/domain/data.
• MVVM: Compose UI + ViewModels for each screen.
• Modularity: each feature and each data concern is its own Gradle module.
• Dependency Injection: Hilt modules in each module, unified in app.
• Service-oriented: Android Services for background tasks (record, play).
• Reactive streams: Kotlin Flows for state.
d. Key technologies & frameworks
• Kotlin + Coroutines + Flow
• Jetpack Compose + Navigation Compose
• Hilt (Dagger) for DI
• Room for local database
• Proto DataStore for typed key-value storage
• WorkManager for background workers
• Android Services + Notifications for media controls
• Protobuf for settings & widgets
Essential details to capture
• Single-Activity + multiple feature Composables.
• Two background services (recorder & player).
• Room + DataStore + WorkManager + ContentResolver flows.
• UseCase boundary between UI and data.
• Hilt modules wiring.
• Widgets via broadcast receivers and Proto models.
• Shortcuts & interactions as separate data module.