I see that there is a consumer to set the view's visibility but I couldn't find an observable variant for the same. I'm trying to do something like this (for now I used a workaround but ideally an observable that emits visibility changes would be the best for this job):
secondItem.visibility()
.subscribe ({
if(it == View.VISIBLE) {
(itemWhichShouldFillLayout.layoutParams as LinearLayout.LayoutParams).weight = 0.65f
} else {
(itemWhichShouldFillLayout.layoutParams as LinearLayout.LayoutParams).weight = 0.8f
}
})