diff --git a/onebusaway-android/build.gradle b/onebusaway-android/build.gradle index 5b3b89b7e..bfe09a70f 100644 --- a/onebusaway-android/build.gradle +++ b/onebusaway-android/build.gradle @@ -348,7 +348,7 @@ dependencies { // Pelias for point-of-interest search and geocoding for trip planning origin and destination implementation 'edu.usf.cutr:pelias-client-library:1.1.0' // Google Play Services Maps (only for Google flavor) - googleImplementation 'com.google.android.gms:play-services-maps:18.0.2' + googleImplementation 'com.google.android.gms:play-services-maps:18.2.0' // Google Play Services Places is required by ProprietaryMapHelpV2 (only for Google flavor) googleImplementation 'com.google.android.libraries.places:places-compat:1.1.0' // Autocomplete text views with clear button for trip planning diff --git a/onebusaway-android/src/google/java/org/onebusaway/android/map/googlemapsv2/BaseMapFragment.java b/onebusaway-android/src/google/java/org/onebusaway/android/map/googlemapsv2/BaseMapFragment.java index a6bf1a9b2..db3b4f3ea 100644 --- a/onebusaway-android/src/google/java/org/onebusaway/android/map/googlemapsv2/BaseMapFragment.java +++ b/onebusaway-android/src/google/java/org/onebusaway/android/map/googlemapsv2/BaseMapFragment.java @@ -16,36 +16,6 @@ */ package org.onebusaway.android.map.googlemapsv2; -import static org.onebusaway.android.util.PermissionUtils.LOCATION_PERMISSIONS; -import static org.onebusaway.android.util.PermissionUtils.LOCATION_PERMISSION_REQUEST; -import static org.onebusaway.android.util.UIUtils.canManageDialog; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.app.Dialog; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.graphics.drawable.Drawable; -import android.location.Location; -import android.os.Bundle; -import android.os.Handler; -import android.provider.Settings; -import android.text.TextUtils; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.CheckBox; -import android.widget.Toast; - -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.fragment.app.DialogFragment; - import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; @@ -53,6 +23,7 @@ import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.UiSettings; +import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; @@ -60,6 +31,10 @@ import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.Polyline; import com.google.android.gms.maps.model.PolylineOptions; +import com.google.android.gms.maps.model.StampStyle; +import com.google.android.gms.maps.model.StrokeStyle; +import com.google.android.gms.maps.model.StyleSpan; +import com.google.android.gms.maps.model.TextureStyle; import com.google.android.gms.maps.model.VisibleRegion; import com.google.firebase.analytics.FirebaseAnalytics; @@ -91,12 +66,42 @@ import org.onebusaway.android.util.UIUtils; import org.opentripplanner.routing.bike_rental.BikeRentalStation; +import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.content.res.Configuration; +import android.graphics.drawable.Drawable; +import android.location.Location; +import android.os.Bundle; +import android.os.Handler; +import android.provider.Settings; +import android.text.TextUtils; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CheckBox; +import android.widget.Toast; + import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.concurrent.TimeUnit; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.fragment.app.DialogFragment; + +import static org.onebusaway.android.util.PermissionUtils.LOCATION_PERMISSIONS; +import static org.onebusaway.android.util.PermissionUtils.LOCATION_PERMISSION_REQUEST; +import static org.onebusaway.android.util.UIUtils.canManageDialog; + /** * The MapFragment class is split into two basic modes: * stop mode and route mode. It needs to be able to switch @@ -1038,12 +1043,14 @@ public void setRouteOverlay(int lineOverlayColor, ObaShape[] shapes, boolean cle mLineOverlay.clear(); } PolylineOptions lineOptions; + StampStyle polylineArrow = TextureStyle.newBuilder(BitmapDescriptorFactory.fromResource(R.drawable.ic_navigation_expand_more)).build(); + StyleSpan polylineArrowSpan = new StyleSpan(StrokeStyle.colorBuilder(lineOverlayColor).stamp(polylineArrow).build()); int totalPoints = 0; for (ObaShape s : shapes) { lineOptions = new PolylineOptions(); - lineOptions.color(lineOverlayColor); + lineOptions.addSpan(polylineArrowSpan); for (Location l : s.getPoints()) { lineOptions.add(MapHelpV2.makeLatLng(l));