Memoize train destination color
This commit is contained in:
parent
4b8b7af55a
commit
7556c96e7d
@ -57,6 +57,7 @@ public class Departure implements Parcelable, Comparable<Departure> {
|
|||||||
private Station passengerDestination;
|
private Station passengerDestination;
|
||||||
private Line line;
|
private Line line;
|
||||||
private String destinationColor;
|
private String destinationColor;
|
||||||
|
private @ColorInt int destinationColorInt;
|
||||||
private String platform;
|
private String platform;
|
||||||
private String direction;
|
private String direction;
|
||||||
private boolean bikeAllowed;
|
private boolean bikeAllowed;
|
||||||
@ -137,7 +138,10 @@ public class Departure implements Parcelable, Comparable<Departure> {
|
|||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
public int getTrainDestinationColor() {
|
public int getTrainDestinationColor() {
|
||||||
return Color.parseColor(destinationColor);
|
if (destinationColorInt == 0) {
|
||||||
|
destinationColorInt = Color.parseColor(destinationColor);
|
||||||
|
}
|
||||||
|
return destinationColorInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTrainDestinationColor(String destinationColor) {
|
public void setTrainDestinationColor(String destinationColor) {
|
||||||
|
Loading…
Reference in New Issue
Block a user