Esempio n. 1
0
  @Override
  public boolean createNew(Task item) {
    if (!item.containsValue(Task.CREATION_DATE))
      item.setValue(Task.CREATION_DATE, DateUtilities.now());
    item.setValue(Task.MODIFICATION_DATE, DateUtilities.now());

    // set up task defaults
    if (!item.containsValue(Task.IMPORTANCE))
      item.setValue(
          Task.IMPORTANCE,
          Preferences.getIntegerFromString(
              R.string.p_default_importance_key, Task.IMPORTANCE_SHOULD_DO));
    if (!item.containsValue(Task.DUE_DATE)) {
      int setting =
          Preferences.getIntegerFromString(R.string.p_default_urgency_key, Task.URGENCY_NONE);
      item.setValue(Task.DUE_DATE, Task.createDueDate(setting, 0));
    }
    createDefaultHideUntil(item);

    setDefaultReminders(item);

    ContentValues values = item.getSetValues();
    boolean result = super.createNew(item);
    if (result) {
      userRetentionMetrics();
      afterSave(item, values);
    }
    return result;
  }
Esempio n. 2
0
 @Override
 public boolean saveExisting(Task item) {
   ContentValues values = item.getSetValues();
   if (values == null || values.size() == 0) return false;
   if (!TaskApiDao.insignificantChange(values)) {
     item.setValue(Task.DETAILS, null);
     if (!values.containsKey(Task.MODIFICATION_DATE.name))
       item.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
   }
   boolean result = super.saveExisting(item);
   if (result) afterSave(item, values);
   return result;
 }