Progress Bar with Data Binding in android [closed]

I am new in using Data Binding , I want to enable or disable progress according to networks state in view model. this is code ` @BindingAdapter(“app:onProgress”) fun tintPopularity(view: ProgressBar, networkState: NetworkState) { view.visibility= if (networkState==NetworkState.Loading) View.VISIBLE else View.GONE } ` and this xml <ProgressBar android:id=”@+id/progress_bar” android:layout_width=”wrap_content” android:layout_height=”match_parent” android:layout_gravity=”center” android:visibility=”gone” android:onChange=”@{viewmodel.networkState}” />

Details