Added new improvements

This commit is contained in:
Robert Vokac 2024-02-03 05:25:19 +00:00
parent c6f9d75c49
commit a66c7b9a33
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
2 changed files with 5 additions and 10 deletions

View File

@ -2,6 +2,7 @@ package org.nanoboot.utils.timecalc.gui.progress;
import org.nanoboot.utils.timecalc.gui.common.Widget;
import org.nanoboot.utils.timecalc.main.TimeCalcConf;
import org.nanoboot.utils.timecalc.utils.NumberFormats;
import org.nanoboot.utils.timecalc.utils.Utils;
import java.awt.Color;
@ -9,8 +10,6 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class Battery extends Widget {
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 HIGHEST_HIGHLIGHTED = Color.green;
public static boolean wavesOff = false;
NumberFormat formatter3 = new DecimalFormat("#0.000");
private int totalHeight = 0;
private int width_;
@ -119,7 +118,7 @@ public class Battery extends Widget {
g2d.setColor(Utils.highlighted.get() || mouseOver ? Color.BLACK :
Color.LIGHT_GRAY);
g2d.drawString(
formatter3.format(donePercent * 100) + "%",
NumberFormats.FORMATTER_THREE_DECIMAL_PLACES.format(donePercent * 100) + "%",
((int) (width_ * 0.4)),
donePercent > 0.5 ? totalHeight / 4 * 3 : totalHeight / 4 * 1);

View File

@ -386,14 +386,10 @@ public class TimeCalcManager {
if (millisecondsRemainsD > 0) {
minutesRemainsD = minutesRemainsD - 1d / 1000d;
}
hourBattery.setDonePercent(
done >= 1 ? 1 : (1 - ((minutesRemainsD % 60d) / 60d)));
hourBattery.setDonePercent(1 - ((minutesRemainsD % 60d) / 60d));
if (!nowIsWeekend) {
int hoursForLabel =
(timeRemains.getMinute() == 0 ? timeRemains.getMinute() / 60 + 1 :
timeRemains.getMinute() / 60);
hourBattery.setLabel(
((totalMinutes / 60) - hoursForLabel) + "/" + (
hourDone + "/" + (
totalMinutes / 60));
}