Added new improvements

This commit is contained in:
Robert Vokac 2024-02-03 00:37:45 +00:00
parent 05accee591
commit 43324c8f03
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
2 changed files with 8 additions and 5 deletions

View File

@ -38,6 +38,8 @@ import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import static org.nanoboot.utils.timecalc.utils.FileConstants.FOCUS_TXT;
/** /**
* @author pc00289 * @author pc00289
* @since 08.02.2024 * @since 08.02.2024
@ -73,8 +75,9 @@ public class TimeCalcWindow {
this.overTime = (overTimeIn == null || overTimeIn.isEmpty()) ? this.overTime = (overTimeIn == null || overTimeIn.isEmpty()) ?
Constants.DEFAULT_OVERTIME : overTimeIn; Constants.DEFAULT_OVERTIME : overTimeIn;
this.startHour = Integer.valueOf(startTime.split(":")[0]); String[] startTimeAsArray = startTime.split(":");
this.startMinute = Integer.valueOf(startTime.split(":")[1]); this.startHour = Integer.valueOf(startTimeAsArray[0]);
this.startMinute = Integer.valueOf(startTimeAsArray[1]);
boolean overtimeIsNegative = overTime.startsWith("-"); boolean overtimeIsNegative = overTime.startsWith("-");
if(overtimeIsNegative) {overTime = overTime.replace("-","");} if(overtimeIsNegative) {overTime = overTime.replace("-","");}
@ -339,7 +342,6 @@ public class TimeCalcWindow {
StringBuilder sb = null; StringBuilder sb = null;
File focusTxt = new File("focus.txt");
while (true) { while (true) {
if (stopBeforeEnd) { if (stopBeforeEnd) {
window.setVisible(false); window.setVisible(false);
@ -348,9 +350,9 @@ public class TimeCalcWindow {
} }
if(Math.random() > 0.9) { if(Math.random() > 0.9) {
if(focusTxt.exists()) { if(FOCUS_TXT.exists()) {
window.requestFocus(); window.requestFocus();
focusTxt.delete(); FOCUS_TXT.delete();
} }
} }
if(Utils.highlighted.get()) { if(Utils.highlighted.get()) {

View File

@ -13,4 +13,5 @@ public class FileConstants {
public static final File STARTTIME_TXT = new File("starttime.txt"); public static final File STARTTIME_TXT = new File("starttime.txt");
public static final File OVERTIME_TXT = new File("overtime.txt"); public static final File OVERTIME_TXT = new File("overtime.txt");
public static final File TEST_TXT = new File("test.txt"); public static final File TEST_TXT = new File("test.txt");
public static final File FOCUS_TXT = new File("focus.txt");
} }