Fixed end-of-line station problem. BugzId: 11
This commit is contained in:
parent
a590e1e9e8
commit
45293dc694
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.dougkeen.bart"
|
package="com.dougkeen.bart"
|
||||||
android:versionCode="11"
|
android:versionCode="12"
|
||||||
android:versionName="1.1.2" >
|
android:versionName="1.1.3" >
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
@ -25,6 +25,8 @@ public abstract class GetRealTimeDeparturesTask
|
|||||||
|
|
||||||
private final static String ETD_URL = "http://api.bart.gov/api/etd.aspx?cmd=etd&key="
|
private final static String ETD_URL = "http://api.bart.gov/api/etd.aspx?cmd=etd&key="
|
||||||
+ Constants.API_KEY + "&orig=%1$s&dir=%2$s";
|
+ Constants.API_KEY + "&orig=%1$s&dir=%2$s";
|
||||||
|
private final static String ETD_URL_NO_DIRECTION = "http://api.bart.gov/api/etd.aspx?cmd=etd&key="
|
||||||
|
+ Constants.API_KEY + "&orig=%1$s";
|
||||||
private final static int MAX_ATTEMPTS = 5;
|
private final static int MAX_ATTEMPTS = 5;
|
||||||
|
|
||||||
private Exception mException;
|
private Exception mException;
|
||||||
@ -49,8 +51,16 @@ public abstract class GetRealTimeDeparturesTask
|
|||||||
int attemptNumber) {
|
int attemptNumber) {
|
||||||
String xml = null;
|
String xml = null;
|
||||||
try {
|
try {
|
||||||
HttpUriRequest request = new HttpGet(String.format(ETD_URL,
|
String url;
|
||||||
params.origin.abbreviation, mRoutes.get(0).getDirection()));
|
if (params.origin.endOfLine) {
|
||||||
|
url = String.format(ETD_URL_NO_DIRECTION,
|
||||||
|
params.origin.abbreviation);
|
||||||
|
} else {
|
||||||
|
url = String.format(ETD_URL, params.origin.abbreviation,
|
||||||
|
mRoutes.get(0).getDirection());
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpUriRequest request = new HttpGet(url);
|
||||||
|
|
||||||
EtdContentHandler handler = new EtdContentHandler(params.origin,
|
EtdContentHandler handler = new EtdContentHandler(params.origin,
|
||||||
params.destination, mRoutes);
|
params.destination, mRoutes);
|
||||||
|
@ -4,82 +4,86 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public enum Station {
|
public enum Station {
|
||||||
_12TH("12th", "12th St./Oakland City Center", false, "bayf"),
|
_12TH("12th", "12th St./Oakland City Center", false, false, "bayf"),
|
||||||
_16TH("16th", "16th St. Mission", false),
|
_16TH("16th", "16th St. Mission", false, false),
|
||||||
_19TH("19th", "19th St./Oakland", false, "bayf"),
|
_19TH("19th", "19th St./Oakland", false, false, "bayf"),
|
||||||
_24TH("24th", "24th St. Mission", false),
|
_24TH("24th", "24th St. Mission", false, false),
|
||||||
ASHB("ashb", "Ashby", false, "mcar"),
|
ASHB("ashb", "Ashby", false, false, "mcar"),
|
||||||
BALB("balb", "Balboa Park", false),
|
BALB("balb", "Balboa Park", false, false),
|
||||||
BAYF("bayf", "Bay Fair", true, "mcar"),
|
BAYF("bayf", "Bay Fair", true, false, "mcar"),
|
||||||
CAST("cast", "Castro Valley", false, "bayf"),
|
CAST("cast", "Castro Valley", false, false, "bayf"),
|
||||||
CIVC("civc", "Civic Center", false),
|
CIVC("civc", "Civic Center", false, false),
|
||||||
COLS("cols", "Coliseum/Oakland Airport", true, "mcar"),
|
COLS("cols", "Coliseum/Oakland Airport", true, false, "mcar"),
|
||||||
COLM("colm", "Colma", false, "balb", "balb"),
|
COLM("colm", "Colma", false, false, "balb", "balb"),
|
||||||
CONC("conc", "Concord", false, "mcar"),
|
CONC("conc", "Concord", false, false, "mcar"),
|
||||||
DALY("daly", "Daly City", false),
|
DALY("daly", "Daly City", false, false),
|
||||||
DBRK("dbrk", "Downtown Berkeley", false, "mcar"),
|
DBRK("dbrk", "Downtown Berkeley", false, false, "mcar"),
|
||||||
DUBL("dubl", "Dublin/Pleasanton", false, "bayf"),
|
DUBL("dubl", "Dublin/Pleasanton", false, true, "bayf"),
|
||||||
DELN("deln", "El Cerrito del Norte", false, "mcar"),
|
DELN("deln", "El Cerrito del Norte", false, false, "mcar"),
|
||||||
PLZA("plza", "El Cerrito Plaza", false, "mcar"),
|
PLZA("plza", "El Cerrito Plaza", false, false, "mcar"),
|
||||||
EMBR("embr", "Embarcadero", false),
|
EMBR("embr", "Embarcadero", false, false),
|
||||||
FRMT("frmt", "Fremont", true, "bayf"),
|
FRMT("frmt", "Fremont", true, false, "bayf"),
|
||||||
FTVL("ftvl", "Fruitvale", true, "mcar"),
|
FTVL("ftvl", "Fruitvale", true, false, "mcar"),
|
||||||
GLEN("glen", "Glen Park", false),
|
GLEN("glen", "Glen Park", false, false),
|
||||||
HAYW("hayw", "Hayward", true, "bayf"),
|
HAYW("hayw", "Hayward", true, false, "bayf"),
|
||||||
LAFY("lafy", "Lafayette", false, "mcar"),
|
LAFY("lafy", "Lafayette", false, false, "mcar"),
|
||||||
LAKE("lake", "Lake Merritt", true, "mcar"),
|
LAKE("lake", "Lake Merritt", true, false, "mcar"),
|
||||||
MCAR("mcar", "MacArthur", false, "bayf"),
|
MCAR("mcar", "MacArthur", false, false, "bayf"),
|
||||||
MLBR("mlbr", "Millbrae", false, "balb", "balb"),
|
MLBR("mlbr", "Millbrae", false, true, "balb", "balb"),
|
||||||
MONT("mont", "Montgomery St.", false),
|
MONT("mont", "Montgomery St.", false, false),
|
||||||
NBRK("nbrk", "North Berkeley", false, "mcar"),
|
NBRK("nbrk", "North Berkeley", false, false, "mcar"),
|
||||||
NCON("ncon", "North Concord/Martinez", false, "mcar"),
|
NCON("ncon", "North Concord/Martinez", false, false, "mcar"),
|
||||||
ORIN("orin", "Orinda", false, "mcar"),
|
ORIN("orin", "Orinda", false, false, "mcar"),
|
||||||
PITT("pitt", "Pittsburg/Bay Point", false, "mcar"),
|
PITT("pitt", "Pittsburg/Bay Point", false, true, "mcar"),
|
||||||
PHIL("phil", "Pleasant Hill", false, "mcar"),
|
PHIL("phil", "Pleasant Hill", false, false, "mcar"),
|
||||||
POWL("powl", "Powell St.", false),
|
POWL("powl", "Powell St.", false, false),
|
||||||
RICH("rich", "Richmond", false, "mcar"),
|
RICH("rich", "Richmond", false, true, "mcar"),
|
||||||
ROCK("rock", "Rockridge", false, "mcar"),
|
ROCK("rock", "Rockridge", false, false, "mcar"),
|
||||||
SBRN("sbrn", "San Bruno", false, "balb", "balb"),
|
SBRN("sbrn", "San Bruno", false, false, "balb", "balb"),
|
||||||
SANL("sanl", "San Leandro", true, "mcar"),
|
SANL("sanl", "San Leandro", true, false, "mcar"),
|
||||||
SFIA("sfia", "SFO Airport", false, "sbrn", "balb"),
|
SFIA("sfia", "SFO Airport", false, false, "sbrn", "balb"),
|
||||||
SHAY("shay", "South Hayward", true, "bayf"),
|
SHAY("shay", "South Hayward", true, false, "bayf"),
|
||||||
SSAN("ssan", "South San Francisco", false, "balb", "balb"),
|
SSAN("ssan", "South San Francisco", false, false, "balb", "balb"),
|
||||||
UCTY("ucty", "Union City", true, "bayf"),
|
UCTY("ucty", "Union City", true, false, "bayf"),
|
||||||
WCRK("wcrk", "Walnut Creek", false, "mcar"),
|
WCRK("wcrk", "Walnut Creek", false, false, "mcar"),
|
||||||
WDUB("wdub", "West Dublin/Pleasanton", false, "bayf"),
|
WDUB("wdub", "West Dublin/Pleasanton", false, false, "bayf"),
|
||||||
WOAK("woak", "West Oakland", false),
|
WOAK("woak", "West Oakland", false, false),
|
||||||
SPCL("spcl", "Special", false);
|
SPCL("spcl", "Special", false, false);
|
||||||
|
|
||||||
public final String abbreviation;
|
public final String abbreviation;
|
||||||
public final String name;
|
public final String name;
|
||||||
public final boolean invertDirection;
|
public final boolean invertDirection;
|
||||||
protected final String inboundTransferStation;
|
protected final String inboundTransferStation;
|
||||||
protected final String outboundTransferStation;
|
protected final String outboundTransferStation;
|
||||||
|
public final boolean endOfLine;
|
||||||
|
|
||||||
private Station(String abbreviation, String name, boolean invertDirection) {
|
private Station(String abbreviation, String name, boolean invertDirection, boolean endOfLine) {
|
||||||
this.abbreviation = abbreviation;
|
this.abbreviation = abbreviation;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.invertDirection = invertDirection;
|
this.invertDirection = invertDirection;
|
||||||
this.inboundTransferStation = null;
|
this.inboundTransferStation = null;
|
||||||
this.outboundTransferStation = null;
|
this.outboundTransferStation = null;
|
||||||
|
this.endOfLine = endOfLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Station(String abbreviation, String name, boolean invertDirection,
|
private Station(String abbreviation, String name, boolean invertDirection, boolean endOfLine,
|
||||||
String transferStation) {
|
String transferStation) {
|
||||||
this.abbreviation = abbreviation;
|
this.abbreviation = abbreviation;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.invertDirection = invertDirection;
|
this.invertDirection = invertDirection;
|
||||||
this.inboundTransferStation = transferStation;
|
this.inboundTransferStation = transferStation;
|
||||||
this.outboundTransferStation = null;
|
this.outboundTransferStation = null;
|
||||||
|
this.endOfLine = endOfLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Station(String abbreviation, String name, boolean invertDirection,
|
private Station(String abbreviation, String name, boolean invertDirection, boolean endOfLine,
|
||||||
String inboundTransferStation, String outboundTransferStation) {
|
String inboundTransferStation, String outboundTransferStation) {
|
||||||
this.abbreviation = abbreviation;
|
this.abbreviation = abbreviation;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.invertDirection = invertDirection;
|
this.invertDirection = invertDirection;
|
||||||
this.inboundTransferStation = inboundTransferStation;
|
this.inboundTransferStation = inboundTransferStation;
|
||||||
this.outboundTransferStation = outboundTransferStation;
|
this.outboundTransferStation = outboundTransferStation;
|
||||||
|
this.endOfLine = endOfLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Station getByAbbreviation(String abbr) {
|
public static Station getByAbbreviation(String abbr) {
|
||||||
|
@ -7,7 +7,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.opengl.Visibility;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
Loading…
Reference in New Issue
Block a user