Android Open Source - TaskButler Task Butler Service






From Project

Back to project page TaskButler.

License

The source code is released under:

GNU General Public License

If you think the Android project TaskButler listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * TasksBatlerService.java//from ww w .j a v  a2  s .  co m
 * 
 * Copyright 2012 Jonathan Hasenzahl, James Celona, Dhimitraq Jorgji
 * 
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package edu.worcester.cs499summer2012.service;

import java.util.List;

import android.content.Intent;

import edu.worcester.cs499summer2012.database.TasksDataSource;
import edu.worcester.cs499summer2012.task.Task;

/**
 * An IntentService that takes care of setting up alarms for Task Butler
 * to remind the user of upcoming events
 * @author Dhimitraq Jorgji
 *
 */
public class TaskButlerService extends WakefulIntentService{

  public TaskButlerService() {
    super("TaskButlerService");
  }
  
  @Override
  protected void onHandleIntent(Intent intent) {
    TasksDataSource db = TasksDataSource.getInstance(this); //get access to the instance of TasksDataSource
    TaskAlarm alarm = new TaskAlarm();


    List<Task> tasks = db.getAllTasks(); //Get a list of all the tasks there
    for (Task task : tasks) {
      // Cancel existing alarm
      alarm.cancelAlarm(this, task.getID());
      
      //Procrastinator and Reminder alarm
      if(task.isPastDue()){
        alarm.setReminder(this, task.getID());
      }
      
      //handle repeat alarms
      if(task.isRepeating() && task.isCompleted()){
        task = alarm.setRepeatingAlarm(this, task.getID());
      }
      
      //regular alarms
      if(!task.isCompleted() && (task.getDateDue() >= System.currentTimeMillis())){
        alarm.setAlarm(this, task);  
      }
    }
    super.onHandleIntent(intent);
  }
}




Java Source Code List

edu.worcester.cs499summer2012.activity.AddTaskActivity.java
edu.worcester.cs499summer2012.activity.BaseTaskActivity.java
edu.worcester.cs499summer2012.activity.CustomSortActivity.java
edu.worcester.cs499summer2012.activity.EditCategoriesActivity.java
edu.worcester.cs499summer2012.activity.EditTaskActivity.java
edu.worcester.cs499summer2012.activity.MainActivity.java
edu.worcester.cs499summer2012.activity.SettingsActivity.java
edu.worcester.cs499summer2012.activity.ViewTaskActivity.java
edu.worcester.cs499summer2012.adapter.CategoryListAdapter.java
edu.worcester.cs499summer2012.adapter.ComparatorListAdapter.java
edu.worcester.cs499summer2012.adapter.PriorityListAdapter.java
edu.worcester.cs499summer2012.adapter.TaskListAdapter.java
edu.worcester.cs499summer2012.comparator.TaskAutoComparator.java
edu.worcester.cs499summer2012.comparator.TaskCategoryComparator.java
edu.worcester.cs499summer2012.comparator.TaskCompletionComparator.java
edu.worcester.cs499summer2012.comparator.TaskDateCreatedComparator.java
edu.worcester.cs499summer2012.comparator.TaskDateDueComparator.java
edu.worcester.cs499summer2012.comparator.TaskDateModifiedComparator.java
edu.worcester.cs499summer2012.comparator.TaskNameComparator.java
edu.worcester.cs499summer2012.comparator.TaskPriorityComparator.java
edu.worcester.cs499summer2012.database.DatabaseHandler.java
edu.worcester.cs499summer2012.database.TasksDataSource.java
edu.worcester.cs499summer2012.service.NotificationHelper.java
edu.worcester.cs499summer2012.service.OnAlarmReceiver.java
edu.worcester.cs499summer2012.service.OnBootReceiver.java
edu.worcester.cs499summer2012.service.TaskAlarm.java
edu.worcester.cs499summer2012.service.TaskButlerService.java
edu.worcester.cs499summer2012.service.TaskButlerWidgetProvider.java
edu.worcester.cs499summer2012.service.WakefulIntentService.java
edu.worcester.cs499summer2012.task.BackupManager.java
edu.worcester.cs499summer2012.task.Category.java
edu.worcester.cs499summer2012.task.Comparator.java
edu.worcester.cs499summer2012.task.Task.java
edu.worcester.cs499summer2012.task.ToastMaker.java