1 package com.airbnb.lottie.samples.views 2 3 import android.content.Context 4 import android.util.AttributeSet 5 import com.airbnb.epoxy.ModelProp 6 import com.airbnb.epoxy.ModelView 7 import com.airbnb.lottie.LottieAnimationView 8 import kotlinx.android.synthetic.main.listing_card.view.* 9 10 class WishListIconView @JvmOverloads constructor( 11 context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 12 ) : LottieAnimationView(context, attrs, defStyleAttr) { 13 toggleWishlistednull14 fun toggleWishlisted() { 15 isActivated = !isActivated 16 } 17 setActivatednull18 override fun setActivated(activated: Boolean) { 19 super.setActivated(activated) 20 speed = if (activated) 1f else -2f 21 progress = 0f 22 playAnimation() 23 } 24 }