mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 08:40:29 +00:00
fixed not displaying messages in departure list entries any more
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@78 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
ed54c30d46
commit
edd72a64c4
6 changed files with 32 additions and 8 deletions
|
@ -30,6 +30,8 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import de.schildbach.pte.QueryDeparturesResult.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
*/
|
*/
|
||||||
|
@ -491,7 +493,7 @@ public final class BahnProvider implements NetworkProvider
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QueryDeparturesResult.NO_INFO;
|
return new QueryDeparturesResult(uri, Status.NO_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import de.schildbach.pte.QueryDeparturesResult.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
*/
|
*/
|
||||||
|
@ -545,7 +547,7 @@ public class MvvProvider implements NetworkProvider
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QueryDeparturesResult.NO_INFO;
|
return new QueryDeparturesResult(uri, Status.NO_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,13 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public final class QueryDeparturesResult
|
public final class QueryDeparturesResult
|
||||||
{
|
{
|
||||||
public static final QueryDeparturesResult NO_INFO = new QueryDeparturesResult(null, 0, null, null, null);
|
public enum Status
|
||||||
public static final QueryDeparturesResult SERVICE_DOWN = new QueryDeparturesResult(null, 0, null, null, null);
|
{
|
||||||
|
OK, NO_INFO, SERVICE_DOWN
|
||||||
|
}
|
||||||
|
|
||||||
public final String uri;
|
public final String uri;
|
||||||
|
public final Status status;
|
||||||
public final int locationId;
|
public final int locationId;
|
||||||
public final String location;
|
public final String location;
|
||||||
public final Date currentTime;
|
public final Date currentTime;
|
||||||
|
@ -38,9 +41,20 @@ public final class QueryDeparturesResult
|
||||||
final List<Departure> departures)
|
final List<Departure> departures)
|
||||||
{
|
{
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
|
this.status = Status.OK;
|
||||||
this.locationId = locationId;
|
this.locationId = locationId;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.currentTime = currentTime;
|
this.currentTime = currentTime;
|
||||||
this.departures = departures;
|
this.departures = departures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QueryDeparturesResult(final String uri, final Status status)
|
||||||
|
{
|
||||||
|
this.uri = uri;
|
||||||
|
this.status = status;
|
||||||
|
this.locationId = 0;
|
||||||
|
this.location = null;
|
||||||
|
this.currentTime = null;
|
||||||
|
this.departures = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import de.schildbach.pte.QueryDeparturesResult.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
*/
|
*/
|
||||||
|
@ -457,7 +459,7 @@ public class RmvProvider implements NetworkProvider
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QueryDeparturesResult.NO_INFO;
|
return new QueryDeparturesResult(uri, Status.NO_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import de.schildbach.pte.QueryDeparturesResult.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
*/
|
*/
|
||||||
|
@ -408,7 +410,7 @@ public class SbbProvider implements NetworkProvider
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QueryDeparturesResult.NO_INFO;
|
return new QueryDeparturesResult(uri, Status.NO_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import de.schildbach.pte.QueryDeparturesResult.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
*/
|
*/
|
||||||
|
@ -473,7 +475,7 @@ public final class VbbProvider implements NetworkProvider
|
||||||
final int stationId = Integer.parseInt(mStationId.group(1));
|
final int stationId = Integer.parseInt(mStationId.group(1));
|
||||||
|
|
||||||
if (P_DEPARTURES_SERVICE_DOWN.matcher(page).find())
|
if (P_DEPARTURES_SERVICE_DOWN.matcher(page).find())
|
||||||
return QueryDeparturesResult.SERVICE_DOWN;
|
return new QueryDeparturesResult(uri, Status.SERVICE_DOWN);
|
||||||
|
|
||||||
// parse page
|
// parse page
|
||||||
final Matcher mHead = P_DEPARTURES_HEAD.matcher(page);
|
final Matcher mHead = P_DEPARTURES_HEAD.matcher(page);
|
||||||
|
@ -525,7 +527,7 @@ public final class VbbProvider implements NetworkProvider
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QueryDeparturesResult.NO_INFO;
|
return new QueryDeparturesResult(uri, Status.NO_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue