diff --git a/src/de/schildbach/pte/BahnProvider.java b/src/de/schildbach/pte/BahnProvider.java index 76d28cdd..4accebf7 100644 --- a/src/de/schildbach/pte/BahnProvider.java +++ b/src/de/schildbach/pte/BahnProvider.java @@ -747,7 +747,7 @@ public final class BahnProvider implements NetworkProvider throw new IllegalStateException("cannot normalize line " + line); } - public static final Map LINES = new HashMap(); + private static final Map LINES = new HashMap(); static { @@ -759,4 +759,9 @@ public final class BahnProvider implements NetworkProvider LINES.put('B', new int[] { Color.parseColor("#993399"), Color.WHITE }); LINES.put('F', new int[] { Color.BLUE, Color.WHITE }); } + + public int[] lineColors(final String line) + { + return LINES.get(line.charAt(0)); + } } diff --git a/src/de/schildbach/pte/MvvProvider.java b/src/de/schildbach/pte/MvvProvider.java index 3ef15fd4..0207e5aa 100644 --- a/src/de/schildbach/pte/MvvProvider.java +++ b/src/de/schildbach/pte/MvvProvider.java @@ -680,7 +680,7 @@ public class MvvProvider implements NetworkProvider throw new IllegalArgumentException("cannot parse month: " + month); } - public static final Map LINES = new HashMap(); + private static final Map LINES = new HashMap(); static { @@ -724,4 +724,9 @@ public class MvvProvider implements NetworkProvider LINES.put("UU5", new int[] { Color.parseColor("#bb7700"), Color.WHITE }); LINES.put("UU6", new int[] { Color.parseColor("#0000cc"), Color.WHITE }); } + + public int[] lineColors(final String line) + { + return LINES.get(line); + } } diff --git a/src/de/schildbach/pte/NetworkProvider.java b/src/de/schildbach/pte/NetworkProvider.java index fa855122..99f0ebab 100644 --- a/src/de/schildbach/pte/NetworkProvider.java +++ b/src/de/schildbach/pte/NetworkProvider.java @@ -130,4 +130,13 @@ public interface NetworkProvider * @throws IOException */ QueryDeparturesResult queryDepartures(String queryUri) throws IOException; + + /** + * Get colors of line + * + * @param line + * line to get color of + * @return array containing background, foreground and border (optional) colors + */ + int[] lineColors(String line); } diff --git a/src/de/schildbach/pte/RmvProvider.java b/src/de/schildbach/pte/RmvProvider.java index 4f50ab2f..abb49701 100644 --- a/src/de/schildbach/pte/RmvProvider.java +++ b/src/de/schildbach/pte/RmvProvider.java @@ -160,7 +160,8 @@ public class RmvProvider implements NetworkProvider private static final Pattern P_CHECK_CONNECTIONS_ERROR = Pattern.compile( "(?:(mehrfach vorhanden oder identisch)|(keine Verbindung gefunden werden))", Pattern.CASE_INSENSITIVE); - public CheckConnectionsQueryResult checkConnectionsQuery(final String from, final String via, final String to, final Date date, final boolean dep) throws IOException + public CheckConnectionsQueryResult checkConnectionsQuery(final String from, final String via, final String to, final Date date, final boolean dep) + throws IOException { final String queryUri = connectionsQueryUri(from, via, to, date, dep); final CharSequence page = ParserUtils.scrape(queryUri); @@ -534,7 +535,7 @@ public class RmvProvider implements NetworkProvider throw new IllegalStateException("cannot normalize line " + line); } - public static final Map LINES = new HashMap(); + private static final Map LINES = new HashMap(); static { @@ -546,4 +547,9 @@ public class RmvProvider implements NetworkProvider LINES.put('B', new int[] { Color.parseColor("#993399"), Color.WHITE }); LINES.put('F', new int[] { Color.BLUE, Color.WHITE }); } + + public int[] lineColors(final String line) + { + return LINES.get(line.charAt(0)); + } } diff --git a/src/de/schildbach/pte/SbbProvider.java b/src/de/schildbach/pte/SbbProvider.java index 797000bf..bc86ff48 100644 --- a/src/de/schildbach/pte/SbbProvider.java +++ b/src/de/schildbach/pte/SbbProvider.java @@ -333,7 +333,7 @@ public class SbbProvider implements NetworkProvider throw new IllegalStateException("cannot normalize line " + line); } - public static final Map LINES = new HashMap(); + private static final Map LINES = new HashMap(); static { @@ -345,4 +345,9 @@ public class SbbProvider implements NetworkProvider LINES.put('B', new int[] { Color.parseColor("#993399"), Color.WHITE }); LINES.put('F', new int[] { Color.BLUE, Color.WHITE }); } + + public int[] lineColors(final String line) + { + return LINES.get(line.charAt(0)); + } } diff --git a/src/de/schildbach/pte/VbbProvider.java b/src/de/schildbach/pte/VbbProvider.java index 7a89e5d9..e749b09c 100644 --- a/src/de/schildbach/pte/VbbProvider.java +++ b/src/de/schildbach/pte/VbbProvider.java @@ -555,7 +555,7 @@ public final class VbbProvider implements NetworkProvider throw new IllegalStateException("cannot normalize line " + line); } - public static final Map LINES = new HashMap(); + private static final Map LINES = new HashMap(); static { @@ -670,4 +670,9 @@ public final class VbbProvider implements NetworkProvider LINES.put("RRB91", new int[] { Color.parseColor("#A7653F"), Color.WHITE }); LINES.put("RRB93", new int[] { Color.parseColor("#A7653F"), Color.WHITE }); } + + public int[] lineColors(final String line) + { + return LINES.get(line); + } }