diff options
author | cyBerta <cyberta@riseup.net> | 2021-10-16 11:59:42 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2021-10-16 11:59:42 +0200 |
commit | fcec92a0042477347338a25cd072d622edfa03c9 (patch) | |
tree | ead10844c3c9ebe6c05773a2fc3b3b619120e451 /app/src/main/java/se/leap/bitmaskclient/tor/TorNotificationManager.java | |
parent | dac7d9ce22f1eb2a96cc8a3a0fc34e6c3d4c9291 (diff) |
show tor bootstrapping progress in notifications
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/tor/TorNotificationManager.java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/tor/TorNotificationManager.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/tor/TorNotificationManager.java b/app/src/main/java/se/leap/bitmaskclient/tor/TorNotificationManager.java index a2401732..8148fd94 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tor/TorNotificationManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/tor/TorNotificationManager.java @@ -50,7 +50,7 @@ public class TorNotificationManager { .setContentText(context.getString(R.string.tor_started)).build(); } - public void buildTorNotification(Context context, String state) { + public void buildTorNotification(Context context, String state, String message, int progress) { NotificationManager notificationManager = initNotificationManager(context); if (notificationManager == null) { return; @@ -59,8 +59,15 @@ public class TorNotificationManager { notificationBuilder .setSmallIcon(R.drawable.ic_bridge_36) .setWhen(System.currentTimeMillis()) - .setTicker(state) - .setContentText(state); + .setStyle(new NotificationCompat.BigTextStyle(). + setBigContentTitle(state). + bigText(message)) + .setTicker(message) + .setContentTitle(state) + .setContentText(message); + if (progress > 0) { + notificationBuilder.setProgress(100, progress, false); + } notificationManager.notify(TOR_SERVICE_NOTIFICATION_ID, notificationBuilder.build()); } |