Exemplo n.º 1
0
  @Override
  protected void refreshDisplayView() {
    StringBuilder displayString = new StringBuilder();
    boolean isOverdue;
    if (initialized) {
      isOverdue = !dateAndTimePicker.isAfterNow();
      displayString.append(dateAndTimePicker.getDisplayString(activity, isQuickadd, isQuickadd));
    } else {
      isOverdue = model.getValue(Task.DUE_DATE) < DateUtilities.now();
      displayString.append(
          DateAndTimePicker.getDisplayString(
              activity, model.getValue(Task.DUE_DATE), isQuickadd, isQuickadd, false));
    }

    if (!isQuickadd && repeatControlSet != null) {
      String repeatString = repeatControlSet.getStringForExternalDisplay();
      if (!TextUtils.isEmpty(repeatString)) {
        displayString.append("\n"); // $NON-NLS-1$
        displayString.append(repeatString);
      }
    }
    TextView dateDisplay = (TextView) getDisplayView().findViewById(R.id.display_row_edit);
    if (TextUtils.isEmpty(displayString)) {
      dateDisplay.setText(R.string.TEA_deadline_hint);
      dateDisplay.setTextColor(unsetColor);
      image.setImageResource(R.drawable.tea_icn_date_gray);
    } else {
      dateDisplay.setText(displayString);
      if (isOverdue) {
        dateDisplay.setTextColor(activity.getResources().getColor(R.color.red_theme_color));
        image.setImageResource(R.drawable.tea_icn_date_red);
      } else {
        dateDisplay.setTextColor(themeColor);
        image.setImageResource(
            ThemeService.getTaskEditDrawable(
                R.drawable.tea_icn_date, R.drawable.tea_icn_date_lightblue));
      }
    }
  }
Exemplo n.º 2
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);
    }
  }