What is my concept?
BBeacon will be consist from three main modules.
- Alarm – you can turn on alarm and turn off it only if you are in range of beacon (use case – each of us has problems with morning getting up if you don’t go to your beacon that will be in bedroom or kitchen you don’t turn off your alarm)
- Weather – in your beacon you have a temperature, humidity and pressure sensors. You can monitor weather outside or conditions inside or put your beacon for instance in a flowerpot with flowers and observe a soil humidity. It has many uses.
- Scanner – you can configure and manage your beacons (for example call names, scan, observe last visibility, enable/disable )
My concept on a sheet of paper:
minSdkVersion 18 targetSdkVersion 25
Libraries which will be used:
- Realm – mobile database
- RxJava2 – asynchronous events extends observer pattern
- Android Annotation – framework to speed up development using dependency injection
- Firebase – real-time database to backup
- Project Lombok – reducing unnecessary code
- EventBus – simplify communication (not sure, maybe I didn’t use it)
- Other libraries for example to views – navigation, widgets
What I did and how the application looks now?
This week I created a new project and implemented a bottom navigation. To build a bottom tab navigation I used a beautiful and large customizable library AHBottomNavigation. I separated navigation from main activity by extract to new EBean class. In this way, my main activity has a less code. Icons are generated by Android Studio plugin Android Material Design Icon Generator (highly recommend). I configured database. My choice is Realm. In this week I spend a lot of time reading about architecture. I very like this topic and I want to apply a not exaggerated approach. In one side separating layers and cleaning architecture, but on another side, in this app for example not necessary is expanded repository pattern. I decided use MVP pattern with interactors. MVP (Model – View – Presenter) allow separate UI from objects in the database. Presenter added by dependency injection is responsible for retrieving data from repositories and formats if it is necessary and display in views. Interactors are objects that allow realizing business logic. I created a sample project to show my idea.
The current appearance of the application shown in the following screen:
Plan for the next week is following:
- add UI to all views (alarm, weather, and scanner)
- add beacon model to the database
- add other models to the database