As per http://developer.android.com/tools/data-binding/guide.html#imports, we can have such simple expressions in visibility:
This is the direct approach, without having to pass the variable inside the included layout
The above code was all I needed
The interesting thing is if I remove the above ternary operator and simplify it like this,
with addition of an BindingAdapter class with following method,
@BindingAdapter("android:visibility")
public static void setVisibility(View view, boolean isVisible) {
view.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
Boom! the OP error invades my entire BuildOutput trace, interesting world of Android