Browse Source

update the controls only when they are visible

* 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
dev
Jannik 9 months ago
parent
commit
f4c3b0a6f8
Signed by: Seil0 GPG Key ID: E8459F3723C52C24
  1. 9
      pom.xml
  2. 26
      src/main/java/org/mosad/homeflix/player/PlayerController.java

9
pom.xml

@ -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>

26
src/main/java/org/mosad/homeflix/player/PlayerController.java

@ -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 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 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));
}
// show the next episode button 30 seconds before the end of a episode
if (endTime < 31000 && episode != 0 && autoplay) {

Loading…
Cancel
Save