use of ve.com.abicelis.remindy.model.reminder.RepeatingReminder in project Remindy by abicelis.
the class ReminderFragment method handleReminderTypeSelection.
private void handleReminderTypeSelection(int position) {
Bundle bundle = new Bundle();
mReminderType = ReminderType.values()[position];
switch(mReminderType) {
case ONE_TIME:
mReminder = (useReminderFlag ? mTask.getReminder() : new OneTimeReminder());
mFragment = new EditOneTimeReminderFragment();
bundle.putSerializable(EditRepeatingReminderFragment.REMINDER_ARGUMENT, mReminder);
mFragment.setArguments(bundle);
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_reminder_reminder_placeholder, mFragment).commit();
break;
case REPEATING:
mReminder = (useReminderFlag ? mTask.getReminder() : new RepeatingReminder());
mFragment = new EditRepeatingReminderFragment();
bundle.putSerializable(EditRepeatingReminderFragment.REMINDER_ARGUMENT, mReminder);
mFragment.setArguments(bundle);
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_reminder_reminder_placeholder, mFragment).commit();
break;
case LOCATION_BASED:
if (atLeastOnePlaceExists()) {
handleLocationBasedTaskReminderSelected();
} else
handleNoPlacesExist();
break;
case NONE:
if (mFragment != null)
getActivity().getSupportFragmentManager().beginTransaction().remove(mFragment).commit();
mFragment = null;
mReminder = null;
break;
}
//Reset flag if used
useReminderFlag = false;
}
use of ve.com.abicelis.remindy.model.reminder.RepeatingReminder in project Remindy by abicelis.
the class RemindyDAO method insertReminderOfTask.
/**
* Inserts a new Reminder into the database.
* @param taskId The id of the Task associated to the Reminder
* @param reminder The Reminder to insert
*/
public long insertReminderOfTask(int taskId, Reminder reminder) throws CouldNotInsertDataException {
SQLiteDatabase db = mDatabaseHelper.getWritableDatabase();
ContentValues values;
String tableName;
reminder.setTaskId(taskId);
switch(reminder.getType()) {
case ONE_TIME:
values = getValuesFromOneTimeReminder((OneTimeReminder) reminder);
tableName = RemindyContract.OneTimeReminderTable.TABLE_NAME;
break;
case REPEATING:
values = getValuesFromRepeatingReminder((RepeatingReminder) reminder);
tableName = RemindyContract.RepeatingReminderTable.TABLE_NAME;
break;
case LOCATION_BASED:
values = getValuesFromLocationBasedReminder((LocationBasedReminder) reminder);
tableName = RemindyContract.LocationBasedReminderTable.TABLE_NAME;
break;
default:
throw new CouldNotInsertDataException("ReminderType is invalid. Type=" + reminder.getType());
}
long newRowId;
newRowId = db.insert(tableName, null, values);
if (newRowId == -1)
throw new CouldNotInsertDataException("There was a problem inserting the Reminder: " + reminder.toString());
return newRowId;
}
Aggregations