Added some improvements

This commit is contained in:
Robert Vokac 2024-03-09 17:38:23 +00:00
parent 6c7a6cd2d8
commit c611f514e4
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
3 changed files with 49 additions and 32 deletions

View File

@ -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) {

View File

@ -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);
}

View File

@ -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);