https://github.com/psuzn/mvi-demo
Sample To-Do app built with MVI pattern for Android
https://github.com/psuzn/mvi-demo
android mvi mvi-pattern rxjava2
Last synced: 5 days ago
JSON representation
Sample To-Do app built with MVI pattern for Android
- Host: GitHub
- URL: https://github.com/psuzn/mvi-demo
- Owner: psuzn
- License: apache-2.0
- Created: 2020-08-02T03:05:17.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-20T17:10:37.000Z (about 5 years ago)
- Last Synced: 2025-04-21T12:48:48.434Z (6 months ago)
- Topics: android, mvi, mvi-pattern, rxjava2
- Language: Kotlin
- Homepage:
- Size: 3.32 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ToDo Sample App
Todo sample app built with MVI .[](https://opensource.org/licenses/Apache-2.0)
![]()
## MVI Pattern
![]()
Fig. MVI in Nutshell [image](https://medium.com/@thanh.bm/android-mvi-architecture-with-livedata-c72e9e1bd3e6)## Single Event Management
The single event management in mvi has always been a debatable question.
I'm using this simple class to handle single event.```kotlin
class SingleEvent(value: T? = null) {
private var _value: T? = nullval value: T?
get() {
val tmp = _value;
_value = null
return tmp
}init {
_value = value
}
}```
And I'm using it as:```kotlin
data class UIState(toast:SingleEvent) // state class
stateRelay.subscribe{state-> // state observable
state.toast.value?.let{ showToast(it) }
}
```
## Useful Resources
- [Managing State with RxJava](https://www.youtube.com/watch?v=0IKHxjkgop4) by [@JakeWharton ](https://github.com/JakeWharton)
- [How to cook a well-done MVI for Android
](https://www.youtube.com/watch?v=Ls0uKLqNFz4) by [@colriot](https://github.com/colriot)
- [MVICore](https://github.com/badoo/MVICore) by [@badoo](https://github.com/badoo)## Bugs and Feedback
I made this app while I was playing around with mvi pattern. I am by no means expert and this implementation is not perfect.For bugs, questions and discussions please use the [Github Issues](https://github.com/psuzn/mvi-demo/issues/new).
## License
```
Copyright 2020 @psuznLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```