File tree Expand file tree Collapse file tree
java/com/smarttoolfactory/home Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com.smarttoolfactory.home.adapter
22
3+ import android.graphics.Color
34import android.widget.ImageButton
45import androidx.annotation.LayoutRes
56import androidx.databinding.ViewDataBinding
@@ -57,12 +58,15 @@ class PropertyItemListAdapter(
5758 onLikeButtonClick(this )
5859
5960 // Set image source of like button
61+ val likeImageButton = (likeButton as ? ImageButton )
6062 val imageResource = if (isFavorite) {
61- R .drawable.ic_baseline_favorite_24
63+ likeImageButton?.setColorFilter(Color .rgb(244 , 81 , 30 ))
64+ R .drawable.ic_baseline_favorite_30
6265 } else {
63- R .drawable.ic_baseline_favorite_border_24
66+ likeImageButton?.setColorFilter(Color .rgb(41 , 182 , 246 ))
67+ R .drawable.ic_baseline_favorite_border_30
6468 }
65- (likeButton as ? ImageButton ) ?.setImageResource(imageResource)
69+ likeImageButton ?.setImageResource(imageResource)
6670 }
6771 }
6872 }
Original file line number Diff line number Diff line change 11package com.smarttoolfactory.home.viewbindings
22
3+ import android.graphics.Color
34import android.view.View
45import android.widget.ImageButton
56import android.widget.ImageView
@@ -64,6 +65,12 @@ fun View.visibilityBasedOn(condition: Boolean) {
6465@BindingAdapter(" favoriteImageSrc" )
6566fun ImageButton.setFavoriteImageSrc (favorite : Boolean ) {
6667
68+ if (favorite) {
69+ setColorFilter(Color .rgb(244 , 81 , 30 ))
70+ } else {
71+ setColorFilter(Color .rgb(41 , 182 , 246 ))
72+ }
73+
6774 val imageResource = if (favorite) R .drawable.ic_baseline_favorite_30
6875 else R .drawable.ic_baseline_favorite_border_30
6976
Original file line number Diff line number Diff line change 1414 <androidx .constraintlayout.widget.ConstraintLayout
1515 android : layout_width =" match_parent"
1616 android : layout_height =" 140dp"
17- android : layout_marginStart =" 8dp "
18- android : layout_marginEnd =" 8dp "
19- android : layout_marginBottom =" 4dp "
17+ android : layout_marginStart =" 16dp "
18+ android : layout_marginEnd =" 16dp "
19+ android : layout_marginBottom =" 6dp "
2020 android : padding =" 2dp" >
2121
2222 <androidx .cardview.widget.CardView
2323 android : id =" @+id/cvThumbnail"
2424 android : layout_width =" 0dp"
2525 android : layout_height =" match_parent"
26- android : layout_marginLeft =" 8dp"
2726 android : layout_marginTop =" 2dp"
2827 android : layout_marginBottom =" 2dp"
2928 app : cardCornerRadius =" 5dp"
103102 android : layout_height =" 40dp"
104103 android : background =" #00ffffff"
105104 android : padding =" 2dp"
106- android : src =" @drawable/ic_baseline_favorite_border_24 "
105+ android : src =" @drawable/ic_baseline_favorite_border_30 "
107106 android : tint =" #29B6F6"
108107 app : layout_constraintBottom_toBottomOf =" @+id/tvPrice"
109108 app : layout_constraintEnd_toEndOf =" parent"
You can’t perform that action at this time.
0 commit comments