From 71bc6e7f8be7c70987bfa173d58f00588d171d07 Mon Sep 17 00:00:00 2001 From: Robinson Date: Sat, 25 Nov 2023 22:08:09 +0100 Subject: [PATCH] moved progressbar into draw command --- src/dorkbox/notify/AppNotify.kt | 14 +++++++------- src/dorkbox/notify/DesktopNotify.kt | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/dorkbox/notify/AppNotify.kt b/src/dorkbox/notify/AppNotify.kt index 23a6b1e..37b8df0 100755 --- a/src/dorkbox/notify/AppNotify.kt +++ b/src/dorkbox/notify/AppNotify.kt @@ -206,13 +206,6 @@ internal class AppNotify(override val notification: Notify): Canvas(), NotifyTyp } catch (ignored2: Exception) { } } - - // the progress bar can change, so we always draw it every time - if (progress > 0 && prevProgress != progress) { - // draw the progress bar along the bottom - g.color = notification.theme.progress_FG - g.fillRect(0, Notify.HEIGHT - 2, progress, 2) - } } private fun draw(g: Graphics) { @@ -225,6 +218,13 @@ internal class AppNotify(override val notification: Notify): Canvas(), NotifyTyp g.drawImage(cachedClose, 0, 0, null) } } + + // the progress bar can change, so we always draw it every time + if (progress > 0 && prevProgress != progress) { + // draw the progress bar along the bottom + g.color = notification.theme.progress_FG + g.fillRect(0, Notify.HEIGHT - 2, progress, 2) + } } fun onClick(x: Int, y: Int) { diff --git a/src/dorkbox/notify/DesktopNotify.kt b/src/dorkbox/notify/DesktopNotify.kt index 70c0e88..66b3f37 100755 --- a/src/dorkbox/notify/DesktopNotify.kt +++ b/src/dorkbox/notify/DesktopNotify.kt @@ -182,13 +182,6 @@ internal class DesktopNotify(override val notification: Notify) : JWindow(), Not } catch (ignored2: Exception) { } } - - // the progress bar can change (only getting bigger!), so we always draw it when it grows - if (progress > 0 && prevProgress != progress) { - // draw the progress bar along the bottom - g.color = notification.theme.progress_FG - g.fillRect(0, Notify.HEIGHT - 2, progress, 2) - } } private fun draw(g: Graphics) { @@ -201,6 +194,13 @@ internal class DesktopNotify(override val notification: Notify) : JWindow(), Not g.drawImage(cachedClose, 0, 0, null) } } + + // the progress bar can change (only getting bigger!), so we always draw it when it grows + if (progress > 0 && prevProgress != progress) { + // draw the progress bar along the bottom + g.color = notification.theme.progress_FG + g.fillRect(0, Notify.HEIGHT - 2, progress, 2) + } } fun onClick() {