From 39e2b89548f8db2c74b62051e95ec10dbcf45a11 Mon Sep 17 00:00:00 2001 From: Adithya-hv Date: Wed, 13 Mar 2024 16:06:02 -0400 Subject: [PATCH] Fixed OTP polylines --- .../android/directions/util/OTPConstants.java | 4 ++++ .../android/map/DirectionsMapController.java | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/directions/util/OTPConstants.java b/onebusaway-android/src/main/java/org/onebusaway/android/directions/util/OTPConstants.java index 735e00570..e1a0010ba 100644 --- a/onebusaway-android/src/main/java/org/onebusaway/android/directions/util/OTPConstants.java +++ b/onebusaway-android/src/main/java/org/onebusaway/android/directions/util/OTPConstants.java @@ -18,6 +18,8 @@ import org.onebusaway.android.BuildConfig; +import android.graphics.Color; + import java.util.Locale; import java.util.concurrent.TimeUnit; @@ -74,6 +76,8 @@ public class OTPConstants { // flag to indicate intent sent by or on behalf of TripPlanActivity public static final String INTENT_SOURCE = "org.onebusaway.android.INTENT_SOURCE"; + public static final int OTP_TRANSIT_COLOR = Color.parseColor("#006500"); + public enum Source {ACTIVITY, NOTIFICATION} ; diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/map/DirectionsMapController.java b/onebusaway-android/src/main/java/org/onebusaway/android/map/DirectionsMapController.java index 4fd9d236a..25ec97c06 100644 --- a/onebusaway-android/src/main/java/org/onebusaway/android/map/DirectionsMapController.java +++ b/onebusaway-android/src/main/java/org/onebusaway/android/map/DirectionsMapController.java @@ -16,6 +16,7 @@ package org.onebusaway.android.map; +import org.onebusaway.android.directions.util.OTPConstants; import org.onebusaway.android.io.elements.ObaShape; import org.onebusaway.android.io.elements.ObaShapeElement; import org.onebusaway.android.util.LocationUtils; @@ -191,6 +192,12 @@ private void zoom() { } private static int resolveColor(Leg leg) { + // Color for transit routes when planning a trip + if (TraverseMode.valueOf(leg.mode).isTransit()) { + return OTPConstants.OTP_TRANSIT_COLOR; + } + + // Calculates color for non-trip planning situations if (leg.routeColor != null) { try { return Long.decode("0xFF" + leg.routeColor).intValue(); @@ -199,10 +206,7 @@ private static int resolveColor(Leg leg) { } } - if (TraverseMode.valueOf(leg.mode).isTransit()) { - return Color.BLUE; - } - + // Color defaults to grey which represents walking return Color.GRAY; }