Package com.avrix.ui.notify
Class Notification
java.lang.Object
com.avrix.ui.notify.Notification
The Notification class represents a notification that is displayed on the screen and has a limited lifetime.
It contains text, an icon, and various visual properties.
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the height of the notification.int
getWidth()
Returns the width of the notification.boolean
Checks if the notification has expired.void
render
(int x, int y) Renders the notification at the specified position on the screen.void
setBackgroundColor
(NanoColor backgroundColor) Sets the background color of the notification.void
setFontName
(String fontName) Sets the font name for the text.void
setFontSize
(int fontSize) Sets the font size for the text.void
setHeight
(int height) Sets the height of the notification.void
setIconColor
(NanoColor iconColor) Sets the color of the icon.void
setIconFontName
(String iconFontName) Sets the font name for the icon.void
setIconFontSize
(int iconFontSize) Sets the font size for the icon.void
setLifeTime
(int lifeTime) Sets the lifetime of the notification.void
setMargin
(int margin) Sets the margin inside the notification.void
setTextColor
(NanoColor textColor) Sets the color of the text.void
setTimeColor
(NanoColor timeColor) Sets the color of the time bar.void
setWidth
(int width) Sets the width of the notification.void
show()
Displays the notification.
-
Method Details
-
setFontName
Sets the font name for the text.- Parameters:
fontName
- The name of the font.
-
setIconFontName
Sets the font name for the icon.- Parameters:
iconFontName
- The name of the icon font.
-
setFontSize
public void setFontSize(int fontSize) Sets the font size for the text.- Parameters:
fontSize
- The size of the font.
-
setIconFontSize
public void setIconFontSize(int iconFontSize) Sets the font size for the icon.- Parameters:
iconFontSize
- The size of the icon font.
-
setMargin
public void setMargin(int margin) Sets the margin inside the notification.- Parameters:
margin
- The margin in pixels.
-
setWidth
public void setWidth(int width) Sets the width of the notification.- Parameters:
width
- The width in pixels.
-
setHeight
public void setHeight(int height) Sets the height of the notification.- Parameters:
height
- The height in pixels.
-
setLifeTime
public void setLifeTime(int lifeTime) Sets the lifetime of the notification.- Parameters:
lifeTime
- The lifetime in seconds.
-
setBackgroundColor
Sets the background color of the notification.- Parameters:
backgroundColor
- The background color.
-
setTimeColor
Sets the color of the time bar.- Parameters:
timeColor
- The color of the time bar.
-
setTextColor
Sets the color of the text.- Parameters:
textColor
- The color of the text.
-
setIconColor
Sets the color of the icon.- Parameters:
iconColor
- The color of the icon.
-
getHeight
public int getHeight()Returns the height of the notification.- Returns:
- The height in pixels.
-
getWidth
public int getWidth()Returns the width of the notification.- Returns:
- The width in pixels.
-
isExpired
public boolean isExpired()Checks if the notification has expired.- Returns:
- true if the notification is expired, false otherwise.
-
show
public void show()Displays the notification. Initializes the creation and expiration times, as well as calculates the size of the notification. -
render
public void render(int x, int y) Renders the notification at the specified position on the screen.- Parameters:
x
- The x-coordinate of the top-left corner of the notification.y
- The y-coordinate of the top-left corner of the notification.
-