diff options
author | David Luhmer <david-dev@live.de> | 2021-06-27 19:50:46 +0300 |
---|---|---|
committer | David Luhmer <david-dev@live.de> | 2021-06-27 19:50:46 +0300 |
commit | 35afe7f7c4a87bc0a493f811c06a320afb02229e (patch) | |
tree | 7757b35adc6a88870760dc3e18f7089470b07f61 /News-Android-App/src/main/java | |
parent | fad4090de16d4ed89cd2aac2f783d14407f4ee54 (diff) |
ref #974 - only show a notification if it is different to the last one
Signed-off-by: David Luhmer <david-dev@live.de>
Diffstat (limited to 'News-Android-App/src/main/java')
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/authentication/OwnCloudSyncAdapter.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/authentication/OwnCloudSyncAdapter.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/authentication/OwnCloudSyncAdapter.java index 0be73b3f..9f695399 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/authentication/OwnCloudSyncAdapter.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/authentication/OwnCloudSyncAdapter.java @@ -20,6 +20,7 @@ import java.util.List; import javax.inject.Inject; +import de.luhmer.owncloudnewsreader.Constants; import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter; import de.luhmer.owncloudnewsreader.NewsReaderApplication; import de.luhmer.owncloudnewsreader.R; @@ -215,10 +216,11 @@ public class OwnCloudSyncAdapter extends AbstractThreadedSyncAdapter { private void updateNotification() { DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(getContext()); - int newItemsCount = Integer.parseInt(dbConn.getUnreadItemsCountForSpecificFolder(SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS)); - //int newItemsCount = mPrefs.getInt(Constants.LAST_UPDATE_NEW_ITEMS_COUNT_STRING, 0); + int newItemsCountLastSync = mPrefs.getInt(Constants.LAST_UPDATE_NEW_ITEMS_COUNT_STRING, 0); + + if (newItemsCountLastSync > 0) { + int newItemsCount = Integer.parseInt(dbConn.getUnreadItemsCountForSpecificFolder(SubscriptionExpandableListAdapter.SPECIAL_FOLDERS.ALL_UNREAD_ITEMS)); - if(newItemsCount > 0) { // If another app is not in foreground if (!ForegroundListener.isInForeground()) { NextcloudNotificationManager.showUnreadRssItemsNotification(getContext(), newItemsCount, mPrefs); |