Search in sources :

Example 21 with Task

use of ve.com.abicelis.remindy.model.Task in project Remindy by abicelis.

the class HomeListFragment method updateViewholderItem.

/* Called from HomeActivity.onActivityResult() */
public void updateViewholderItem(int position) {
    //Task was edited, refresh task info and refresh recycler
    try {
        Task task = mDao.getTask(mTasks.get(position).getTask().getId());
        TaskViewModel taskViewModel = new TaskViewModel(task, ConversionUtil.taskReminderTypeToTaskViewmodelType(task.getReminderType()));
        mTasks.set(position, taskViewModel);
        mAdapter.notifyItemChanged(position);
    } catch (CouldNotGetDataException e) {
        SnackbarUtil.showSnackbar(mRecyclerView, SnackbarUtil.SnackbarType.ERROR, R.string.error_problem_updating_task_from_database, SnackbarUtil.SnackbarDuration.LONG, null);
    }
}
Also used : Task(ve.com.abicelis.remindy.model.Task) CouldNotGetDataException(ve.com.abicelis.remindy.exception.CouldNotGetDataException) TaskViewModel(ve.com.abicelis.remindy.viewmodel.TaskViewModel)

Aggregations

Task (ve.com.abicelis.remindy.model.Task)21 CouldNotGetDataException (ve.com.abicelis.remindy.exception.CouldNotGetDataException)12 ArrayList (java.util.ArrayList)10 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)9 TaskViewModel (ve.com.abicelis.remindy.viewmodel.TaskViewModel)8 Cursor (android.database.Cursor)7 RemindyDAO (ve.com.abicelis.remindy.database.RemindyDAO)4 CouldNotDeleteDataException (ve.com.abicelis.remindy.exception.CouldNotDeleteDataException)3 OneTimeReminder (ve.com.abicelis.remindy.model.reminder.OneTimeReminder)3 RepeatingReminder (ve.com.abicelis.remindy.model.reminder.RepeatingReminder)3 TaskSortingUtil (ve.com.abicelis.remindy.util.sorting.TaskSortingUtil)3 NotificationManager (android.app.NotificationManager)2 SQLiteConstraintException (android.database.sqlite.SQLiteConstraintException)2 Calendar (java.util.Calendar)2 CouldNotUpdateDataException (ve.com.abicelis.remindy.exception.CouldNotUpdateDataException)2 Time (ve.com.abicelis.remindy.model.Time)2 AlertDialog (android.app.AlertDialog)1 PendingIntent (android.app.PendingIntent)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1