Add Ontario (Canada) region. #157

Merged
merged 1 commit into from Feb 18, 2016
Jump to file or symbol
Failed to load files and symbols.
+25 −0
Diff settings

Always

Just for now

Binary file not shown.
View
@@ -226,6 +226,7 @@
<string name="np_region_nz">New Zealand</string>
<string name="np_region_spain">Spain</string>
<string name="np_region_br">Brazil</string>
+ <string name="np_region_canada">Canada</string>
<string name="np_desc_ns">Netherlands, Amsterdam</string>
<string name="np_desc_dsb">Denmark, Copenhagen</string>
@@ -97,6 +97,7 @@
private static Reference<BrFloripaProvider> brFloripaProviderRef;
private static Reference<ItalyProvider> italyProviderRef;
private static Reference<FrenchSouthWestProvider> frenchSouthWestProviderRef;
+ private static Reference<OntarioProvider> ontarioProviderRef;
private static final String NAVITIA_API = "https://api.navitia.io/v1/";
private static final String NAVITIA = "87a37b95-913a-4cb4-ba52-eb0bc0b304ca";
@@ -1014,6 +1015,19 @@ else if (networkId.equals(NetworkId.FRENCHSOUTHWEST))
frenchSouthWestProviderRef = new SoftReference<>(provider);
return provider;
}
+ else if (networkId.equals(NetworkId.ONTARIO))
+ {
+ if (ontarioProviderRef != null)
+ {
+ final OntarioProvider provider = ontarioProviderRef.get();
+ if (provider != null)
+ return provider;
+ }
+
+ final OntarioProvider provider = new OntarioProvider(NAVITIA);
+ ontarioProviderRef = new SoftReference<>(provider);
+ return provider;
+ }
else
{
throw new IllegalArgumentException(networkId.name());
@@ -493,6 +493,16 @@ public TransportNetworks(Context context) {
.setStatus(TransportNetwork.Status.APLHA)
);
+ // Canada
+ region = getString(R.string.np_region_canada);
+
+ list.add(new TransportNetwork(context, NetworkId.ONTARIO)
+ .setName("Ontario")
+ .setDescription("Ottawa, Toronto")
+ .setRegion(region)
+ .setStatus(TransportNetwork.Status.APLHA)
+ );
+
return list;
}