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
c6f9d75c49
commit
a66c7b9a33
@ -2,6 +2,7 @@ package org.nanoboot.utils.timecalc.gui.progress;
|
|||||||
|
|
||||||
import org.nanoboot.utils.timecalc.gui.common.Widget;
|
import org.nanoboot.utils.timecalc.gui.common.Widget;
|
||||||
import org.nanoboot.utils.timecalc.main.TimeCalcConf;
|
import org.nanoboot.utils.timecalc.main.TimeCalcConf;
|
||||||
|
import org.nanoboot.utils.timecalc.utils.NumberFormats;
|
||||||
import org.nanoboot.utils.timecalc.utils.Utils;
|
import org.nanoboot.utils.timecalc.utils.Utils;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
@ -9,8 +10,6 @@ import java.awt.Dimension;
|
|||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
|
|
||||||
public class Battery extends Widget {
|
public class Battery extends Widget {
|
||||||
public static final Color LOW = new Color(253, 130, 130);
|
public static final Color LOW = new Color(253, 130, 130);
|
||||||
@ -22,7 +21,7 @@ public class Battery extends Widget {
|
|||||||
public static final Color HIGH_HIGHLIGHTED = new Color(158, 227, 158);
|
public static final Color HIGH_HIGHLIGHTED = new Color(158, 227, 158);
|
||||||
public static final Color HIGHEST_HIGHLIGHTED = Color.green;
|
public static final Color HIGHEST_HIGHLIGHTED = Color.green;
|
||||||
public static boolean wavesOff = false;
|
public static boolean wavesOff = false;
|
||||||
NumberFormat formatter3 = new DecimalFormat("#0.000");
|
|
||||||
private int totalHeight = 0;
|
private int totalHeight = 0;
|
||||||
|
|
||||||
private int width_;
|
private int width_;
|
||||||
@ -119,7 +118,7 @@ public class Battery extends Widget {
|
|||||||
g2d.setColor(Utils.highlighted.get() || mouseOver ? Color.BLACK :
|
g2d.setColor(Utils.highlighted.get() || mouseOver ? Color.BLACK :
|
||||||
Color.LIGHT_GRAY);
|
Color.LIGHT_GRAY);
|
||||||
g2d.drawString(
|
g2d.drawString(
|
||||||
formatter3.format(donePercent * 100) + "%",
|
NumberFormats.FORMATTER_THREE_DECIMAL_PLACES.format(donePercent * 100) + "%",
|
||||||
((int) (width_ * 0.4)),
|
((int) (width_ * 0.4)),
|
||||||
donePercent > 0.5 ? totalHeight / 4 * 3 : totalHeight / 4 * 1);
|
donePercent > 0.5 ? totalHeight / 4 * 3 : totalHeight / 4 * 1);
|
||||||
|
|
||||||
|
@ -386,14 +386,10 @@ public class TimeCalcManager {
|
|||||||
if (millisecondsRemainsD > 0) {
|
if (millisecondsRemainsD > 0) {
|
||||||
minutesRemainsD = minutesRemainsD - 1d / 1000d;
|
minutesRemainsD = minutesRemainsD - 1d / 1000d;
|
||||||
}
|
}
|
||||||
hourBattery.setDonePercent(
|
hourBattery.setDonePercent(1 - ((minutesRemainsD % 60d) / 60d));
|
||||||
done >= 1 ? 1 : (1 - ((minutesRemainsD % 60d) / 60d)));
|
|
||||||
if (!nowIsWeekend) {
|
if (!nowIsWeekend) {
|
||||||
int hoursForLabel =
|
|
||||||
(timeRemains.getMinute() == 0 ? timeRemains.getMinute() / 60 + 1 :
|
|
||||||
timeRemains.getMinute() / 60);
|
|
||||||
hourBattery.setLabel(
|
hourBattery.setLabel(
|
||||||
((totalMinutes / 60) - hoursForLabel) + "/" + (
|
hourDone + "/" + (
|
||||||
totalMinutes / 60));
|
totalMinutes / 60));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user