@@ -17,10 +17,15 @@ fun placeAdapterDelegate(
17
17
bookmarkLocationDao : BookmarkLocationsDao ,
18
18
onItemClick : ((Place ) -> Unit )? = null,
19
19
onCameraClicked : (Place , ActivityResultLauncher <Array <String >>) -> Unit ,
20
+ onCameraLongPressed : () -> Boolean ,
20
21
onGalleryClicked : (Place ) -> Unit ,
22
+ onGalleryLongPressed : () -> Boolean ,
21
23
onBookmarkClicked : (Place , Boolean ) -> Unit ,
24
+ onBookmarkLongPressed : () -> Boolean ,
22
25
onOverflowIconClicked : (Place , View ) -> Unit ,
26
+ onOverFlowLongPressed : () -> Boolean ,
23
27
onDirectionsClicked : (Place ) -> Unit ,
28
+ onDirectionsLongPressed : () -> Boolean ,
24
29
inAppCameraLocationPermissionLauncher : ActivityResultLauncher <Array <String >>
25
30
) = adapterDelegateViewBinding<Place , Place , ItemPlaceBinding >({ layoutInflater, parent ->
26
31
ItemPlaceBinding .inflate(layoutInflater, parent, false )
@@ -39,15 +44,20 @@ fun placeAdapterDelegate(
39
44
}
40
45
}
41
46
nearbyButtonLayout.cameraButton.setOnClickListener { onCameraClicked(item, inAppCameraLocationPermissionLauncher) }
47
+ nearbyButtonLayout.cameraButton.setOnLongClickListener { onCameraLongPressed() }
48
+
42
49
nearbyButtonLayout.galleryButton.setOnClickListener { onGalleryClicked(item) }
50
+ nearbyButtonLayout.galleryButton.setOnLongClickListener{onGalleryLongPressed()}
43
51
bookmarkButtonImage.setOnClickListener {
44
52
val isBookmarked = bookmarkLocationDao.updateBookmarkLocation(item)
45
53
bookmarkButtonImage.setImageResource(
46
54
if (isBookmarked) R .drawable.ic_round_star_filled_24px else R .drawable.ic_round_star_border_24px
47
55
)
48
56
onBookmarkClicked(item, isBookmarked)
49
57
}
58
+ bookmarkButtonImage.setOnLongClickListener{onBookmarkLongPressed()}
50
59
nearbyButtonLayout.iconOverflow.setOnClickListener { onOverflowIconClicked(item, it) }
60
+ nearbyButtonLayout.iconOverflow.setOnLongClickListener{onOverFlowLongPressed()}
51
61
nearbyButtonLayout.directionsButton.setOnClickListener { onDirectionsClicked(item) }
52
62
bind {
53
63
tvName.text = item.name
@@ -74,6 +84,7 @@ fun placeAdapterDelegate(
74
84
R .drawable.ic_round_star_border_24px
75
85
)
76
86
}
87
+ nearbyButtonLayout.directionsButton.setOnLongClickListener{onDirectionsLongPressed()}
77
88
}
78
89
}
79
90
0 commit comments