Memoize train destination color

This commit is contained in:
Doug Keen 2015-10-18 16:26:41 -07:00
parent 4b8b7af55a
commit 7556c96e7d

View File

@ -57,6 +57,7 @@ public class Departure implements Parcelable, Comparable<Departure> {
private Station passengerDestination;
private Line line;
private String destinationColor;
private @ColorInt int destinationColorInt;
private String platform;
private String direction;
private boolean bikeAllowed;
@ -137,7 +138,10 @@ public class Departure implements Parcelable, Comparable<Departure> {
@ColorInt
public int getTrainDestinationColor() {
return Color.parseColor(destinationColor);
if (destinationColorInt == 0) {
destinationColorInt = Color.parseColor(destinationColor);
}
return destinationColorInt;
}
public void setTrainDestinationColor(String destinationColor) {