From 497dc8ad40dd7a4de29c5840798bc7b99b1436fd Mon Sep 17 00:00:00 2001 From: "andreas.schildbach@gmail.com" Date: Tue, 17 May 2011 16:15:23 +0000 Subject: [PATCH] line colors git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@652 0924bc21-9374-b0fa-ee44-9ff1593b38f0 --- src/de/schildbach/pte/MetProvider.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/de/schildbach/pte/MetProvider.java b/src/de/schildbach/pte/MetProvider.java index e33cdc57..7319d747 100644 --- a/src/de/schildbach/pte/MetProvider.java +++ b/src/de/schildbach/pte/MetProvider.java @@ -18,11 +18,14 @@ package de.schildbach.pte; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.TimeZone; import de.schildbach.pte.dto.Location; import de.schildbach.pte.dto.LocationType; +import de.schildbach.pte.util.Color; /** * @author Andreas Schildbach @@ -72,4 +75,26 @@ public class MetProvider extends AbstractEfaProvider { return String.format(NEARBY_STATION_URI, stationId); } + + private static final Map LINES = new HashMap(); + + static + { + LINES.put('R', new int[] { Color.parseColor("#a24ba3"), Color.WHITE }); + LINES.put('S', new int[] { Color.parseColor("#3a75c4"), Color.WHITE }); + LINES.put('T', new int[] { Color.parseColor("#5bbf21"), Color.WHITE }); + LINES.put('B', new int[] { Color.parseColor("#f77f00"), Color.WHITE }); + } + + @Override + public int[] lineColors(final String line) + { + // TODO NightRider buses (buses with numbers > 940): #f26522 + + final int[] lineColors = LINES.get(line.charAt(0)); + if (lineColors != null) + return lineColors; + else + return super.lineColors(line); + } }