{"id":27105209,"url":"https://github.com/techpro-studio/androidapparchitecture","last_synced_at":"2026-04-29T01:02:53.331Z","repository":{"id":122086192,"uuid":"193797113","full_name":"techpro-studio/AndroidAppArchitecture","owner":"techpro-studio","description":"Android App Architecture we use. Feel free to contribute.","archived":false,"fork":false,"pushed_at":"2020-03-08T08:13:40.000Z","size":150,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-03T04:25:36.383Z","etag":null,"topics":["android","architecture","jetpack-android","koin","livedata","viewmodels"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techpro-studio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-25T23:33:18.000Z","updated_at":"2020-04-23T12:38:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f6c22b8-e4c5-496e-bd77-564f0a6b9697","html_url":"https://github.com/techpro-studio/AndroidAppArchitecture","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/techpro-studio/AndroidAppArchitecture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techpro-studio%2FAndroidAppArchitecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techpro-studio%2FAndroidAppArchitecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techpro-studio%2FAndroidAppArchitecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techpro-studio%2FAndroidAppArchitecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techpro-studio","download_url":"https://codeload.github.com/techpro-studio/AndroidAppArchitecture/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techpro-studio%2FAndroidAppArchitecture/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32405904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["android","architecture","jetpack-android","koin","livedata","viewmodels"],"created_at":"2025-04-06T18:37:35.335Z","updated_at":"2026-04-29T01:02:53.326Z","avatar_url":"https://github.com/techpro-studio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AndroidAppArchitecture\n\nWe use MVVM in Android apps.\n\nSOLID principles are the core of our apps.\n\nWe use Android architecture components in the apps.\n\nNavigation component is optional, it could be used for small apps.\n\nFor injecting dependencies we prefer to use [Koin](https://github.com/InsertKoinIO/koin). It is more lightweight than Dagger2 and it has support for ViewModels. So you don't need to create Factories by yourself when you need to inject something in ViewModel.\n\nEvery screen has the following structure:\n\n#### Activity \n  It's just a container for fragments.\n   \n#### Fragment\n\nIt binds viewModel and contains all view logic. \n\n#### ViewModel\n\nAbstract class for View Model inherited from ViewModel class in AAC.\n\n```kotlin\n  abstract class MainViewModel: ViewModel() {\n      abstract val list: LiveData\u003cList\u003cModel\u003e\u003e\n      abstract fun refresh()\n  }\n```\n\nIt has liveData variables. The main idea is to encapsulate all RxJava in viewModel and provide only liveData to Fragment.\n\n\n```kotlin\n\nclass DefaultMainViewModel(private  var modelLocalRepository: ModelLocalRepository): MainViewModel() {\n\n    override val list: MutableLiveData\u003cList\u003cModel\u003e\u003e = MutableLiveData()\n\n    private  var disposable: Disposable?=null\n\n    init {\n        list.postValue(modelLocalRepository.getList())\n        observeList()\n    }\n\n\n    private fun observeList() {\n        disposable = modelLocalRepository.observeList().subscribe { new -\u003e\n            list.postValue(new)\n        }\n    }\n\n    override fun refresh() {\n        val new = Model(UUID.randomUUID().toString(), Date().time.toString())\n        modelLocalRepository.save(new)\n\n    }\n\n    override fun onCleared() {\n        super.onCleared()\n        disposable?.dispose()\n    }\n  }\n```\n\nIt is convenient because you can dispose disposables in onCleared method in ViewModel. Also, it will bring less crashes, etc.  \n\nThus, every dependency you need in ViewModel is injected.\n\nThe crucial point is that all dependencies should have one responsibility and they should be abstractions. \n\nAll Dependencies for ViewModel should be built on principles of Clean Architecture.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechpro-studio%2Fandroidapparchitecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechpro-studio%2Fandroidapparchitecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechpro-studio%2Fandroidapparchitecture/lists"}