File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
app/src/main/java/fr/free/nrw/commons/nearby Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,18 @@ fun placeAdapterDelegate(
4141 showOrHideAndScrollToIfLast()
4242 onItemClick?.invoke(item)
4343 }
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
4549 if (! hasFocus && nearbyButtonLayout.buttonLayout.isShown) {
4650 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+ }
5356 }
5457 }
5558 nearbyButtonLayout.cameraButton.setOnClickListener { onCameraClicked(item, inAppCameraLocationPermissionLauncher, cameraPickLauncherForResult) }
You can’t perform that action at this time.
0 commit comments