T-MVVM | repository contains a detailed sample app | Model View Controller library
kandi X-RAY | T-MVVM Summary
kandi X-RAY | T-MVVM Summary
This repository contains a detailed sample app that implements MVVM architecture using LiveData,ViewModel,Retrofit,Rxjava
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialise the tab
- Gets Measurements for shifting mode
- Build banner
- Start scroll
- Initializes the bottomNavigationBar properties
- Get android attributes
- Helper to draw on indicator
- Calculates the rectangle width and height
- Helper method to draw the tab
- Calculate indicator rect
- Initialize views
- Gets net work data
- Sets the image frame
- Instantiates view
- Implementation of bindViewHolder methods
- Initialize the web view
- Sets the view holder and shows the views
- Called when a nested scroll axis is accepted
- Binds information about the user
- On bind view holder
- Obtains the attributes of the tabs from the context
- Decode unicode
- Obtains the attributes of the indicator from the attributes
- Obtains the attributes from the context
- Initializes the view holder
- Called when the tab is drawn
T-MVVM Key Features
T-MVVM Examples and Code Snippets
Community Discussions
Trending Discussions on T-MVVM
QUESTION
I'm following this tutorial on using MVVM with Retrofit
https://medium.com/@ronkan26/viewmodel-using-retrofit-mvvm-architecture-f759a0291b49
where the user places MutableLiveData inside the Repository class:
...ANSWER
Answered 2021-Mar-23 at 18:00The solution you're looking for depends on how your app is designed. There are several things you can try out:
- Keep your app modularized - as @ADM mentioned split your repository into smaller
- Move live data out of repository - it is unnecessary to keep live data in a repository (in your case singleton) for the entire app lifecycle while there might be only few screens that need different data.
- That's being said - keep your live data in view models - this is the most standard way of doing. You can take a look at this article that explains Retrofit-ViewModel-LiveData repository pattern
- If you end up with complicated screen and many live data objects you can still map entities into screen data representation with events / states /commands (call it as you want) which are pretty well described here. This way you have single
LiveData
and you just have to map your entities.
Additionaly you could use coroutines with retrofit as coroutines are recomended way now for handling background operations and have Kotlin support if you wanted to give it a try.
Also these links might halpe you when exploring different architectures or solutions for handling your problem architecture-components-samples or architecture-samples (mostly using kotlin though).
QUESTION
Given the design pattern as described by this post, here is an example view model:
...ANSWER
Answered 2020-Feb-05 at 02:54Just make your mapping function a private free function instead of a class member. It only needs to be a member itself if it needs access to members, which in this pattern is highly unlikely.
Edit: Also you could clean this up a lot by avoiding subjects and operate on the inputs/outputs directly like so:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install T-MVVM
You can use T-MVVM 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 T-MVVM 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