1 |
package dk.thoerup.traininfo;
|
2 |
|
3 |
import java.io.Serializable;
|
4 |
|
5 |
import android.content.Context;
|
6 |
|
7 |
|
8 |
public class DepartureEntry implements Serializable
|
9 |
{
|
10 |
private static final long serialVersionUID = 1L;
|
11 |
|
12 |
public static final int UPDATE_LESSTHAN3 = 1;
|
13 |
public static final int UPDATE_3TO10 = 2;
|
14 |
public static final int UPDATE_MORETHAN10 = 3;
|
15 |
public static final int UPDATE_UNKNOWN = 4;
|
16 |
|
17 |
private String time = "";
|
18 |
private String lastUpdate = "";
|
19 |
private String trainNumber = "";
|
20 |
private String destination = "";
|
21 |
private String origin = "";
|
22 |
private String location = "";
|
23 |
private String status = "";
|
24 |
private String note = "";
|
25 |
private String type = "";
|
26 |
|
27 |
|
28 |
public String getTime() {
|
29 |
return time;
|
30 |
}
|
31 |
public void setTime(String time) {
|
32 |
this.time = time;
|
33 |
}
|
34 |
public String getLastUpdate() {
|
35 |
return lastUpdate;
|
36 |
}
|
37 |
public void setLastUpdate(String lastUpdate) {
|
38 |
this.lastUpdate = lastUpdate;
|
39 |
}
|
40 |
public String getTrainNumber() {
|
41 |
return trainNumber;
|
42 |
}
|
43 |
public void setTrainNumber(String trainNumber) {
|
44 |
this.trainNumber = trainNumber;
|
45 |
}
|
46 |
public String getDestination() {
|
47 |
return destination;
|
48 |
}
|
49 |
public void setDestination(String destination) {
|
50 |
this.destination = destination;
|
51 |
}
|
52 |
public String getOrigin() {
|
53 |
return origin;
|
54 |
}
|
55 |
public void setOrigin(String origin) {
|
56 |
this.origin = origin;
|
57 |
}
|
58 |
public String getLocation() {
|
59 |
return location;
|
60 |
}
|
61 |
public void setLocation(String location) {
|
62 |
this.location = location;
|
63 |
}
|
64 |
public String getStatus() {
|
65 |
return status;
|
66 |
}
|
67 |
public void setStatus(String status) {
|
68 |
this.status = status;
|
69 |
}
|
70 |
public String getNote() {
|
71 |
return note;
|
72 |
}
|
73 |
public void setNote(String note) {
|
74 |
this.note = note;
|
75 |
}
|
76 |
public String getType() {
|
77 |
return type;
|
78 |
}
|
79 |
public void setType(String type) {
|
80 |
this.type = type;
|
81 |
}
|
82 |
|
83 |
|
84 |
|
85 |
public String getLastUpdateString(Context cntx) {
|
86 |
String minutes = cntx.getString(R.string.departurebean_minutes);
|
87 |
String unknown = cntx.getString(R.string.departurebean_unknown);
|
88 |
switch (lastUpdate.charAt(0)) {
|
89 |
case '1':
|
90 |
return "<3 " + minutes;
|
91 |
case '2':
|
92 |
return "3-10 " + minutes;
|
93 |
case '3':
|
94 |
return ">3 " + minutes;
|
95 |
case '4':
|
96 |
return unknown;
|
97 |
default:
|
98 |
return "";
|
99 |
}
|
100 |
}
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
}
|