AddToWishlistView
AddToWishlistView shows if a product is currently on the user's wishlist. It also allows to add or remove the product from the wishlist. AddToWishlistView is included by platform module, if you need to include this module, add it to your build.gradle
:
implementation ("com.poqstudio:catalogue.addtowishlistv3:$VERSION_NAME")
Usage
You can use it in the layout: In the layout:
<com.poqstudio.platform.view.addtowishlistv3.ui.PoqAddToWishlistView android:layout_width="@dimen/icon_button_height" android:layout_height="@dimen/icon_button_height" app:setUp="@{viewModel.addToWishlistDTO}" />
To display the success and error events, inject MainAddToWishlistViewModel
into your Activity or Fragment with activity scope and observe the appropriate LiveData:
mainAddToWishlistViewModel: MainAddToWishlistViewModel by context.poqViewModelActivity()
If you need to select more forms when the user clicks on the AddToWishlistView, you can set a listener with setOnClickListenerWhenIsNotSetUp
with your logic to present a form picker:
addToWishlistView.setOnClickListenerWhenIsNotSetUp { //Your logic to present a form picker}