update the controls only when they are visible
continuous-integration/drone/push Build is passing
Details
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:
parent
c323ac957c
commit
f4c3b0a6f8
9
pom.xml
9
pom.xml
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<javafx.version>14.0.2.1</javafx.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -27,19 +28,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-controls</artifactId>
|
<artifactId>javafx-controls</artifactId>
|
||||||
<version>14.0.1</version>
|
<version>${javafx.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-fxml</artifactId>
|
<artifactId>javafx-fxml</artifactId>
|
||||||
<version>14.0.1</version>
|
<version>${javafx.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-media</artifactId>
|
<artifactId>javafx-media</artifactId>
|
||||||
<version>14.0.1</version>
|
<version>${javafx.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -69,7 +70,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.32.3.1</version>
|
<version>3.32.3.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -201,9 +201,12 @@ public class PlayerController {
|
||||||
|
|
||||||
// show controls
|
// show controls
|
||||||
if (!showControls) {
|
if (!showControls) {
|
||||||
|
showControls = true;
|
||||||
|
updateControls(); // update controls before showing them
|
||||||
player.getScene().setCursor(Cursor.DEFAULT);
|
player.getScene().setCursor(Cursor.DEFAULT);
|
||||||
hBoxTop.setVisible(true);
|
hBoxTop.setVisible(true);
|
||||||
bottomVBox.setVisible(true);
|
bottomVBox.setVisible(true);
|
||||||
|
showControls = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide controls
|
// hide controls
|
||||||
|
@ -383,17 +386,20 @@ public class PlayerController {
|
||||||
* call this every second to update all timers
|
* call this every second to update all timers
|
||||||
*/
|
*/
|
||||||
private void updateControls() {
|
private void updateControls() {
|
||||||
// update slider position, if the mouse does not press on the time
|
|
||||||
if (!mousePressed) {
|
// update control if they are visible
|
||||||
timeSlider.setValue(currentTime / 1000);
|
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
|
// show the next episode button 30 seconds before the end of a episode
|
||||||
if (endTime < 31000 && episode != 0 && autoplay) {
|
if (endTime < 31000 && episode != 0 && autoplay) {
|
||||||
|
|
Loading…
Reference in New Issue