Code cleanup
This commit is contained in:
parent
1899369a2a
commit
9be2cb5117
|
@ -32,7 +32,6 @@ import dorkbox.tweenEngine.TweenCallback;
|
||||||
import dorkbox.tweenEngine.TweenEngine;
|
import dorkbox.tweenEngine.TweenEngine;
|
||||||
import dorkbox.tweenEngine.TweenEquations;
|
import dorkbox.tweenEngine.TweenEquations;
|
||||||
import dorkbox.util.ScreenUtil;
|
import dorkbox.util.ScreenUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
@SuppressWarnings({"FieldCanBeLocal"})
|
@SuppressWarnings({"FieldCanBeLocal"})
|
||||||
class LookAndFeel {
|
class LookAndFeel {
|
||||||
|
@ -156,10 +155,10 @@ class LookAndFeel {
|
||||||
anchorX = getAnchorX(position, bounds, isDesktopNotification);
|
anchorX = getAnchorX(position, bounds, isDesktopNotification);
|
||||||
anchorY = getAnchorY(position, bounds, isDesktopNotification);
|
anchorY = getAnchorY(position, bounds, isDesktopNotification);
|
||||||
|
|
||||||
boolean showFromTop = isShowFromTop(this);
|
boolean growDown = growDown(this);
|
||||||
|
|
||||||
if (tween != null) {
|
if (tween != null) {
|
||||||
tween.cancel(); // cancel does it's thing on the next tick of animation cycle
|
tween.cancel(); // cancel does its thing on the next tick of animation cycle
|
||||||
tween = null;
|
tween = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +172,7 @@ class LookAndFeel {
|
||||||
|
|
||||||
PopupList looks = popups.get(id);
|
PopupList looks = popups.get(id);
|
||||||
if (looks != null) {
|
if (looks != null) {
|
||||||
if (showFromTop) {
|
if (growDown) {
|
||||||
changedY = anchorY + (popupIndex * (NotifyCanvas.HEIGHT + SPACER));
|
changedY = anchorY + (popupIndex * (NotifyCanvas.HEIGHT + SPACER));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -367,15 +366,15 @@ class LookAndFeel {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
targetY = anchorY;
|
targetY = anchorY;
|
||||||
} else {
|
} else {
|
||||||
boolean showFromTop = isShowFromTop(sourceLook);
|
boolean growDown = growDown(sourceLook);
|
||||||
|
|
||||||
if (sourceLook.isDesktopNotification && index == 1) {
|
if (sourceLook.isDesktopNotification && index == 1) {
|
||||||
// have to adjust for offsets when the window-manager has a toolbar that consumes space and prevents overlap.
|
// have to adjust for offsets when the window-manager has a toolbar that consumes space and prevents overlap.
|
||||||
// this is only done when the 2nd popup is added to the list
|
// this is only done when the 2nd popup is added to the list
|
||||||
looks.calculateOffset(showFromTop, anchorX, anchorY);
|
looks.calculateOffset(growDown, anchorX, anchorY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showFromTop) {
|
if (growDown) {
|
||||||
targetY = anchorY + (index * (NotifyCanvas.HEIGHT + SPACER)) + looks.getOffsetY();
|
targetY = anchorY + (index * (NotifyCanvas.HEIGHT + SPACER)) + looks.getOffsetY();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -408,7 +407,7 @@ class LookAndFeel {
|
||||||
// only called on the swing app or SwingActiveRender thread
|
// only called on the swing app or SwingActiveRender thread
|
||||||
private static
|
private static
|
||||||
boolean removePopupFromMap(final LookAndFeel sourceLook) {
|
boolean removePopupFromMap(final LookAndFeel sourceLook) {
|
||||||
boolean showFromTop = isShowFromTop(sourceLook);
|
boolean growDown = growDown(sourceLook);
|
||||||
boolean popupsAreEmpty;
|
boolean popupsAreEmpty;
|
||||||
|
|
||||||
synchronized (popups) {
|
synchronized (popups) {
|
||||||
|
@ -421,7 +420,7 @@ class LookAndFeel {
|
||||||
final LookAndFeel look = iterator.next();
|
final LookAndFeel look = iterator.next();
|
||||||
|
|
||||||
if (look.tween != null) {
|
if (look.tween != null) {
|
||||||
look.tween.cancel(); // cancel does it's thing on the next tick of animation cycle
|
look.tween.cancel(); // cancel does its thing on the next tick of animation cycle
|
||||||
look.tween = null;
|
look.tween = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +448,7 @@ class LookAndFeel {
|
||||||
// popups at TOP grow down, popups at BOTTOM grow up
|
// popups at TOP grow down, popups at BOTTOM grow up
|
||||||
int changedY;
|
int changedY;
|
||||||
|
|
||||||
if (showFromTop) {
|
if (growDown) {
|
||||||
changedY = look.anchorY + (look.popupIndex * (NotifyCanvas.HEIGHT + SPACER) + offsetY);
|
changedY = look.anchorY + (look.popupIndex * (NotifyCanvas.HEIGHT + SPACER) + offsetY);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -478,7 +477,7 @@ class LookAndFeel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static
|
private static
|
||||||
boolean isShowFromTop(final LookAndFeel look) {
|
boolean growDown(final LookAndFeel look) {
|
||||||
switch (look.position) {
|
switch (look.position) {
|
||||||
case TOP_LEFT:
|
case TOP_LEFT:
|
||||||
case TOP_RIGHT:
|
case TOP_RIGHT:
|
||||||
|
|
|
@ -123,6 +123,7 @@ class NotifyCanvas extends Canvas {
|
||||||
Graphics2D g2 = (Graphics2D) g.create();
|
Graphics2D g2 = (Graphics2D) g.create();
|
||||||
try {
|
try {
|
||||||
if (showCloseButton) {
|
if (showCloseButton) {
|
||||||
|
// manually draw the close button
|
||||||
Graphics2D g3 = (Graphics2D) g.create();
|
Graphics2D g3 = (Graphics2D) g.create();
|
||||||
|
|
||||||
g3.setColor(theme.panel_BG);
|
g3.setColor(theme.panel_BG);
|
||||||
|
@ -142,6 +143,7 @@ class NotifyCanvas extends Canvas {
|
||||||
g3.drawLine(X_2, Y_1, X_1, Y_2);
|
g3.drawLine(X_2, Y_1, X_1, Y_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// draw the progress bar along the bottom
|
||||||
g2.setColor(theme.progress_FG);
|
g2.setColor(theme.progress_FG);
|
||||||
g2.fillRect(0, PROGRESS_HEIGHT, progress, 2);
|
g2.fillRect(0, PROGRESS_HEIGHT, progress, 2);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user