summaryrefslogtreecommitdiff
path: root/org.fox.ttrss/src/main/java
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-10-31 15:19:17 +0300
committerAndrew Dolgov <[email protected]>2017-10-31 15:19:17 +0300
commit4ba749a628afc225c2804001e58529c7b70cc59d (patch)
treeea8bf52cf3b9292a7a9c60faf85fe187dc960458 /org.fox.ttrss/src/main/java
parent5ccf2e8a7e9fe15630c6e9c0bbf69873af40e184 (diff)
image cache service: show progressbar in notification
Diffstat (limited to 'org.fox.ttrss/src/main/java')
-rw-r--r--org.fox.ttrss/src/main/java/org/fox/ttrss/util/ImageCacheService.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/ImageCacheService.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/ImageCacheService.java
index acbe7f63..97949c93 100644
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/ImageCacheService.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/ImageCacheService.java
@@ -49,7 +49,8 @@ public class ImageCacheService extends IntentService {
private NotificationManager m_nmgr;
private BroadcastReceiver m_receiver;
-
+ private int m_queueSize = 0;
+
public ImageCacheService() {
super("ImageCacheService");
}
@@ -228,10 +229,21 @@ public class ImageCacheService extends IntentService {
/* private void updateNotification(int msgResId) {
updateNotification(getString(msgResId));
} */
-
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+
+ m_queueSize++;
+
+ return super.onStartCommand(intent, flags, startId);
+ }
+
@Override
protected void onHandleIntent(Intent intent) {
+ m_queueSize--;
+ m_imagesDownloaded++;
+
String url = intent.getStringExtra("url");
Log.d(TAG, "got request to download URL=" + url + "; canProceed=" + m_canProceed);
@@ -266,10 +278,9 @@ public class ImageCacheService extends IntentService {
fos.close();
is.close();
-
- m_imagesDownloaded++;
-
- updateNotification(getString(R.string.notify_downloading_images, m_imagesDownloaded), 0, 0, true);
+
+ updateNotification(getString(R.string.notify_downloading_media), m_imagesDownloaded,
+ m_imagesDownloaded+m_queueSize, true);
} catch (IOException e) {
e.printStackTrace();