How slineyube/notes works
Purpose and Runtime
Native Android notes application built in Kotlin. It supports creating, editing, searching, deleting, pinning, and viewing notes with image content. The app runs as a single Android module (app/build.gradle.kts) and uses Jetpack Compose, Room, Hilt, coroutines/Flow, Android storage, and intents; no backend or remote service is indicated.
Application Bootstrap
NotesApp.kt is the application-level initialization point and MainActivity.kt hosts the Compose UI. Android component registration and platform capabilities are defined in app/src/main/AndroidManifest.xml. Hilt provides dependency construction from the app boundary into ViewModels, use cases, and persistence.
Paths:
• app/src/main/java/com/chukmaldin/notes/NotesApp.kt
• app/src/main/java/com/chukmaldin/notes/presentation/MainActivity.kt
• app/src/main/AndroidManifest.xml
Presentation and Navigation
The presentation layer is Compose-based and organized around three user workflows: note list, creation, and editing. NavGraph.kt determines screen transitions and argument/control flow. Each screen delegates state and actions to its workflow-specific ViewModel rather than directly accessing Room or storage.
Paths:
• app/src/main/java/com/chukmaldin/notes/presentation/navigation/NavGraph.kt
• app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesViewModel.kt
• app/src/main/java/com/chukmaldin/notes/presentation/screens/creation/CreateNoteViewModel.kt
• app/src/main/java/com/chukmaldin/notes/presentation/screens/editing/EditNoteViewModel.kt
Domain Boundary
The domain layer defines app-owned Note and ContentItem models plus the NotesRepository abstraction. Focused use cases encapsulate commands and queries: add/edit/delete, retrieve list/detail, search, and switch pinned status. Presentation depends on these contracts/use cases, insulating it from Room schema and file-management details.
Paths:
• app/src/main/java/com/chukmaldin/notes/domain/NotesRepository.kt
• app/src/main/java/com/chukmaldin/notes/domain/Note.kt
• app/src/main/java/com/chukmaldin/notes/domain/GetAllNotesUseCase.kt
• app/src/main/java/com/chukmaldin/notes/domain/EditNoteUseCase.kt
Persistent Notes Model
Room is the local source of truth. A note is persisted separately from its content items, with NoteWithContentDbModel representing their joined relationship. NotesDao owns database operations/query access, while NotesDatabase defines the Room database. Flow-based repository queries can propagate storage changes back through use cases and ViewModels to Compose state.
Paths:
• app/src/main/java/com/chukmaldin/notes/data/NotesDatabase.kt
• app/src/main/java/com/chukmaldin/notes/data/NotesDao.kt
• app/src/main/java/com/chukmaldin/notes/data/NoteDbModel.kt
• app/src/main/java/com/chukmaldin/notes/data/ContentItemDbModel.kt
Repository, Mapping, and Media Boundary
NotesRepositoryImpl implements the domain repository by coordinating DAO access, database/domain mapping, and image lifecycle work. Mapper.kt is the explicit model boundary between Room entities/relations and domain values. ImageFileManager.kt isolates Android internal/external storage behavior; image files are therefore outside Room while their note content references are managed through the repository flow.
Paths:
• app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt
• app/src/main/java/com/chukmaldin/notes/data/Mapper.kt
• app/src/main/java/com/chukmaldin/notes/data/ImageFileManager.kt
Dependency and Data Flow
DataModule.kt is the composition boundary binding Room, repository implementation, and related data dependencies. Main flow: user action in Compose → ViewModel → domain use case → NotesRepository → repository implementation → Room and/or image storage; query updates return via Flow to ViewModel state and rendered screens. Image selection/import is mediated by Android intents and storage APIs rather than a network integration.
Paths:
• app/src/main/java/com/chukmaldin/notes/di/DataModule.kt
• app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt
• app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesScreen.kt
Main entry points: NotesRepositoryImpl.kt NotesRepositoryImpl · NotesScreen.kt Compose Screens · NotesApp.kt NotesApp · DataModule.kt DataModule
Components 19
Android App
- Android Manifest · Declares Android components and capabilities.
app/src/main/AndroidManifest.xml - NotesApp · Initializes the application and Hilt boundary.
app/src/main/java/com/chukmaldin/notes/NotesApp.kt - MainActivity
app/src/main/java/com/chukmaldin/notes/presentation/MainActivity.kt - DataModule · Provides Room and repository dependencies.
app/src/main/java/com/chukmaldin/notes/di/DataModule.kt - Android Intents & Storage · Supplies image selection/import and file storage access.
Compose Presentation
- NavGraph · Routes list, creation, and editing workflows.
app/src/main/java/com/chukmaldin/notes/presentation/navigation/NavGraph.kt - Compose Screens · List, creation, and editing screens render state and dispatch actions.
app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesScreen.kt - NotesViewModel
app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesViewModel.kt - CreateNoteViewModel
app/src/main/java/com/chukmaldin/notes/presentation/screens/creation/CreateNoteViewModel.kt - EditNoteViewModel
app/src/main/java/com/chukmaldin/notes/presentation/screens/editing/EditNoteViewModel.kt
Domain
- Note Use Cases · Adds, edits, deletes, lists, searches, retrieves, and pins notes.
- NotesRepository
app/src/main/java/com/chukmaldin/notes/domain/NotesRepository.kt - Note & ContentItem
app/src/main/java/com/chukmaldin/notes/domain/Note.kt
Local Data & Media
- NotesRepositoryImpl · Coordinates persistence mapping and image lifecycle operations.
app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt - Mapper · Converts Room models and relations to domain values.
app/src/main/java/com/chukmaldin/notes/data/Mapper.kt - NotesDao · Owns note and content-item queries and mutations.
app/src/main/java/com/chukmaldin/notes/data/NotesDao.kt - NotesDatabase · Local source of truth for notes and content references.
app/src/main/java/com/chukmaldin/notes/data/NotesDatabase.kt - Room Note & Content Models · Persists notes separately from content items and joins them for reads.
app/src/main/java/com/chukmaldin/notes/data/NoteDbModel.kt - ImageFileManager · Manages image files outside Room using Android storage.
app/src/main/java/com/chukmaldin/notes/data/ImageFileManager.kt
Connections 26
- Android Manifest → NotesApp: registers
- NotesApp → MainActivity: starts
- NotesApp → DataModule: initializes Hilt
- MainActivity → NavGraph: hosts
- NavGraph → Compose Screens: navigates
- Compose Screens → NotesViewModel: list actions/state
- Compose Screens → CreateNoteViewModel: creation actions/state
- Compose Screens → EditNoteViewModel: editing actions/state
- NotesViewModel → Note Use Cases: invokes
- CreateNoteViewModel → Note Use Cases: invokes
- EditNoteViewModel → Note Use Cases: invokes
- Note Use Cases → NotesRepository: depends on
- Note Use Cases → Note & ContentItem: uses
- DataModule → NotesRepositoryImpl: binds
- DataModule → NotesDatabase: provides
- NotesRepositoryImpl → NotesRepository: implements
- NotesRepositoryImpl → NotesDao: reads and writes
- NotesRepositoryImpl → Mapper: maps through
- NotesRepositoryImpl → ImageFileManager: manages images
- NotesDao → NotesDatabase: accesses
- NotesDatabase → Room Note & Content Models: stores
- Mapper → Room Note & Content Models: converts
- Mapper → Note & ContentItem: converts
- ImageFileManager → Android Intents & Storage: uses
- Android Intents & Storage → Compose Screens: image selection result
- NotesRepository → NotesViewModel: Flow updates · Storage changes propagate to rendered UI state.