File tree 1 file changed +10
-7
lines changed
app/src/main/java/fr/free/nrw/commons/nearby
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,18 @@ fun placeAdapterDelegate(
41
41
showOrHideAndScrollToIfLast()
42
42
onItemClick?.invoke(item)
43
43
}
44
- root.setOnFocusChangeListener { view1: View ? , hasFocus: Boolean ->
44
+ root.setOnFocusChangeListener { _: View ? , hasFocus: Boolean ->
45
+ val parentView = root.parent.parent.parent as ? RelativeLayout
46
+ val bottomSheetBehavior = parentView?.let { BottomSheetBehavior .from(it) }
47
+
48
+ // Hide button layout if focus is lost, otherwise show it if it's not already visible
45
49
if (! hasFocus && nearbyButtonLayout.buttonLayout.isShown) {
46
50
nearbyButtonLayout.buttonLayout.visibility = GONE
47
- } else if (hasFocus && ! nearbyButtonLayout.buttonLayout.isShown &&
48
- BottomSheetBehavior .from(root.parent.parent.parent as RelativeLayout ).state !=
49
- BottomSheetBehavior .STATE_HIDDEN
50
- ) {
51
- showOrHideAndScrollToIfLast()
52
- onItemClick?.invoke(item)
51
+ } else if (hasFocus && ! nearbyButtonLayout.buttonLayout.isShown) {
52
+ if (bottomSheetBehavior?.state != BottomSheetBehavior .STATE_HIDDEN ) {
53
+ showOrHideAndScrollToIfLast()
54
+ onItemClick?.invoke(item)
55
+ }
53
56
}
54
57
}
55
58
nearbyButtonLayout.cameraButton.setOnClickListener { onCameraClicked(item, inAppCameraLocationPermissionLauncher, cameraPickLauncherForResult) }
You can’t perform that action at this time.
0 commit comments