Show merchants and tellers suggestions in MerchantsFragment's SearchView if they are enabled in the popup window.
This commit is contained in:
parent
732d48796b
commit
5fc5db88c2
1 changed files with 28 additions and 21 deletions
|
@ -127,7 +127,7 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
|||
}
|
||||
|
||||
private fun setupPopupWindow() {
|
||||
val popupView = layoutInflater?.inflate(R.layout.popup_menu_merchants, null)
|
||||
val popupView = layoutInflater?.inflate(R.layout.popup_menu_merchants, null, false)
|
||||
|
||||
val switchMerchants = popupView?.findViewById<SwitchCompat>(R.id.switchMerchants)
|
||||
switchMerchants?.isChecked = showMerchantsMarkers
|
||||
|
@ -199,6 +199,9 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
|||
mDisposables.add(Observable.zip(merchantsObs, tellerObs,
|
||||
BiFunction<List<Merchant>, List<Teller>, List<MapObject>> { t1, t2 ->
|
||||
val mapObjects = ArrayList<MapObject>()
|
||||
|
||||
// Show merchant suggestions only if merchants are enabled
|
||||
if (showMerchantsMarkers) {
|
||||
for (merchant in t1) {
|
||||
val mapObject = MapObject(
|
||||
merchant._id,
|
||||
|
@ -210,7 +213,10 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
|||
)
|
||||
mapObjects.add(mapObject)
|
||||
}
|
||||
}
|
||||
|
||||
// Show teller suggestions only if tellers are enabled
|
||||
if (showTellerMarkers) {
|
||||
for (teller in t2) {
|
||||
val mapObject = MapObject(
|
||||
teller._id,
|
||||
|
@ -222,6 +228,7 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
|||
)
|
||||
mapObjects.add(mapObject)
|
||||
}
|
||||
}
|
||||
|
||||
mapObjects
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue