Beispiel #1
0
 @Override
 protected void readFromTaskOnInitialize() {
   setValue(model.getValue(Task.REMINDER_FLAGS));
   // Calls to get view will force other control sets to load
   randomControlSet.readFromTask(model);
   randomControlSet.readFromTaskOnInitialize();
 }
Beispiel #2
0
  @Override
  protected String writeToModelAfterInitialized(Task task) {
    task.setValue(Task.REMINDER_FLAGS, getValue());

    randomControlSet.writeToModel(task);
    alarmControl.writeToModel(task);
    return null;
  }
Beispiel #3
0
  @Override
  protected void refreshDisplayView() {
    int reminderCount = 0;
    StringBuilder reminderString = new StringBuilder();

    // Has random reminder?
    if ((randomControlSet != null && randomControlSet.hasRandomReminder())
        || (randomControlSet == null && model.getValue(Task.REMINDER_PERIOD) > 0)) {
      reminderString.append(activity.getString(R.string.TEA_reminder_randomly_short));
      reminderCount++;
    }

    int value;
    if (initialized) {
      value = getValue();
    } else {
      value = model.getValue(Task.REMINDER_FLAGS);
    }

    boolean appendedWhen = false;
    if ((value & Task.NOTIFY_AT_DEADLINE) > 0) {
      if (reminderCount > 0) {
        reminderString.append(" & "); // $NON-NLS-1$
      }

      reminderString
          .append(activity.getString(R.string.TEA_reminder_when))
          .append(" "); // $NON-NLS-1$
      reminderString.append(activity.getString(R.string.TEA_reminder_due_short));
      reminderCount++;
      appendedWhen = true;
    }

    if ((value & Task.NOTIFY_AFTER_DEADLINE) > 0 && reminderCount < 2) {
      if (reminderCount > 0) {
        reminderString.append(" & "); // $NON-NLS-1$
      }

      if (!appendedWhen) {
        reminderString
            .append(activity.getString(R.string.TEA_reminder_when))
            .append(" "); // $NON-NLS-1$
      }
      reminderString.append(activity.getString(R.string.TEA_reminder_overdue_short));
      reminderCount++;
    }

    if (reminderCount > 0) {
      String toDisplay;
      if (reminderCount == 1) {
        toDisplay =
            activity.getString(R.string.TEA_reminder_display_one, reminderString.toString());
      } else {
        toDisplay =
            activity.getString(R.string.TEA_reminder_display_multiple, reminderString.toString());
      }

      label.setText(toDisplay);
      label.setTextColor(themeColor);
      image.setImageResource(
          ThemeService.getTaskEditDrawable(
              R.drawable.tea_icn_reminder, R.drawable.tea_icn_reminder_lightblue));
    } else {
      label.setText(R.string.TEA_reminders_group_label);
      label.setTextColor(unsetColor);
      image.setImageResource(R.drawable.tea_icn_reminder_gray);
    }
  }