From 76cb5df9989b9f007776f9330c2eafc753fd788c Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Sat, 14 Apr 2018 20:42:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Improved=20network=20notificatio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dissem/apps/abit/notification/NetworkNotification.kt | 5 ++++- .../drawable/ic_notification_full_node_connecting.xml | 9 +++++++++ .../drawable/ic_notification_full_node_disconnected.xml | 9 +++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_notification_full_node_connecting.xml create mode 100644 app/src/main/res/drawable/ic_notification_full_node_disconnected.xml diff --git a/app/src/main/java/ch/dissem/apps/abit/notification/NetworkNotification.kt b/app/src/main/java/ch/dissem/apps/abit/notification/NetworkNotification.kt index 1baebb4..abc024e 100644 --- a/app/src/main/java/ch/dissem/apps/abit/notification/NetworkNotification.kt +++ b/app/src/main/java/ch/dissem/apps/abit/notification/NetworkNotification.kt @@ -42,7 +42,7 @@ class NetworkNotification(ctx: Context) : AbstractNotification(ctx) { val showAppIntent = Intent(ctx, MainActivity::class.java) val pendingIntent = PendingIntent.getActivity(ctx, 1, showAppIntent, 0) builder - .setSmallIcon(R.drawable.ic_notification_full_node) + .setSmallIcon(R.drawable.ic_notification_full_node_connecting) .setContentTitle(ctx.getString(R.string.bitmessage_full_node)) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setShowWhen(false) @@ -55,10 +55,13 @@ class NetworkNotification(ctx: Context) : AbstractNotification(ctx) { builder.setOngoing(running) val connections = BitmessageService.status.getProperty("network", "connections") if (!running) { + builder.setSmallIcon(R.drawable.ic_notification_full_node_disconnected) builder.setContentText(ctx.getString(R.string.connection_info_disconnected)) } else if (connections == null || connections.properties.isEmpty()) { + builder.setSmallIcon(R.drawable.ic_notification_full_node_connecting) builder.setContentText(ctx.getString(R.string.connection_info_pending)) } else { + builder.setSmallIcon(R.drawable.ic_notification_full_node) val info = StringBuilder() for (stream in connections.properties) { val streamNumber = Integer.parseInt(stream.name.substring("stream ".length)) diff --git a/app/src/main/res/drawable/ic_notification_full_node_connecting.xml b/app/src/main/res/drawable/ic_notification_full_node_connecting.xml new file mode 100644 index 0000000..9b26ca7 --- /dev/null +++ b/app/src/main/res/drawable/ic_notification_full_node_connecting.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_notification_full_node_disconnected.xml b/app/src/main/res/drawable/ic_notification_full_node_disconnected.xml new file mode 100644 index 0000000..2c45daf --- /dev/null +++ b/app/src/main/res/drawable/ic_notification_full_node_disconnected.xml @@ -0,0 +1,9 @@ + + +