Make sure the popup menu is dismissed when the toolbar or the search icon are clicked in the MerchantsFragment.
This commit is contained in:
parent
1505a5642c
commit
e328eb149b
1 changed files with 4 additions and 0 deletions
|
@ -123,6 +123,8 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
||||||
(activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
(activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
|
|
||||||
|
toolbar?.setOnClickListener { dismissPopupWindow() }
|
||||||
|
|
||||||
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||||
val mapFragment = childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment
|
val mapFragment = childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment
|
||||||
mapFragment.getMapAsync(this)
|
mapFragment.getMapAsync(this)
|
||||||
|
@ -193,6 +195,8 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
||||||
|
|
||||||
mSearchView?.setOnSuggestionListener(this)
|
mSearchView?.setOnSuggestionListener(this)
|
||||||
|
|
||||||
|
mSearchView?.setOnSearchClickListener { dismissPopupWindow() }
|
||||||
|
|
||||||
// Adjust SearchView width to avoid pushing other menu items out of the screen
|
// Adjust SearchView width to avoid pushing other menu items out of the screen
|
||||||
mSearchView?.maxWidth = screenWidth * 7 / 10
|
mSearchView?.maxWidth = screenWidth * 7 / 10
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue