diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-08-22 09:30:42 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-08-22 09:30:42 +0000 |
commit | 23c76a86cb0ccb71776c13bd619155d35797a26e (patch) | |
tree | a9322ed6855203a71d0673e1074cb9ca64134244 /app/src/main/java/ml | |
parent | d864ec6d7fa92d18a5d4482fb50907c03f7731a5 (diff) | |
download | infinity-for-reddit-23c76a86cb0ccb71776c13bd619155d35797a26e.tar infinity-for-reddit-23c76a86cb0ccb71776c13bd619155d35797a26e.tar.gz infinity-for-reddit-23c76a86cb0ccb71776c13bd619155d35797a26e.tar.bz2 infinity-for-reddit-23c76a86cb0ccb71776c13bd619155d35797a26e.tar.lz infinity-for-reddit-23c76a86cb0ccb71776c13bd619155d35797a26e.tar.xz infinity-for-reddit-23c76a86cb0ccb71776c13bd619155d35797a26e.tar.zst infinity-for-reddit-23c76a86cb0ccb71776c13bd619155d35797a26e.zip |
Correctly cancel periodic work request by id not by tag. Add an initial delay which is the same time as the interval when start PullNotificationWorker in NotificationPreferenceFragment.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java index 300cd4c1..8be70369 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java @@ -319,7 +319,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG, ExistingPeriodicWorkPolicy.KEEP, pullNotificationRequest); } else { - workManager.cancelAllWorkByTag(PullNotificationWorker.WORKER_TAG); + workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG); } bindView(); @@ -345,7 +345,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG, ExistingPeriodicWorkPolicy.KEEP, pullNotificationRequest); } else { - workManager.cancelAllWorkByTag(PullNotificationWorker.WORKER_TAG); + workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG); } bindView(); @@ -375,7 +375,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe workManager.enqueueUniquePeriodicWork(PullNotificationWorker.WORKER_TAG, ExistingPeriodicWorkPolicy.KEEP, pullNotificationRequest); } else { - workManager.cancelAllWorkByTag(PullNotificationWorker.WORKER_TAG); + workManager.cancelUniqueWork(PullNotificationWorker.WORKER_TAG); } bindView(); |