Commit 4aa365e4 authored by Nicolas Fella's avatar Nicolas Fella

Cleanup upload notification

parent c50642e5
......@@ -65,8 +65,7 @@ public class CompositeUploadFileJob extends BackgroundJob<Device, Void> {
totalPayloadSize = 0;
totalSend = 0;
prevProgressPercentage = 0;
uploadNotification = new UploadNotification(getDevice());
uploadNotification.addCancelAction(getId());
uploadNotification = new UploadNotification(getDevice(), getId());
sendPacketStatusCallback = new SendPacketStatusCallback();
}
......
......@@ -39,9 +39,11 @@ class UploadNotification {
private NotificationCompat.Builder builder;
private final int notificationId;
private final Device device;
private long jobId;
UploadNotification(Device device) {
UploadNotification(Device device, long jobId) {
this.device = device;
this.jobId = jobId;
notificationId = (int) System.currentTimeMillis();
notificationManager = (NotificationManager) device.getContext().getSystemService(Context.NOTIFICATION_SERVICE);
......@@ -50,11 +52,10 @@ class UploadNotification {
.setAutoCancel(true)
.setOngoing(true)
.setProgress(100, 0, true);
addCancelAction();
}
void addCancelAction(long jobId) {
builder.mActions.clear();
void addCancelAction() {
Intent cancelIntent = new Intent(device.getContext(), ShareBroadcastReceiver.class);
cancelIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
cancelIntent.setAction(SharePlugin.ACTION_CANCEL_SHARE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment