The goal with the architecture is to end up with something like this:
The main difference is that I’ll be using ObjectBox instead of Room. The architecture doesn’t enforce any specific implementations though. You can always swap out the implementation details. I found ObjectBox to be one of the simplest databases, and it allows for reactive queries without depending on RxJava (though you can use RxJava if you want to).
To see the full example, you can find the GitHub repository here. …
If you’re familiar with libraries like greenDAO or EventBus, you may have heard of the company that created them: greenrobot. If not, I recommend checking them out. In short, they build high quality open source libraries for app developers.
Recently, they have come out with a new library called ObjectBox. It is used to help manage your app’s local data storage. Their older library greenDAO serves the same purpose, but ObjectBox is their next step in local storage solutions. The biggest difference is that ObjectBox does not use SQL at all.
To get started using it, you can check out their gradle setup. Once you have gradle setup, the library is easy to use. Simply create your data model classes as normal, and add the annotation
If you’re familiar with RelativeLayout, then ConstraintLayout should feel similar to you. ConstraintLayout has much more flexibility though, and performs better than the RelativeLayout. In general, you should always use ConstraintLayout over RelativeLayout.
To add ConstraintLayout to your project, place the following in your
Before we look at an example of ConstraintLayout, let’s look at an example using RelativeLayout. I want to have a layout that looks like this:
To accomplish this, here is my RelativeLayout:
Now to do the same with ConstraintLayout, I added the same kind of constraints my RelativeLayout had:
But, the result looked like…