fedilab-Android-App/app/src/main/java/app/fedilab/android/jobs/ApplicationJob.java

55 lines
1.9 KiB
Java
Raw Normal View History

2019-05-18 11:10:30 +02:00
package app.fedilab.android.jobs;
2017-05-05 16:36:04 +02:00
/* Copyright 2017 Thomas Schneider
*
2019-05-18 11:10:30 +02:00
* This file is a part of Fedilab
2017-05-05 16:36:04 +02:00
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
2019-05-18 11:10:30 +02:00
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
2017-05-05 16:36:04 +02:00
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
2019-05-18 11:10:30 +02:00
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
2017-05-05 16:36:04 +02:00
* see <http://www.gnu.org/licenses>. */
2019-06-11 19:38:26 +02:00
import androidx.annotation.NonNull;
2017-12-17 14:20:04 +01:00
2017-05-05 16:36:04 +02:00
import com.evernote.android.job.Job;
import com.evernote.android.job.JobCreator;
import com.evernote.android.job.JobManager;
/**
* Created by Thomas on 29/04/2017.
* Notification job
*/
public class ApplicationJob implements JobCreator {
@Override
2017-12-17 14:20:04 +01:00
public Job create(@NonNull String tag) {
2017-05-05 16:36:04 +02:00
switch (tag) {
2017-08-29 16:22:57 +02:00
case NotificationsSyncJob.NOTIFICATION_REFRESH:
return new NotificationsSyncJob();
2017-07-16 17:09:35 +02:00
case ScheduledTootsSyncJob.SCHEDULED_TOOT:
return new ScheduledTootsSyncJob();
case ScheduledBoostsSyncJob.SCHEDULED_BOOST:
return new ScheduledBoostsSyncJob();
2019-08-06 15:12:17 +02:00
case BackupStatusesSyncJob.BACKUP_SYNC:
return new BackupStatusesSyncJob();
case BackupNotificationsSyncJob.BACKUP_NOTIFICATIONS_SYNC:
return new BackupNotificationsSyncJob();
2017-05-05 16:36:04 +02:00
default:
return null;
}
}
2017-08-26 11:04:48 +02:00
@SuppressWarnings("unused")
2017-05-05 16:36:04 +02:00
public static void cancelAllJob(String TAG){
JobManager.instance().cancelAllForTag(TAG);
}
2017-07-16 17:09:35 +02:00
2017-07-17 18:53:12 +02:00
public static void cancelJob(int jobId) {
2017-07-16 17:09:35 +02:00
JobManager.instance().cancel(jobId);
}
2017-05-05 16:36:04 +02:00
}