update the controls only when they are visible
All checks were successful
continuous-integration/drone/push Build is passing

* update controls only when visible, this should reduce cpu load a little
* update javafx 14.0.1 -> 14.0.2.1
* update sqlite-jdbc 3.32.3.1 -> 3.32.3.2
This commit is contained in:
2020-08-13 23:48:50 +02:00
parent c323ac957c
commit f4c3b0a6f8
2 changed files with 21 additions and 14 deletions

View File

@ -201,9 +201,12 @@ public class PlayerController {
// show controls
if (!showControls) {
showControls = true;
updateControls(); // update controls before showing them
player.getScene().setCursor(Cursor.DEFAULT);
hBoxTop.setVisible(true);
bottomVBox.setVisible(true);
showControls = true;
}
// hide controls
@ -383,17 +386,20 @@ public class PlayerController {
* call this every second to update all timers
*/
private void updateControls() {
// update slider position, if the mouse does not press on the time
if (!mousePressed) {
timeSlider.setValue(currentTime / 1000);
// update control if they are visible
if (showControls) {
// update slider position, if the mouse does not press on the time
if (!mousePressed) {
timeSlider.setValue(currentTime / 1000);
}
// update endTime label
lblEndTime.setText(String.format("%d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(endTime) % 24,
TimeUnit.MILLISECONDS.toMinutes(endTime) % 60,
TimeUnit.MILLISECONDS.toSeconds(endTime) % 60));
}
// update endTime label
lblEndTime.setText(String.format("%d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(endTime) % 24,
TimeUnit.MILLISECONDS.toMinutes(endTime) % 60,
TimeUnit.MILLISECONDS.toSeconds(endTime) % 60));
// show the next episode button 30 seconds before the end of a episode
if (endTime < 31000 && episode != 0 && autoplay) {