diff --git a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/common/MainWindow.java b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/common/MainWindow.java index 68f454f..0d8f359 100644 --- a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/common/MainWindow.java +++ b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/common/MainWindow.java @@ -718,8 +718,7 @@ public class MainWindow extends TWindow { int totalMinutes = timeTotal.getMinute(); int totalMilliseconds = timeTotal.toTotalMilliseconds(); - System.out.println("totalMillisecondsDone=" + totalMillisecondsDone); - System.out.println("totalMilliseconds=" + totalMilliseconds); + double done = ((double) totalMillisecondsDone) / ((double) totalMilliseconds); if(done < 0) { diff --git a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/Battery.java b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/Battery.java index 10a0d0c..06c8aa7 100644 --- a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/Battery.java +++ b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/Battery.java @@ -224,42 +224,28 @@ public class Battery extends Widget { Font currentFont = brush.getFont(); brush.setFont(BIG_FONT); if (chargingCharacterVisibleProperty.isEnabled()) { - brush.drawString( - CHARCHING, ((int) (totalWidth * 0.45)), - (donePercent < 0.5 ? totalHeight / 4 * 3 - : totalHeight / 4 * 1) + 10 - ); + paintChargingCharacter(brush); } - paintSmiley(visibility, brush, ((int) (totalWidth * 0.45)) + 15, - (donePercent < 0.5 ? totalHeight / 4 * 3 - : totalHeight / 4 * 1) + 8 - 16); brush.setFont(currentFont); } if (circleProgressVisibleProperty.isEnabled()) { - Color currentColor = brush.getColor(); - brush.setColor( - visibility.isStronglyColored() ? HIGH_HIGHLIGHTED : - (visibility.isWeaklyColored() ? HIGH : - Color.lightGray)); - - double angleDouble = donePercent * 360; - - brush.fillArc(((int) (totalWidth * 0.45)) + 15, - totalHeight / 4 * 3 + 28, - 15, 15, 90, -(int) angleDouble); - brush.setColor( - visibility.isStronglyColored() ? LIGHT_RED - : - visibility.isWeaklyColored() ? ULTRA_LIGHT_RED : - BACKGROUND_COLOR); - brush.fillArc(((int) (totalWidth * 0.45)) + 15, - totalHeight / 4 * 3 + 28, - 15, 15, 90, +(int) (360 - angleDouble)); - - brush.setColor(currentColor); + paintCircleProgress(brush, visibility); } } + + if (donePercent > 0) { + Font currentFont = brush.getFont(); + brush.setFont(BIG_FONT); + + paintSmiley(visibility, brush, ((int) (totalWidth * 0.45)) + 15, + (donePercent < 0.5 ? totalHeight / 4 * 3 + : totalHeight / 4 * 1) + 8 - 16); + brush.setFont(currentFont); + } + + + if (percentProgressVisibleProperty.isEnabled()) { brush.drawString( NumberFormats.FORMATTER_THREE_DECIMAL_PLACES @@ -290,6 +276,38 @@ public class Battery extends Widget { } + public void paintChargingCharacter(Graphics2D brush) { + brush.drawString( + CHARCHING, ((int) (totalWidth * 0.45)), + (donePercent < 0.5 ? totalHeight / 4 * 3 + : totalHeight / 4 * 1) + 10 + ); + } + + private void paintCircleProgress(Graphics2D brush, Visibility visibility) { + Color currentColor = brush.getColor(); + brush.setColor( + visibility.isStronglyColored() ? HIGH_HIGHLIGHTED : + (visibility.isWeaklyColored() ? HIGH : + Color.lightGray)); + + double angleDouble = donePercent * 360; + + brush.fillArc(((int) (totalWidth * 0.45)) + 15, + totalHeight / 4 * 3 + 28, + 15, 15, 90, -(int) angleDouble); + brush.setColor( + visibility.isStronglyColored() ? LIGHT_RED + : + visibility.isWeaklyColored() ? ULTRA_LIGHT_RED : + BACKGROUND_COLOR); + brush.fillArc(((int) (totalWidth * 0.45)) + 15, + totalHeight / 4 * 3 + 28, + 15, 15, 90, +(int) (360 - angleDouble)); + + brush.setColor(currentColor); + } + private double getRandom(int index) { return getRandom(index, false); } diff --git a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/WalkingHumanProgress.java b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/WalkingHumanProgress.java index e5081c6..3ab9e94 100644 --- a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/WalkingHumanProgress.java +++ b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/WalkingHumanProgress.java @@ -141,7 +141,7 @@ public class WalkingHumanProgress extends Widget implements final int donePercentInt = (int) (Math.floor(donePercent * 100)); int percentInt = donePercentInt; - if (!alreadyShownPercents.contains(donePercentInt)) { + if (donePercentInt % 5 == 0 && !alreadyShownPercents.contains(donePercentInt)) { alreadyShownPercents.add(donePercentInt); Toaster toasterManager = new Toaster(); Font font = new Font("sans", Font.PLAIN, 16);