update the controls only when they are visible
continuous-integration/drone/push Build is passing Details

* 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:
Jannik 2020-08-13 23:48:50 +02:00
parent c323ac957c
commit f4c3b0a6f8
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
2 changed files with 21 additions and 14 deletions

View File

@ -13,6 +13,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javafx.version>14.0.2.1</javafx.version>
</properties>
<dependencies>
@ -27,19 +28,19 @@
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14.0.1</version>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>14.0.1</version>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>14.0.1</version>
<version>${javafx.version}</version>
</dependency>
<dependency>
@ -69,7 +70,7 @@
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.32.3.1</version>
<version>3.32.3.2</version>
</dependency>
<dependency>

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,18 +386,21 @@ 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) {
int countdown = (int) ((endTime / 1000) - 20); // a 10 seconds countdown