mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added new improvements
This commit is contained in:
parent
60ff5ecc8e
commit
ab329b9d71
@ -8,9 +8,10 @@ public class MonthBattery extends Battery{
|
|||||||
public MonthBattery(int x, int i, int i1) {
|
public MonthBattery(int x, int i, int i1) {
|
||||||
super("Month", x, i, i1);
|
super("Month", x, i, i1);
|
||||||
}
|
}
|
||||||
public static double getMonthProgress(int weekDayWhenMondayIsOne, double done) {
|
public static double getMonthProgress(int weekDayWhenMondayIsOne, int workDaysDone, int workDaysTotal, double done) {
|
||||||
return weekDayWhenMondayIsOne == 0
|
return weekDayWhenMondayIsOne == 0
|
||||||
|| weekDayWhenMondayIsOne == 6 ?
|
|| weekDayWhenMondayIsOne == 6 ?
|
||||||
100 : ((weekDayWhenMondayIsOne - 1) * 0.20 + done * 0.20);
|
workDaysDone / workDaysTotal :
|
||||||
|
(workDaysDone + done) / workDaysTotal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import java.awt.event.KeyEvent;
|
|||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.Month;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -326,17 +327,7 @@ public class TimeCalcManager {
|
|||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
String nowString =
|
String nowString =
|
||||||
DateFormats.DATE_TIME_FORMATTER_HHmmssSSS.format(now);
|
DateFormats.DATE_TIME_FORMATTER_HHmmssSSS.format(now);
|
||||||
// if (alreadyShownTimes.contains(nowString)) {
|
|
||||||
// //nothing to do
|
|
||||||
// try {
|
|
||||||
// Thread.sleep(100);
|
|
||||||
// } catch (InterruptedException e) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// continue;
|
|
||||||
// } else {
|
|
||||||
// alreadyShownTimes.add(nowString);
|
|
||||||
// }
|
|
||||||
int hourNow = Integer.parseInt(nowString.split(":")[0]);
|
int hourNow = Integer.parseInt(nowString.split(":")[0]);
|
||||||
int minuteNow = Integer.parseInt(nowString.split(":")[1]);
|
int minuteNow = Integer.parseInt(nowString.split(":")[1]);
|
||||||
int secondNow = Integer.parseInt(nowString.split(":")[2]);
|
int secondNow = Integer.parseInt(nowString.split(":")[2]);
|
||||||
@ -367,10 +358,7 @@ public class TimeCalcManager {
|
|||||||
weekBattery.setLabel(
|
weekBattery.setLabel(
|
||||||
nowIsWeekend ? "5/5" : (weekDayWhenMondayIsOne + "/5"));
|
nowIsWeekend ? "5/5" : (weekDayWhenMondayIsOne + "/5"));
|
||||||
|
|
||||||
monthBattery.setDonePercent(weekDayWhenMondayIsOne == 0
|
monthBattery.setDonePercent(MonthBattery.getMonthProgress(weekDayWhenMondayIsOne, workDaysDone, workDaysTotal, done));
|
||||||
|| weekDayWhenMondayIsOne == 6 ?
|
|
||||||
workDaysDone / workDaysTotal :
|
|
||||||
(workDaysDone + done) / workDaysTotal);
|
|
||||||
monthBattery.setLabel(
|
monthBattery.setLabel(
|
||||||
(nowIsWeekend ? workDaysDone : workDaysDone + 1) + "/"
|
(nowIsWeekend ? workDaysDone : workDaysDone + 1) + "/"
|
||||||
+ (workDaysTotal));
|
+ (workDaysTotal));
|
||||||
@ -391,14 +379,6 @@ public class TimeCalcManager {
|
|||||||
double totalSecondsRemainsDouble =
|
double totalSecondsRemainsDouble =
|
||||||
((double) totalMillisecondsRemains) / 1000;
|
((double) totalMillisecondsRemains) / 1000;
|
||||||
|
|
||||||
|
|
||||||
//if(System.getProperty("progress")!=null) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// sb.append(msg);
|
|
||||||
// }
|
|
||||||
if (timeRemains.getHour() == 0 && timeRemains.getMinute() == 1 && !vtipyShown) {
|
if (timeRemains.getHour() == 0 && timeRemains.getMinute() == 1 && !vtipyShown) {
|
||||||
vtipyShown = true;
|
vtipyShown = true;
|
||||||
Jokes.showRandom();
|
Jokes.showRandom();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user