@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add("-t"); commands.add(DOUBLE_QUOTE + notification.title() + DOUBLE_QUOTE); commands.add("-m"); commands.add(DOUBLE_QUOTE + notification.message() + DOUBLE_QUOTE); commands.add("-p"); commands.add(DOUBLE_QUOTE + notification.icon().asPath() + DOUBLE_QUOTE); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new ToasterNotificationException("Error while sending notification with toaster", e); } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add("-t"); commands.add(DOUBLE_QUOTE + notification.title() + DOUBLE_QUOTE); commands.add("-m"); commands.add(DOUBLE_QUOTE + notification.message() + DOUBLE_QUOTE); commands.add("-p"); commands.add(DOUBLE_QUOTE + notification.icon().asPath() + DOUBLE_QUOTE); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new ToasterNotificationException("Error while sending notification with toaster", e); } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add("/p"); commands.add(escape(notification.title())); commands.add("/m"); commands.add(escape(notification.message())); commands.add("/d"); if (application.timeout() == -1) { commands.add(String.valueOf(TimeUnit.SECONDS.toMillis(10))); } else { commands.add(String.valueOf(application.timeout())); } commands.add("/t"); commands.add(toType(notification.level())); commands.add("/q"); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new NotifuException("Error while sending notification to notifu.", e.getCause()); } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add("--passivepopup"); commands.add(notification.message()); if (application.timeout() != -1) { commands.add(String.valueOf(TimeUnit.MILLISECONDS.toSeconds(application.timeout()))); } commands.add("--title"); commands.add(notification.title()); commands.add("--icon"); commands.add(notification.icon().asPath()); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new KdialogException("Error while sending notification with Kdialog.", e); } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add("--passivepopup"); commands.add(notification.message()); if (application.timeout() != -1) { commands.add(String.valueOf(TimeUnit.MILLISECONDS.toSeconds(application.timeout()))); } commands.add("--title"); commands.add(notification.title()); commands.add("--icon"); commands.add(notification.icon().asPath()); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new KdialogException("Error while sending notification with Kdialog.", e); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Notification) { Notification that = (Notification) o; return (this.message.equals(that.message())) && (this.title.equals(that.title())) && ((this.subtitle == null) ? (that.subtitle() == null) : this.subtitle.equals(that.subtitle())) && (this.icon.equals(that.icon())) && (this.level.equals(that.level())); } return false; }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add(notification.title()); commands.add(notification.message()); if (application.timeout() != -1) { commands.add(CMD_TIMEOUT); commands.add(String.valueOf(application.timeout())); } commands.add(CMD_ICON); commands.add(notification.icon().asPath()); commands.add(CMD_URGENCY); commands.add(toUrgency(notification.level())); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new NotifySendNotificationException("Error while sending notification to notify-send.", e.getCause()); } }
@Override public void send(Notification notification) { List<String> commands = new ArrayList<>(); commands.add(configuration.bin()); commands.add(notification.title()); commands.add(notification.message()); if (application.timeout() != -1) { commands.add(CMD_TIMEOUT); commands.add(String.valueOf(application.timeout())); } commands.add(CMD_ICON); commands.add(notification.icon().asPath()); commands.add(CMD_URGENCY); commands.add(toUrgency(notification.level())); try { executor.exec(commands.toArray(new String[0])); } catch (RuntimeException e) { throw new NotifySendNotificationException("Error while sending notification to notify-send.", e.getCause()); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Notification) { Notification that = (Notification) o; return (this.message.equals(that.message())) && (this.title.equals(that.title())) && ((this.subtitle == null) ? (that.subtitle() == null) : this.subtitle.equals(that.subtitle())) && (this.icon.equals(that.icon())) && (this.level.equals(that.level())); } return false; }
private String attachments(Notification notification) { return "[{" + "\"fallback\":\"" + notification.message() + "\"," + "\"color\":\"" + colorize(notification) + "\"," + "\"author_name\":\"" + application.name() + "\"," + "\"title\":\"" + notification.title() + "\"," + "\"text\":\"" + notification.message() + "\n" + notification.subtitle() + "\"," + "}]"; }
private String attachments(Notification notification) { return "[{" + "\"fallback\":\"" + notification.message() + "\"," + "\"color\":\"" + colorize(notification) + "\"," + "\"author_name\":\"" + application.name() + "\"," + "\"title\":\"" + notification.title() + "\"," + "\"text\":\"" + notification.message() + "\n" + notification.subtitle() + "\"," + "}]"; }
@Override public void send(Notification notification) { if (isClientRegistered()) { GntpNotification success = Gntp.notification(gNotification, notification.title()) .text(notification.message()) .icon(notification.icon().toImage()) .priority(toPriority(notification.level())) .build(); try { gClient.notify(success, 5, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
@Override public void send(Notification notification) { if (isClientRegistered()) { GntpNotification success = Gntp.notification(gNotification, notification.title()) .text(notification.message()) .icon(notification.icon().toImage()) .priority(toPriority(notification.level())) .build(); try { gClient.notify(success, 5, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
@Override public void send(Notification notification) { if (!skipNotifications) { icon.setImage(createImage(notification.icon().toByteArray())); icon.displayMessage(notification.title(), notification.message(), toMessageType(notification.level())); } }
@Override public void send(Notification notification) { if (!skipNotifications) { icon.setImage(createImage(notification.icon().toByteArray())); icon.displayMessage(notification.title(), notification.message(), toMessageType(notification.level())); } }
private RequestBody buildRequestBody(Notification notification) { FormEncoding.Builder builder = new FormEncoding.Builder(); if (configuration.device() != null) { builder.add("device_iden", configuration.device()); } if (configuration.email() != null) { builder.add("email", configuration.email()); } builder.add("type", "note") .add("title", notification.title()) .add("body", notification.message()); ByteArrayOutputStream data; try { data = new ByteArrayOutputStream(); builder.build().writeBodyTo(data); } catch (IOException e) { String message = "Can't build request body."; LOGGER.error(message, e); throw new PushbulletNotificationException(message, e); } return RequestBody.create(MediaType.parse("application/x-www-form-urlencoded"), data.toByteArray()); }
@Override public void send(Notification notification) { Notify notify = Notify.create() .title(notification.title()) .text(notification.message()) .image(notification.icon().toImage()) .position(configuration.position()) .hideAfter((int) (application.timeout() == -1 ? SECONDS.toMillis(3) : application.timeout())); if (configuration.withDarkStyle()) { notify.darkStyle(); } notify.show(); }
@Override public void send(Notification notification) { Notify notify = Notify.create() .title(notification.title()) .text(notification.message()) .image(notification.icon().toImage()) .position(configuration.position()) .hideAfter((int) (application.timeout() == -1 ? SECONDS.toMillis(3) : application.timeout())); if (configuration.withDarkStyle()) { notify.darkStyle(); } notify.show(); }
@Override public void send(Notification notification) { if (snarl == null) { LOGGER.warn("Snarl notifier is not initialized, cannot send notification."); return; } fr.jcgay.snp4j.request.Notification snarlNotification = new fr.jcgay.snp4j.request.Notification(); snarlNotification.setIcon(Icon.base64(notification.icon().toByteArray())); snarlNotification.setText(notification.message()); snarlNotification.setTitle(notification.title()); snarlNotification.setPriority(toPriority(notification.level())); init(); try { snarl.send(snarlNotification); } catch (SnpException e) { throw new SnarlNotificationException("Cannot send notification to Snarl.", e); } }
@Override public void send(Notification notification) { if (snarl == null) { LOGGER.warn("Snarl notifier is not initialized, cannot send notification."); return; } fr.jcgay.snp4j.request.Notification snarlNotification = new fr.jcgay.snp4j.request.Notification(); snarlNotification.setIcon(Icon.base64(notification.icon().toByteArray())); snarlNotification.setText(notification.message()); snarlNotification.setTitle(notification.title()); snarlNotification.setPriority(toPriority(notification.level())); init(); try { snarl.send(snarlNotification); } catch (SnpException e) { throw new SnarlNotificationException("Cannot send notification to Snarl.", e); } }