Constraint layout is by far one of the most versatile ViewGroups in the Android framework, However, the Kotlin code needed to update the constraints of a view programmatically can be a bit wordy. I have created a Constraint Layout Kotlin Extension that will make that process much easier to apply and cleaner to look at in code. Let’s get started!
Here we have the ConstraintInstructions interface that has two simple implementations, ConnectConstraint and DisconnectConstraint.
ConnectConstraints takes 4 parameters that help describe the view you're looking to constrain and to what.
I completed a project that used LiveData to emit data to my views from my ViewModel. In this article, I will review the tests I wrote for my ViewModel in hopes that this information will be useful to someone out there in the Android World.
This is the entire ExhangeRateViewModel class and I’ll walk through some of its parts to explain the logic.
I used Dagger to inject my BaseRepository implementation into the ExchangeRateViewModel. …