This is a simple journal Android application built using the Model-View-Intent (MVI) architecture pattern along with Clean Architecture principles. The package structure is designed for easy migration to a multi-module setup.
Jorunal
composable is wrapper over BasicTextField that transforms the text styling according to received List<TransformationConfig>
.
Params | Type | Description | Example values |
---|---|---|---|
style | SpanStyle | The style to be applied to the text segment between opening and closing tags | SpanStyle(fontWeight = FontWeight.Bold) |
openingChar | Char | opening tag | '>' for headline |
closingChar | Char | closing tag | '\n' for headline |
showOpeningChar | Boolean | defines if the opening tag should be shown or hidden | false as '>' should be hidden |
showClosingChar | Boolean | defines if the opening tag should be shown or hidden | true as '\n' should be shown |
openingHtml | String | corresponding html for opening tag | <h1> for '>' |
closingHtml | String | corresponding html for closing tag | </h1> for '\n' |
- The UI consists of a single screen called
JournalScreen
, featuring a custom composable calledJournal
.Journal
acts as a wrapper overBasicTextField
and supports customization through aTransformationConfig
, enabling different text styles through opening and closing tag characters. Upon saving a journal (if it wasn't previously saved), the text is being reset. All saved journals are displayed in the Navigation drawer. The list is fetched page-by-page. - The
ViewModel
manages the view state and executes app business logic throughUseCases
. It handles data caching and retrieval.
- UseCases are responsible for executing business logic.
- The repository acts as an intermediary between
UseCases
and the data source, utilizing domain models. This ensures the testability of the application.
- The repository implementation resides in the data layer, responsible for interacting with the data source and mapping data models into domain models.
- The datasource uses its own models and stores the user inputs so that journals can be edited even if the app is restarted.
- Dependency Injection: Koin
- Navigation: Navigation library
- Pagination: Paging Library 3
- Database: Room
- Creating an Easy-to-Use interface for interacting with the Journal custom composable, enabling developers to easily add custom opening and closing tags with related span styles such as italic, semibold, etc.
- Responsibility Segregation: Ensuring correct responsibility segregation, such as moving HTML generation from the composable to the UseCases.
In addition to UX improvements, two potential enhancements are identified:
- Implement Paging for Long Journals: If journals are expected to be lengthy, implement paging to load content in paragraphs. Proper cursor management would be essential for this feature.
- Add a debounce to Database Writes: Add debouncing to database writes to optimize performance, especially when users type rapidly, reducing unnecessary write operations.