Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any examples with DataBinding? #17

Open
nowiwr01w opened this issue Aug 23, 2020 · 1 comment
Open

Any examples with DataBinding? #17

nowiwr01w opened this issue Aug 23, 2020 · 1 comment

Comments

@nowiwr01w
Copy link

Please, share with us, if it's possible.

@nowiwr01w nowiwr01w changed the title Any example with DataBinding? Any examples with DataBinding? Aug 23, 2020
@Arunachalamkalimuthu
Copy link

@nowiwr01 Used Datbinding to change the state of the view

 @JvmStatic
    @BindingAdapter(value = ["bind:favouriteChildView"])
    fun bindFavouriteState(view: SmallBangView, childView: View) {
        view.setOnClickListener {
            if (view.isSelected) {
                view.isSelected = false
            } else {
                view.isSelected = true
                view.likeAnimation(object : AnimatorListenerAdapter() {
                    override fun onAnimationEnd(animation: Animator?) {
                        super.onAnimationEnd(animation)
                    }
                })
            }


        }
    }
                    <xyz.hanks.library.bang.SmallBangView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_centerVertical="true"
                        android:layout_marginStart="16dp"
                        android:layout_marginEnd="16dp"
                        bind:favouriteChildView="@{favouriteChildView}">

                        <ImageView
                            android:id="@+id/favourite_child_view"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:src="@drawable/favourite_selector_selected" />
                    </xyz.hanks.library.bang.SmallBangView>

`

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants