MVPvsMVVM | Model-View-Presenter vs Model-View-ViewModel in a `` Hello | Model View Controller library
kandi X-RAY | MVPvsMVVM Summary
kandi X-RAY | MVPvsMVVM Summary
Model-View-Presenter vs Model-View-ViewModel in a "Hello, World!" project
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize presenter
- Get the data model
- Set up the activity model
- Setup the views
- Unbinds listeners
- Unbind the subscription
- Unbinds presenter
- Region resume
- Set the greeting of the view
- Binds the view to the model
- Sets the greeting of the view
- Get a greeting object
- Unbind the resources
MVPvsMVVM Key Features
MVPvsMVVM Examples and Code Snippets
Community Discussions
Trending Discussions on MVPvsMVVM
QUESTION
I'm MVP lover but at the same time I'm open minded and I'm trying to improve my knowledge about MVVM and databinding:
I have forked here https://github.com/jpgpuyo/MVPvsMVVM
the original repo https://github.com/florina-muntenescu/MVPvsMVVM from @FMuntenescu
I have created several branches. In one of them, I want to show 2 different alert dialogs with diferent styles depending of the number of clicks performed on a button:
- even number of clicks -> show standard dialog
- odd number of clicks -> show droidcon dialog
You can find the branch here: https://github.com/jpgpuyo/MVPvsMVVM/tree/multiple_dialogs_databinding_different_style
I have created 2 observable fields in view model and I have added one binding adapter.
Activity:
...ANSWER
Answered 2019-Oct-22 at 22:16The solution I use for MVVM is mixed, as follows.
From the article from Jose Alcérreca mentioned in the Medium post LiveData with SnackBar, Navigation and other events (the SingleLiveEvent case) referred in the SO answer to Show Dialog from ViewModel in Android MVVM Architecture, I choose the forth option "Recommended: Use an Event wrapper". The reason being that I'm able to peek the message if needed. Also, I added the observeEvent()
extension method from this comment in Jose's Gist.
My final code is:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install MVPvsMVVM
You can use MVPvsMVVM like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the MVPvsMVVM component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page