use of ve.com.abicelis.remindy.enums.ReminderRepeatEndType in project Remindy by abicelis.
the class RemindyDAO method getRepeatingReminderFromCursor.
private RepeatingReminder getRepeatingReminderFromCursor(Cursor cursor) {
int id = cursor.getInt(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable._ID));
int taskId = cursor.getInt(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable.COLUMN_NAME_TASK_FK.getName()));
Calendar date = Calendar.getInstance();
date.setTimeInMillis(cursor.getLong(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable.COLUMN_NAME_DATE.getName())));
Time time = new Time(cursor.getInt(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable.COLUMN_NAME_TIME.getName())));
time.setDisplayTimeFormat(SharedPreferenceUtil.getTimeFormat(mContext));
ReminderRepeatType repeatType = ReminderRepeatType.valueOf(cursor.getString(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable.COLUMN_NAME_REPEAT_TYPE.getName())));
int repeatInterval = cursor.getInt(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable.COLUMN_NAME_REPEAT_INTERVAL.getName()));
ReminderRepeatEndType repeatEndType = ReminderRepeatEndType.valueOf(cursor.getString(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable.COLUMN_NAME_REPEAT_END_TYPE.getName())));
int repeatEndNumberOfEvents = -1;
if (repeatEndType == ReminderRepeatEndType.FOR_X_EVENTS)
repeatEndNumberOfEvents = cursor.getInt(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable.COLUMN_NAME_REPEAT_END_NUMBER_OF_EVENTS.getName()));
Calendar repeatEndDate = null;
if (repeatEndType == ReminderRepeatEndType.UNTIL_DATE) {
repeatEndDate = Calendar.getInstance();
repeatEndDate.setTimeInMillis(cursor.getLong(cursor.getColumnIndex(RemindyContract.RepeatingReminderTable.COLUMN_NAME_REPEAT_END_DATE.getName())));
}
return new RepeatingReminder(id, taskId, date, time, repeatType, repeatInterval, repeatEndType, repeatEndNumberOfEvents, repeatEndDate);
}
Aggregations