I am developing an Android app which communicates (real-time) with an Arduino device (via Bluetooth).
The main idea is that the app has two functions:
- To provide a real-time communication with the device (send commands via Buttons, etc.) - everything is done using an Android Library (created by me).
- To manipulate: real-time data AND SAVED DATA: showing a List of something, etc.
There are some places (fragments) which DO NOT use any data. So, I have fragments which are not tied with any "model" - is not data oriented.
I have a question:
- As I want to use a MVVM approach (the new Android Components pattern: View ---> ViewModel ----> Repository --- (service,api) ---> Data Source) what should I do with UI elements (fragments,activities) which do not manipulate any data?
For example, I have a Button: "Start". Very simple, I can Bind the "Start" button with the .start() method from Library. Or, at most, using a ViewModel I can link with one of its methods. But, I do not follow the App's pattern.
In this case, it's completely useless to go 3 or 4 layers only to call a simple method.
As a general rule, when using Android Architecture Components approach, what should we do when we don't need a repository, don't need a ViewModel, etc. We are just using a Library (or an App Background Service, why not)?
Aucun commentaire:
Enregistrer un commentaire