{"id":13774006,"url":"https://github.com/androiddevnotesforks/Bitlue","last_synced_at":"2025-05-11T06:31:58.635Z","repository":{"id":41800929,"uuid":"348243725","full_name":"androiddevnotesforks/Bitlue","owner":"androiddevnotesforks","description":"Bitlue is an app where you can check the Bitcoin's current market price value (Bitcoin + value = Bitlue) and its records.","archived":false,"fork":false,"pushed_at":"2021-03-15T09:03:42.000Z","size":11830,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-17T09:38:29.265Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/androiddevnotesforks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-16T06:53:08.000Z","updated_at":"2023-12-01T11:18:25.000Z","dependencies_parsed_at":"2022-09-03T12:30:29.496Z","dependency_job_id":null,"html_url":"https://github.com/androiddevnotesforks/Bitlue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androiddevnotesforks%2FBitlue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androiddevnotesforks%2FBitlue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androiddevnotesforks%2FBitlue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/androiddevnotesforks%2FBitlue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/androiddevnotesforks","download_url":"https://codeload.github.com/androiddevnotesforks/Bitlue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253528365,"owners_count":21922623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:22.822Z","updated_at":"2025-05-11T06:31:57.562Z","avatar_url":"https://github.com/androiddevnotesforks.png","language":null,"funding_links":[],"categories":[":art: Pattern"],"sub_categories":["MVVM"],"readme":"# Bitlue\n\n\u003cimg src=\"https://j.gifs.com/0Y41GG.gif\" width=40% height=40%\u003e \u003cimg src=\"https://j.gifs.com/E8DAnK.gif\" width=40% height=40%\u003e\n\n\u003e GIF Source: [Bitlue_DemoVideo](Bitlue_DemoVideo.mp4)\n\nBitlue is an app where you can check the Bitcoin's current market price value (Bitcoin + value = Bitlue) and its records.\n\nThe price values were requested from [Blockchain API](https://www.blockchain.com/charts).\n\n## Getting Started\n\nIn the last 3 days, I developed this nice app using the following tech stack:\n- Kotlin\n- MVVM architecture\n- Jetpack Architecture Components: ViewModel, Navigation...\n- Hilt - Dependency injection\n- Coroutines + Flow\n- Material Design Components\n- Retrofit\n- [MPAndroidChart](https://github.com/PhilJay/MPAndroidChart)\n\n## MVVM Architecture\n\nIn this section I will explain the MVVM architecture followed and all its different parts:\n\n### UI\nFirst of all, the UI is strongly supported by a solid design system supported by the **Material Design**.\nThanks to that, create a consistent design and a **dark theme** in parallel were able to achieve.\n\nThis project follows the *Single-Activity pattern*, where **`MainActivity.kt`** its the base Activity. \nFrom it we can differentiate 2 Fragments:\n  * **`BitcoinValueFragment.kt`**: you can check the current price value of the Bitcoin and a chart of its records.\n  \n\u003cimg src=\"https://github.com/Trosydman/Bitlue/blob/main/Bitlue_LightTheme_HomeScreen.png\" width=40% height=40%\u003e \u003cimg src=\"https://github.com/Trosydman/Bitlue/blob/main/Bitlue_DarkTheme_HomeScreen.png\" width=40% height=40%\u003e\n  \n  * **`FilterSettingsDialogFragment.kt`**: filters the chart values between 2 filters: time \n  range(`enum class FilterTimeRange`) and rolling average(`enum class FilterRollingAverage`).\n  \n  \u003cimg src=\"https://github.com/Trosydman/Bitlue/blob/main/Bitlue_LightTheme_FilterSettings.png\" width=40% height=40%\u003e \u003cimg src=\"https://github.com/Trosydman/Bitlue/blob/main/Bitlue_DarkTheme_FilterSettings.png\" width=40% height=40%\u003e\n\nBoth Fragments are consuming the same ViewModel: **`MainViewModel.kt`**. The `FilterSettingsDialogFragment` was highly dependent on the `BitcoinValueFragment` and vice-versa, so I thought it make sense to share the same *ViewModel*.\n\nApart from the use of `LiveData` to display some reactive data, the other part of the communication between the Fragments and the ViewModel is made by the **unidirectional event-state data flow pattern**. This pattern allows to separate the UI events (of Fragments) from the UI states (requested by the `MainViewModel`). It highly achieves to decouple the UI logic and the business logic and it organizes them in a better way.\n\nThe chart in the `BitcoinValueFragment` is powered by [MPAndroidChart](https://github.com/PhilJay/MPAndroidChart). In addition, a custom view called **`BitcoinValueChart`** was created to wrap all needed setup code for the final chart.\n\n### Repository + DataSource\n\nIt was built a **`BitcoinRepository.kt`** which consumes from **`BlockchainRemoteDataSource.kt`** that provides with all Bitcoin information from **`BlockchainAPI.kt`** using **Retrofit**.\n\nA separate ***interface DataSource*** was created because it was planned to create a *LocalDataSource* to be able to save some values locally in a Room database. Unfortunately this was not possible to accomplish in the given time.\n\n### Data Models\nIn order to keep the UI model (domain model) separate from any DTO model, I created 2 different types of models:\n  * **`BitcoinRecordInfo`** \u0026 **`BitcoinValue`** as domain models. `BitcoinRecordInfo` to display some general info in the `BitcoinValueFragment`, and `BitcoinValue` to display values in the chart.\n  * **`BlockchainResponseDTO`** \u0026 **`BitcoinValueDTO`** as the remote source models. Used to retrieve data from the `BlockchainAPI`.\n  \nBoth of them make use of their own mappers which are used in the Repository layer to map the DTOs to the domain model when retrieving the Bitcoin info.\n\n## Conclusion \n\n### Resources\nFind attach to the project folder a [Debug APK](app-debug.apk).\nIn addition, a few screenshots and a demo video can be found also in the project folder: \n- Bitlue_DemoVideo.mp4\n- Bitlue_LightTheme_HomeScreen.png\n- Bitlue_LightTheme_FilterSettings.png\n- Bitlue_DarkTheme_HomeScreen.png\n- Bitlue_DarkTheme_FilterSettings.png\n\n### Final words\nI hope you could enjoy my work and could appreciate the effort in it.\n\nDon't hesitate to ask any question if you have. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroiddevnotesforks%2FBitlue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandroiddevnotesforks%2FBitlue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroiddevnotesforks%2FBitlue/lists"}