Skip to content

Commit 39e2b89

Browse files
committed
Fixed OTP polylines
1 parent c1209a4 commit 39e2b89

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Diff for: onebusaway-android/src/main/java/org/onebusaway/android/directions/util/OTPConstants.java

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import org.onebusaway.android.BuildConfig;
2020

21+
import android.graphics.Color;
22+
2123
import java.util.Locale;
2224
import java.util.concurrent.TimeUnit;
2325

@@ -74,6 +76,8 @@ public class OTPConstants {
7476
// flag to indicate intent sent by or on behalf of TripPlanActivity
7577
public static final String INTENT_SOURCE = "org.onebusaway.android.INTENT_SOURCE";
7678

79+
public static final int OTP_TRANSIT_COLOR = Color.parseColor("#006500");
80+
7781
public enum Source {ACTIVITY, NOTIFICATION}
7882

7983
;

Diff for: onebusaway-android/src/main/java/org/onebusaway/android/map/DirectionsMapController.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.onebusaway.android.map;
1818

19+
import org.onebusaway.android.directions.util.OTPConstants;
1920
import org.onebusaway.android.io.elements.ObaShape;
2021
import org.onebusaway.android.io.elements.ObaShapeElement;
2122
import org.onebusaway.android.util.LocationUtils;
@@ -191,6 +192,12 @@ private void zoom() {
191192
}
192193

193194
private static int resolveColor(Leg leg) {
195+
// Color for transit routes when planning a trip
196+
if (TraverseMode.valueOf(leg.mode).isTransit()) {
197+
return OTPConstants.OTP_TRANSIT_COLOR;
198+
}
199+
200+
// Calculates color for non-trip planning situations
194201
if (leg.routeColor != null) {
195202
try {
196203
return Long.decode("0xFF" + leg.routeColor).intValue();
@@ -199,10 +206,7 @@ private static int resolveColor(Leg leg) {
199206
}
200207
}
201208

202-
if (TraverseMode.valueOf(leg.mode).isTransit()) {
203-
return Color.BLUE;
204-
}
205-
209+
// Color defaults to grey which represents walking
206210
return Color.GRAY;
207211
}
208212

0 commit comments

Comments
 (0)