@@ -80,6 +80,7 @@ import com.adevinta.leku.locale.SearchZoneRect
8080import com.adevinta.leku.permissions.PermissionUtils
8181import com.adevinta.leku.tracker.TrackEvents
8282import com.adevinta.leku.utils.ReactiveLocationProvider
83+ import com.google.android.gms.maps.MapsInitializer
8384import com.google.android.gms.maps.model.BitmapDescriptor
8485import com.google.android.gms.maps.model.BitmapDescriptorFactory
8586import com.google.android.gms.maps.model.LatLng
@@ -144,10 +145,8 @@ class LocationPickerActivity :
144145 companion object {
145146 var customDataSource: GeocoderDataSourceInterface ? = null
146147 var customAdapter: LekuSearchAdapter <* , * >? = null
147- var currentLocationBitmapMaker: BitmapDescriptor ? =
148- BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory .HUE_RED )
149- var otherLocationBitmapMaker: BitmapDescriptor ? =
150- BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory .HUE_ORANGE )
148+ var currentLocationBitmapMaker: BitmapDescriptor ? = null
149+ var otherLocationBitmapMaker: BitmapDescriptor ? = null
151150 }
152151
153152 private var map: GoogleMap ? = null
@@ -376,6 +375,9 @@ class LocationPickerActivity :
376375 }
377376 searchEditLayout = findViewById(R .id.leku_search_touch_zone)
378377 searchFrameLayout = findViewById(R .id.search_frame_layout)
378+
379+ currentLocationBitmapMaker = BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory .HUE_RED )
380+ otherLocationBitmapMaker = BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory .HUE_ORANGE )
379381 }
380382
381383 private fun setUpResultsList () {
@@ -1676,7 +1678,7 @@ class LocationPickerActivity :
16761678 .replace(UNNAMED_ROAD_WITH_HYPHEN , " " )
16771679 }
16781680
1679- class Builder {
1681+ class Builder ( val context : Context ) {
16801682 private var locationLatitude: Double? = null
16811683 private var locationLongitude: Double? = null
16821684 private var searchZoneLocale: String? = null
@@ -1697,10 +1699,12 @@ class LocationPickerActivity :
16971699 private var unnamedRoadVisible = true
16981700 private var isLegacyLayoutEnabled = false
16991701 private var isSearchBarHidden = false
1700- private var currentLocationBitmapMaker: BitmapDescriptor =
1701- BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory .HUE_RED )
1702- private var otherLocationBitmapMaker: BitmapDescriptor =
1703- BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory .HUE_BLUE )
1702+ private var currentLocationBitmapMaker: BitmapDescriptor ? = null
1703+ private var otherLocationBitmapMaker: BitmapDescriptor ? = null
1704+
1705+ init {
1706+ MapsInitializer .initialize(context)
1707+ }
17041708
17051709 fun setCurrentLocation (currentLocation : BitmapDescriptor ): Builder {
17061710 this .currentLocationBitmapMaker = currentLocation
@@ -1828,7 +1832,7 @@ class LocationPickerActivity :
18281832 return this
18291833 }
18301834
1831- fun build (context : Context ): Intent {
1835+ fun build (): Intent {
18321836 val intent = Intent (context, LocationPickerActivity ::class .java)
18331837
18341838 locationLatitude?.let {
0 commit comments