Skip to content

Notifications

Coder246 edited this page Aug 25, 2020 · 4 revisions

Interitus has its own Notification API to send Informations to the user. It can be used in every Position in the code

How to Create a Notification

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:

  1. The Notification won't disappear but when it doesn't fit on the screen it will disappear though.
notification.setStayalive(boolean stayalive);
  1. If false it isn't possible that the Notification will disappear.
notification.setCloseable(boolean closeable);
  1. 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);
  1. 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);
  1. Set if the Notification swips in
notification.rollin(boolean animate);

Send Notification

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);
Clone this wiki locally