From d48ffc769ef12e14717c83b369f333eec74481f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20N=C3=BCsse?= Date: Thu, 18 Mar 2021 16:05:11 +0100 Subject: [PATCH] dismiss only after delay to remove stuck notification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Felix NĂ¼sse --- .../android/files/services/FileDownloader.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/owncloud/android/files/services/FileDownloader.java b/src/main/java/com/owncloud/android/files/services/FileDownloader.java index 91a6155dfc..1600481f19 100644 --- a/src/main/java/com/owncloud/android/files/services/FileDownloader.java +++ b/src/main/java/com/owncloud/android/files/services/FileDownloader.java @@ -119,6 +119,8 @@ public class FileDownloader extends Service private long conflictUploadId; + public boolean mStartedDownload = false; + @Inject UserAccountManager accountManager; @Inject UploadsStorageManager uploadsStorageManager; @Inject LocalBroadcastManager localBroadcastManager; @@ -420,6 +422,15 @@ public class FileDownloader extends Service mService.downloadFile(next); } } + mService.mStartedDownload=false; + (new Handler()).postDelayed(new Runnable(){ + public void run() { + if(!mService.mStartedDownload){ + mService.mNotificationManager.cancel(R.string.downloader_download_in_progress_ticker); + } + }}, 2000); + + Log_OC.d(TAG, "Stopping after command with id " + msg.arg1); mService.mNotificationManager.cancel(FOREGROUND_SERVICE_ID); mService.stopForeground(true); @@ -435,6 +446,7 @@ public class FileDownloader extends Service */ private void downloadFile(String downloadKey) { + mStartedDownload = true; mCurrentDownload = mPendingDownloads.get(downloadKey); if (mCurrentDownload != null) {