-
Notifications
You must be signed in to change notification settings - Fork 1
Notifications
Interitus has its own Notification API to send Informations to the user. It can be used in every Position in the code
A Notification can only be displayed once per instance.
Create a Notification:
Notification notification = new Notification(Texture icon, String title, String Message);
Parameters you can add:
- The Notification won't disappear but when it doesn't fit on the screen it will disappear though.
notification.setStayalive(boolean stayalive);
- If false it isn't possible that the Notification will disappear.
notification.setCloseable(boolean closeable);
-
Set the value of the ProgressBar in the Notification.
If the value is -1 (default) the ProgressBar will be hidden.
Note that the Notification will automatically expire if StayAlive is false (default)
notification.setProgressbarvalue(int progressbarvalue);
-
Set the time after the Notification will expire and disappear.
Note that this parameter doesn't affect the display time after sending the Notification to the NotificationManager.
notification.setAlivetime(int alivetime);
- Set if the Notification swips in
notification.rollin(boolean animate);
To sent the Notification simple call:
NotificationManager.sendNotification(notification);
That will return true if the operation was successful
If you want to close the Notification (useful if closeable = false or if Stayalive = true) call:
notification.close();
Tipp:
Every Parameter will return the Notification itself that allows you for example to do this:
Notification notification = new Notification(Texture icon, String title, String Message).setCloseable(false).setProgressbarvalue(0);