|
|
@@ -7,6 +7,7 @@ import android.graphics.Paint; |
|
|
|
import android.view.View; |
|
|
|
import android.view.ViewGroup; |
|
|
|
|
|
|
|
import java.util.ConcurrentModificationException; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
public class TimeRecordView extends View { |
|
|
@@ -58,16 +59,21 @@ public class TimeRecordView extends View { |
|
|
|
int y = 0; |
|
|
|
List<List<VehicleTimeRecord>> stepList = this.track.getVtrList(); |
|
|
|
for (int curStepIdx = stepList.size()-1; curStepIdx >= stepList.size()-1-50 && curStepIdx >= 0; curStepIdx--) { |
|
|
|
List<VehicleTimeRecord> step = stepList.get(curStepIdx); |
|
|
|
int i = 0; |
|
|
|
for (VehicleTimeRecord r : step) { |
|
|
|
int left = (int) (this.pixelPerVehicle * r.getPosition()); |
|
|
|
this.paint.setColor(getColor(r.getVelocity(), r.getMaxVelocity())); |
|
|
|
canvas.drawRect(left, y, left + this.pixelPerVehicle - 1, |
|
|
|
y+10, this.paint); |
|
|
|
i++; |
|
|
|
try { |
|
|
|
List<VehicleTimeRecord> step = stepList.get(curStepIdx); |
|
|
|
int i = 0; |
|
|
|
for (VehicleTimeRecord r : step) { |
|
|
|
int left = (int) (this.pixelPerVehicle * r.getPosition()); |
|
|
|
this.paint.setColor(getColor(r.getVelocity(), r.getMaxVelocity())); |
|
|
|
canvas.drawRect(left, y, left + this.pixelPerVehicle - 1, |
|
|
|
y + 10, this.paint); |
|
|
|
i++; |
|
|
|
} |
|
|
|
y += 10; |
|
|
|
} catch (ConcurrentModificationException ex) { |
|
|
|
System.out.println("Concurrent Exception occured, skipping record"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
y += 10; |
|
|
|
} |
|
|
|
} |
|
|
|
} |