@@ -39,6 +39,7 @@ class MapIntentBuilder(private vararg var types: MapTypes) : BaseActivityBuilder
3939 private var startLatitude: Double? = null
4040 private var startLongitude: Double? = null
4141 private var isDrivingModeEnabled: Boolean = false
42+ private var isPositioningEnabled: Boolean = false
4243
4344 /* *
4445 * Set a latitude.
@@ -119,6 +120,10 @@ class MapIntentBuilder(private vararg var types: MapTypes) : BaseActivityBuilder
119120 isDrivingModeEnabled = true
120121 }
121122
123+ fun enablePositioning () {
124+ isPositioningEnabled = true
125+ }
126+
122127 override fun createIntent (context : Context ) =
123128 if (types.isEmpty()) {
124129 Intent (Intent .ACTION_VIEW , undefinedMapUri())
@@ -179,6 +184,7 @@ class MapIntentBuilder(private vararg var types: MapTypes) : BaseActivityBuilder
179184
180185 if (startLatitude != null && startLongitude != null ) {
181186 if (isDrivingModeEnabled) sb.append(" google.navigation:q=" , latitude, " ," , longitude)
187+ else if (isPositioningEnabled) sb.append(" http://maps.google.com/maps?daddr=" , latitude, " ," , longitude)
182188 else sb.append(" http://maps.google.com/maps?saddr=${startLatitude} ,${startLongitude} &daddr=${latitude} ,${longitude} " )
183189 } else {
184190 if (viewType == null ) {
@@ -207,6 +213,8 @@ class MapIntentBuilder(private vararg var types: MapTypes) : BaseActivityBuilder
207213 sb.append(" yandexmaps://" , " maps.yandex.ru/?" )
208214 if (startLongitude != null && startLatitude != null ) {
209215 sb.append(" rtext=" , startLatitude, " ," , startLongitude, " ~" , latitude, " ," , longitude)
216+ } else if (isPositioningEnabled) {
217+ sb.append(" rtext=~" , latitude, " ," , longitude)
210218 } else {
211219 if (latitude != null && longitude != null ) {
212220 sb.append(" pt=" )
@@ -296,6 +304,7 @@ class MapIntentBuilder(private vararg var types: MapTypes) : BaseActivityBuilder
296304 it.startLongitude = startLongitude
297305 it.zoom = zoom
298306 it.viewType = viewType
307+ it.isPositioningEnabled = isPositioningEnabled
299308 }
300309 .createIntentHandler(context)
301310 result + = intentHandler
0 commit comments