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
2a597ceee5
commit
a573a2799c
@ -57,7 +57,7 @@ public class Battery extends Widget {
|
|||||||
this.totalHeight = (int) (this.getHeight() / 10d * 7d);
|
this.totalHeight = (int) (this.getHeight() / 10d * 7d);
|
||||||
this.totalWidth = this.getWidth();
|
this.totalWidth = this.getWidth();
|
||||||
}
|
}
|
||||||
if(donePercent > 0 && donePercent < CRITICAL_LOW_ENERGY && (System.nanoTime() - tmpNanoTime) > (500000000l) / 2l) {
|
if(donePercent > 0 && donePercent < CRITICAL_LOW_ENERGY && (System.nanoTime() - tmpNanoTime) > (1000000000l) / 2l) {
|
||||||
blinking.flip();
|
blinking.flip();
|
||||||
tmpNanoTime = System.nanoTime();
|
tmpNanoTime = System.nanoTime();
|
||||||
}
|
}
|
||||||
@ -172,11 +172,14 @@ 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);
|
||||||
|
|
||||||
Font currentFont = g2d.getFont();
|
if(donePercent <1) {
|
||||||
g2d.setFont(bigFont);
|
Font currentFont = g2d.getFont();
|
||||||
g2d.drawString("⚡", ((int) (totalWidth * 0.45)),(donePercent < 0.5 ? totalHeight / 4 * 3 :
|
g2d.setFont(bigFont);
|
||||||
totalHeight / 4 * 1) + 10);
|
g2d.drawString("⚡", ((int) (totalWidth * 0.45)),
|
||||||
g2d.setFont(currentFont);
|
(donePercent < 0.5 ? totalHeight / 4 * 3 :
|
||||||
|
totalHeight / 4 * 1) + 10);
|
||||||
|
g2d.setFont(currentFont);
|
||||||
|
}
|
||||||
|
|
||||||
g2d.drawString(
|
g2d.drawString(
|
||||||
NumberFormats.FORMATTER_THREE_DECIMAL_PLACES.format(donePercent * 100) + "%",
|
NumberFormats.FORMATTER_THREE_DECIMAL_PLACES.format(donePercent * 100) + "%",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.nanoboot.utils.timecalc.gui.progress;
|
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.utils.NumberFormats;
|
||||||
import org.nanoboot.utils.timecalc.utils.Utils;
|
import org.nanoboot.utils.timecalc.utils.Utils;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
@ -72,6 +73,9 @@ public class ProgressSquare extends Widget {
|
|||||||
}
|
}
|
||||||
g2d.setColor(FOREGROUND_COLOR);
|
g2d.setColor(FOREGROUND_COLOR);
|
||||||
}
|
}
|
||||||
|
g2d.setColor(Utils.highlighted.get() || mouseOver ? Color.BLACK : BACKGROUND_COLOR);
|
||||||
|
|
||||||
|
g2d.drawString(NumberFormats.FORMATTER_FIVE_DECIMAL_PLACES.format(donePercent * 100) + "%", (int)(side/8d*3d),(int)(side/8d*(donePercent > 0.5 ? 3d : 5d)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,15 +92,35 @@ public class TimeCalcManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_G) {
|
if (e.getKeyCode() == KeyEvent.VK_G) {
|
||||||
|
if(!Utils.ultraLight.get() && Utils.highlighted.isEnabled()) {
|
||||||
|
Utils.highlighted.disable();
|
||||||
|
}
|
||||||
Utils.ultraLight.flip();
|
Utils.ultraLight.flip();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_C) {
|
if (e.getKeyCode() == KeyEvent.VK_C) {
|
||||||
|
if(Utils.ultraLight.get() && !Utils.highlighted.isEnabled()) {
|
||||||
|
Utils.ultraLight.disable();
|
||||||
|
}
|
||||||
Utils.highlighted.flip();
|
Utils.highlighted.flip();
|
||||||
}
|
}
|
||||||
if (e.getKeyCode() == KeyEvent.VK_V || e.getKeyCode() == KeyEvent.VK_SPACE) {
|
if (e.getKeyCode() == KeyEvent.VK_V) {
|
||||||
Utils.everythingHidden.flip();
|
Utils.everythingHidden.flip();
|
||||||
}
|
}
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
|
||||||
|
if(Utils.everythingHidden.isEnabled()) {
|
||||||
|
Utils.everythingHidden.disable();
|
||||||
|
Utils.highlighted.enable();
|
||||||
|
Utils.ultraLight.disable();
|
||||||
|
} else {
|
||||||
|
if(Utils.highlighted.isEnabled()) {
|
||||||
|
Utils.ultraLight.enable();
|
||||||
|
Utils.highlighted.disable();
|
||||||
|
} else {
|
||||||
|
Utils.everythingHidden.enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (e.getKeyCode() == KeyEvent.VK_R) {
|
if (e.getKeyCode() == KeyEvent.VK_R) {
|
||||||
commandButton.doClick();
|
commandButton.doClick();
|
||||||
}
|
}
|
||||||
@ -300,10 +320,6 @@ public class TimeCalcManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.highlighted.get()) {
|
|
||||||
Utils.ultraLight.set(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentRegistry.setVisible(!Utils.everythingHidden.get());
|
componentRegistry.setVisible(!Utils.everythingHidden.get());
|
||||||
if (!Utils.highlighted.get() || Utils.ultraLight.get()) {
|
if (!Utils.highlighted.get() || Utils.ultraLight.get()) {
|
||||||
jokeButton.setBackground(BG);
|
jokeButton.setBackground(BG);
|
||||||
|
@ -19,6 +19,12 @@ public class BooleanHolder {
|
|||||||
this.b = b;
|
this.b = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return get();
|
||||||
|
}
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return !get();
|
||||||
|
}
|
||||||
public boolean get() {
|
public boolean get() {
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@ -26,4 +32,10 @@ public class BooleanHolder {
|
|||||||
public void flip() {
|
public void flip() {
|
||||||
this.b = !b;
|
this.b = !b;
|
||||||
}
|
}
|
||||||
|
public void enable() {
|
||||||
|
set(true);
|
||||||
|
}
|
||||||
|
public void disable() {
|
||||||
|
set(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user