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 TypeMethodDescriptionintReturns the height of the notification.intgetWidth()Returns the width of the notification.booleanChecks if the notification has expired.voidrender(int x, int y) Renders the notification at the specified position on the screen.voidsetBackgroundColor(NanoColor backgroundColor) Sets the background color of the notification.voidsetFontName(String fontName) Sets the font name for the text.voidsetFontSize(int fontSize) Sets the font size for the text.voidsetHeight(int height) Sets the height of the notification.voidsetIconColor(NanoColor iconColor) Sets the color of the icon.voidsetIconFontName(String iconFontName) Sets the font name for the icon.voidsetIconFontSize(int iconFontSize) Sets the font size for the icon.voidsetLifeTime(int lifeTime) Sets the lifetime of the notification.voidsetMargin(int margin) Sets the margin inside the notification.voidsetTextColor(NanoColor textColor) Sets the color of the text.voidsetTimeColor(NanoColor timeColor) Sets the color of the time bar.voidsetWidth(int width) Sets the width of the notification.voidshow()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.
-