🚸 Improved network notification

This commit is contained in:
Christian Basler 2018-04-14 20:42:53 +02:00
parent 3026ae8505
commit 76cb5df998
3 changed files with 22 additions and 1 deletions

View File

@ -42,7 +42,7 @@ class NetworkNotification(ctx: Context) : AbstractNotification(ctx) {
val showAppIntent = Intent(ctx, MainActivity::class.java) val showAppIntent = Intent(ctx, MainActivity::class.java)
val pendingIntent = PendingIntent.getActivity(ctx, 1, showAppIntent, 0) val pendingIntent = PendingIntent.getActivity(ctx, 1, showAppIntent, 0)
builder builder
.setSmallIcon(R.drawable.ic_notification_full_node) .setSmallIcon(R.drawable.ic_notification_full_node_connecting)
.setContentTitle(ctx.getString(R.string.bitmessage_full_node)) .setContentTitle(ctx.getString(R.string.bitmessage_full_node))
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setShowWhen(false) .setShowWhen(false)
@ -55,10 +55,13 @@ class NetworkNotification(ctx: Context) : AbstractNotification(ctx) {
builder.setOngoing(running) builder.setOngoing(running)
val connections = BitmessageService.status.getProperty("network", "connections") val connections = BitmessageService.status.getProperty("network", "connections")
if (!running) { if (!running) {
builder.setSmallIcon(R.drawable.ic_notification_full_node_disconnected)
builder.setContentText(ctx.getString(R.string.connection_info_disconnected)) builder.setContentText(ctx.getString(R.string.connection_info_disconnected))
} else if (connections == null || connections.properties.isEmpty()) { } 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)) builder.setContentText(ctx.getString(R.string.connection_info_pending))
} else { } else {
builder.setSmallIcon(R.drawable.ic_notification_full_node)
val info = StringBuilder() val info = StringBuilder()
for (stream in connections.properties) { for (stream in connections.properties) {
val streamNumber = Integer.parseInt(stream.name.substring("stream ".length)) val streamNumber = Integer.parseInt(stream.name.substring("stream ".length))

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M19,18H6A4,4 0 0,1 2,14A4,4 0 0,1 6,10H6.71C7.37,7.69 9.5,6 12,6A5.5,5.5 0 0,1 17.5,11.5V12H19A3,3 0 0,1 22,15A3,3 0 0,1 19,18M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z" />
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M7.73,10L15.73,18H6A4,4 0 0,1 2,14A4,4 0 0,1 6,10M3,5.27L5.75,8C2.56,8.15 0,10.77 0,14A6,6 0 0,0 6,20H17.73L19.73,22L21,20.73L4.27,4M19.35,10.03C18.67,6.59 15.64,4 12,4C10.5,4 9.15,4.43 8,5.17L9.45,6.63C10.21,6.23 11.08,6 12,6A5.5,5.5 0 0,1 17.5,11.5V12H19A3,3 0 0,1 22,15C22,16.13 21.36,17.11 20.44,17.62L21.89,19.07C23.16,18.16 24,16.68 24,15C24,12.36 21.95,10.22 19.35,10.03Z" />
</vector>