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() {
|
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)
|
val switchMerchants = popupView?.findViewById<SwitchCompat>(R.id.switchMerchants)
|
||||||
switchMerchants?.isChecked = showMerchantsMarkers
|
switchMerchants?.isChecked = showMerchantsMarkers
|
||||||
|
@ -199,28 +199,35 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
||||||
mDisposables.add(Observable.zip(merchantsObs, tellerObs,
|
mDisposables.add(Observable.zip(merchantsObs, tellerObs,
|
||||||
BiFunction<List<Merchant>, List<Teller>, List<MapObject>> { t1, t2 ->
|
BiFunction<List<Merchant>, List<Teller>, List<MapObject>> { t1, t2 ->
|
||||||
val mapObjects = ArrayList<MapObject>()
|
val mapObjects = ArrayList<MapObject>()
|
||||||
for (merchant in t1) {
|
|
||||||
val mapObject = MapObject(
|
// Show merchant suggestions only if merchants are enabled
|
||||||
merchant._id,
|
if (showMerchantsMarkers) {
|
||||||
merchant.lat,
|
for (merchant in t1) {
|
||||||
merchant.lon,
|
val mapObject = MapObject(
|
||||||
merchant.name,
|
merchant._id,
|
||||||
merchant.address,
|
merchant.lat,
|
||||||
1
|
merchant.lon,
|
||||||
)
|
merchant.name,
|
||||||
mapObjects.add(mapObject)
|
merchant.address,
|
||||||
|
1
|
||||||
|
)
|
||||||
|
mapObjects.add(mapObject)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (teller in t2) {
|
// Show teller suggestions only if tellers are enabled
|
||||||
val mapObject = MapObject(
|
if (showTellerMarkers) {
|
||||||
teller._id,
|
for (teller in t2) {
|
||||||
teller.lat,
|
val mapObject = MapObject(
|
||||||
teller.lon,
|
teller._id,
|
||||||
teller.gt_name,
|
teller.lat,
|
||||||
teller.address,
|
teller.lon,
|
||||||
0
|
teller.gt_name,
|
||||||
)
|
teller.address,
|
||||||
mapObjects.add(mapObject)
|
0
|
||||||
|
)
|
||||||
|
mapObjects.add(mapObject)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapObjects
|
mapObjects
|
||||||
|
|
Loading…
Reference in a new issue