mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added some improvements
This commit is contained in:
parent
6c7a6cd2d8
commit
c611f514e4
@ -718,8 +718,7 @@ public class MainWindow extends TWindow {
|
|||||||
int totalMinutes = timeTotal.getMinute();
|
int totalMinutes = timeTotal.getMinute();
|
||||||
|
|
||||||
int totalMilliseconds = timeTotal.toTotalMilliseconds();
|
int totalMilliseconds = timeTotal.toTotalMilliseconds();
|
||||||
System.out.println("totalMillisecondsDone=" + totalMillisecondsDone);
|
|
||||||
System.out.println("totalMilliseconds=" + totalMilliseconds);
|
|
||||||
double done = ((double) totalMillisecondsDone)
|
double done = ((double) totalMillisecondsDone)
|
||||||
/ ((double) totalMilliseconds);
|
/ ((double) totalMilliseconds);
|
||||||
if(done < 0) {
|
if(done < 0) {
|
||||||
|
@ -224,42 +224,28 @@ public class Battery extends Widget {
|
|||||||
Font currentFont = brush.getFont();
|
Font currentFont = brush.getFont();
|
||||||
brush.setFont(BIG_FONT);
|
brush.setFont(BIG_FONT);
|
||||||
if (chargingCharacterVisibleProperty.isEnabled()) {
|
if (chargingCharacterVisibleProperty.isEnabled()) {
|
||||||
brush.drawString(
|
paintChargingCharacter(brush);
|
||||||
CHARCHING, ((int) (totalWidth * 0.45)),
|
|
||||||
(donePercent < 0.5 ? totalHeight / 4 * 3
|
|
||||||
: totalHeight / 4 * 1) + 10
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
paintSmiley(visibility, brush, ((int) (totalWidth * 0.45)) + 15,
|
|
||||||
(donePercent < 0.5 ? totalHeight / 4 * 3
|
|
||||||
: totalHeight / 4 * 1) + 8 - 16);
|
|
||||||
brush.setFont(currentFont);
|
brush.setFont(currentFont);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (circleProgressVisibleProperty.isEnabled()) {
|
if (circleProgressVisibleProperty.isEnabled()) {
|
||||||
Color currentColor = brush.getColor();
|
paintCircleProgress(brush, visibility);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()) {
|
if (percentProgressVisibleProperty.isEnabled()) {
|
||||||
brush.drawString(
|
brush.drawString(
|
||||||
NumberFormats.FORMATTER_THREE_DECIMAL_PLACES
|
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) {
|
private double getRandom(int index) {
|
||||||
return getRandom(index, false);
|
return getRandom(index, false);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class WalkingHumanProgress extends Widget implements
|
|||||||
final int donePercentInt = (int) (Math.floor(donePercent * 100));
|
final int donePercentInt = (int) (Math.floor(donePercent * 100));
|
||||||
|
|
||||||
int percentInt = donePercentInt;
|
int percentInt = donePercentInt;
|
||||||
if (!alreadyShownPercents.contains(donePercentInt)) {
|
if (donePercentInt % 5 == 0 && !alreadyShownPercents.contains(donePercentInt)) {
|
||||||
alreadyShownPercents.add(donePercentInt);
|
alreadyShownPercents.add(donePercentInt);
|
||||||
Toaster toasterManager = new Toaster();
|
Toaster toasterManager = new Toaster();
|
||||||
Font font = new Font("sans", Font.PLAIN, 16);
|
Font font = new Font("sans", Font.PLAIN, 16);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user