mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
Java
42 lines
1.1 KiB
Java
package org.tasks.jobs;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.support.v4.app.JobIntentService;
|
|
|
|
import org.tasks.LocalBroadcastManager;
|
|
import org.tasks.injection.IntentServiceComponent;
|
|
|
|
import javax.inject.Inject;
|
|
|
|
public class MidnightRefreshJob extends MidnightJob {
|
|
|
|
public static class Broadcast extends BroadcastReceiver {
|
|
@Override
|
|
public void onReceive(Context context, Intent intent) {
|
|
JobIntentService.enqueueWork(context, MidnightRefreshJob.class, JobManager.JOB_ID_MIDNIGHT_REFRESH, intent);
|
|
}
|
|
}
|
|
|
|
public static final String TAG = "job_midnight_refresh";
|
|
|
|
@Inject LocalBroadcastManager localBroadcastManager;
|
|
@Inject JobManager jobManager;
|
|
|
|
@Override
|
|
protected void run() {
|
|
localBroadcastManager.broadcastRefresh();
|
|
}
|
|
|
|
@Override
|
|
protected void scheduleNext() {
|
|
jobManager.scheduleMidnightRefresh();
|
|
}
|
|
|
|
@Override
|
|
protected void inject(IntentServiceComponent component) {
|
|
component.inject(this);
|
|
}
|
|
}
|