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
3e0440624b
commit
bf40a63615
@ -27,6 +27,7 @@ public class Battery extends Widget {
|
|||||||
private int totalHeight = 0;
|
private int totalHeight = 0;
|
||||||
|
|
||||||
private int width_;
|
private int width_;
|
||||||
|
private String label = null;
|
||||||
|
|
||||||
public Battery() {
|
public Battery() {
|
||||||
setPreferredSize(new Dimension(40, 100));
|
setPreferredSize(new Dimension(40, 100));
|
||||||
@ -105,6 +106,14 @@ public class Battery extends Widget {
|
|||||||
formatter3.format(donePercent * 100) + "%",
|
formatter3.format(donePercent * 100) + "%",
|
||||||
((int) (width_ * 0.4)), donePercent > 0.5 ? totalHeight / 4 * 3 : totalHeight / 4 * 1);
|
((int) (width_ * 0.4)), donePercent > 0.5 ? totalHeight / 4 * 3 : totalHeight / 4 * 1);
|
||||||
|
|
||||||
|
if(label!= null && !label.isEmpty()) {
|
||||||
|
g2d.drawString(
|
||||||
|
label,
|
||||||
|
((int) (width_ * 0.4)),
|
||||||
|
(donePercent > 0.5 ? totalHeight / 4 * 3 :
|
||||||
|
totalHeight / 4 * 1)+ 20);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double[] randomDoubles = new double[]{1d,1d,1d,1d,1d,1d,1};
|
private double[] randomDoubles = new double[]{1d,1d,1d,1d,1d,1d,1};
|
||||||
@ -115,4 +124,10 @@ public class Battery extends Widget {
|
|||||||
public int getTimerDelay() {
|
public int getTimerDelay() {
|
||||||
return 250;
|
return 250;
|
||||||
}
|
}
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
public String getLabel() {
|
||||||
|
return this.label;
|
||||||
|
}
|
||||||
}
|
}
|
@ -400,9 +400,11 @@ public class TimeCalcWindow {
|
|||||||
batteryForWeek.setDonePercent((weekDayWhenMondayIsOne == 0
|
batteryForWeek.setDonePercent((weekDayWhenMondayIsOne == 0
|
||||||
|| weekDayWhenMondayIsOne == 6) ?
|
|| weekDayWhenMondayIsOne == 6) ?
|
||||||
100 : ((weekDayWhenMondayIsOne - 1) * 0.20 + done * 0.20));
|
100 : ((weekDayWhenMondayIsOne - 1) * 0.20 + done * 0.20));
|
||||||
|
batteryForWeek.setLabel("#" + (nowIsWeekend ? 0 : (6 - weekDayWhenMondayIsOne)));
|
||||||
|
|
||||||
batteryForMonth.setDonePercent(weekDayWhenMondayIsOne == 0
|
batteryForMonth.setDonePercent(weekDayWhenMondayIsOne == 0
|
||||||
|| weekDayWhenMondayIsOne == 6 ? workDaysDone/workDaysTotal : (workDaysDone + done) / workDaysTotal);
|
|| weekDayWhenMondayIsOne == 6 ? workDaysDone/workDaysTotal : (workDaysDone + done) / workDaysTotal);
|
||||||
|
batteryForMonth.setLabel("#" + (nowIsWeekend ? workDaysTodo : (workDaysTodo + 1)));
|
||||||
|
|
||||||
|
|
||||||
double minutesRemainsD = (double) minuteRemains;
|
double minutesRemainsD = (double) minuteRemains;
|
||||||
@ -417,6 +419,9 @@ public class TimeCalcWindow {
|
|||||||
minutesRemainsD = minutesRemainsD - 1d/1000d;
|
minutesRemainsD = minutesRemainsD - 1d/1000d;
|
||||||
}
|
}
|
||||||
batteryForHour.setDonePercent(1 - ((minutesRemainsD%60d)/60d));
|
batteryForHour.setDonePercent(1 - ((minutesRemainsD%60d)/60d));
|
||||||
|
if(done < 1 && !nowIsWeekend) {
|
||||||
|
batteryForHour.setLabel("#" + ((int)(minutesRemainsD / 60d)));
|
||||||
|
}
|
||||||
|
|
||||||
int totalSecondsRemains =
|
int totalSecondsRemains =
|
||||||
(hourRemains * 60 * 60 + minuteRemains * 60
|
(hourRemains * 60 * 60 + minuteRemains * 60
|
||||||
|
Loading…
x
Reference in New Issue
Block a user