mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Updated the timer to show two decimals for the seconds.
#story[572]
This commit is contained in:
@@ -34,8 +34,8 @@ public class App extends Application
|
|||||||
sr = new StreamReceiver("localhost", 8085, "RaceStream");
|
sr = new StreamReceiver("localhost", 8085, "RaceStream");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941,"RaceStream");
|
sr = new StreamReceiver("csse-s302staff.canterbury.ac.nz", 4941,"RaceStream");
|
||||||
sr = new StreamReceiver("livedata.americascup.com", 4941, "RaceStream");
|
// sr = new StreamReceiver("livedata.americascup.com", 4941, "RaceStream");
|
||||||
// sr = new StreamReceiver("localhost", 8085, "RaceStream");
|
// sr = new StreamReceiver("localhost", 8085, "RaceStream");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class Controller implements Initializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Running a timer to update the livestream status on welcome screen. Update interval is 500 miliseconds.
|
* Running a timer to update the livestream status on welcome screen. Update interval is 1 second.
|
||||||
*/
|
*/
|
||||||
public void startStream() {
|
public void startStream() {
|
||||||
if (StreamParser.isStreamStatus()) {
|
if (StreamParser.isStreamStatus()) {
|
||||||
@@ -91,22 +91,28 @@ public class Controller implements Initializable {
|
|||||||
updateTeamList();
|
updateTeamList();
|
||||||
timeTillLive.setTextFill(Color.RED);
|
timeTillLive.setTextFill(Color.RED);
|
||||||
switchToRaceViewButton.setDisable(false);
|
switchToRaceViewButton.setDisable(false);
|
||||||
Long timerMinute = StreamParser.getTimeSinceStart() / 60;
|
String timerMinute = Long.toString(StreamParser.getTimeSinceStart() / 60);
|
||||||
Long timerSecond = StreamParser.getTimeSinceStart() % 60;
|
String timerSecond = Long.toString(StreamParser.getTimeSinceStart() % 60);
|
||||||
|
if (timerSecond.length() == 1) {
|
||||||
|
timerSecond = "0" + timerSecond;
|
||||||
|
}
|
||||||
String timerString = "-" + timerMinute + ":" + timerSecond + " minutes";
|
String timerString = "-" + timerMinute + ":" + timerSecond + " minutes";
|
||||||
timeTillLive.setText(timerString);
|
timeTillLive.setText(timerString);
|
||||||
} else {
|
} else {
|
||||||
updateTeamList();
|
updateTeamList();
|
||||||
timeTillLive.setTextFill(Color.BLACK);
|
timeTillLive.setTextFill(Color.BLACK);
|
||||||
switchToRaceViewButton.setDisable(false);
|
switchToRaceViewButton.setDisable(false);
|
||||||
Long timerMinute = -1 * StreamParser.getTimeSinceStart() / 60;
|
String timerMinute = Long.toString(-1 * StreamParser.getTimeSinceStart() / 60);
|
||||||
Long timerSecond = -1 * StreamParser.getTimeSinceStart() % 60;
|
String timerSecond = Long.toString(-1 * StreamParser.getTimeSinceStart() % 60);
|
||||||
|
if (timerSecond.length() == 1) {
|
||||||
|
timerSecond = "0" + timerSecond;
|
||||||
|
}
|
||||||
String timerString = timerMinute + ":" + timerSecond + " minutes";
|
String timerString = timerMinute + ":" + timerSecond + " minutes";
|
||||||
timeTillLive.setText(timerString);
|
timeTillLive.setText(timerString);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 0, 500);
|
}, 0, 1000);
|
||||||
} else {
|
} else {
|
||||||
timeTillLive.setText("Stream not available.");
|
timeTillLive.setText("Stream not available.");
|
||||||
timeTillLive.setTextFill(Color.RED);
|
timeTillLive.setTextFill(Color.RED);
|
||||||
|
|||||||
@@ -294,12 +294,18 @@ public class RaceViewController extends Thread{
|
|||||||
private String currentTimer() {
|
private String currentTimer() {
|
||||||
String timerString = "0:00 minutes";
|
String timerString = "0:00 minutes";
|
||||||
if (StreamParser.getTimeSinceStart() > 0) {
|
if (StreamParser.getTimeSinceStart() > 0) {
|
||||||
Long timerMinute = StreamParser.getTimeSinceStart() / 60;
|
String timerMinute = Long.toString(StreamParser.getTimeSinceStart() / 60);
|
||||||
Long timerSecond = StreamParser.getTimeSinceStart() % 60;
|
String timerSecond = Long.toString(StreamParser.getTimeSinceStart() % 60);
|
||||||
|
if (timerSecond.length() == 1) {
|
||||||
|
timerSecond = "0" + timerSecond;
|
||||||
|
}
|
||||||
timerString = "-" + timerMinute + ":" + timerSecond + " minutes";
|
timerString = "-" + timerMinute + ":" + timerSecond + " minutes";
|
||||||
} else {
|
} else {
|
||||||
Long timerMinute = -1 * StreamParser.getTimeSinceStart() / 60;
|
String timerMinute = Long.toString(-1 * StreamParser.getTimeSinceStart() / 60);
|
||||||
Long timerSecond = -1 * StreamParser.getTimeSinceStart() % 60;
|
String timerSecond = Long.toString(-1 * StreamParser.getTimeSinceStart() % 60);
|
||||||
|
if (timerSecond.length() == 1) {
|
||||||
|
timerSecond = "0" + timerSecond;
|
||||||
|
}
|
||||||
timerString = timerMinute + ":" + timerSecond + " minutes";
|
timerString = timerMinute + ":" + timerSecond + " minutes";
|
||||||
}
|
}
|
||||||
return timerString;
|
return timerString;
|
||||||
|
|||||||
Reference in New Issue
Block a user