Beispiel #1
0
 private static boolean showItem(final TodoItem i, final WidgetSettings s) {
   if (s.hideCompleted && i.isDone()) return false;
   final int opts = (s.showOnlyDue ? 1 : 0) << 1 | (s.showOnlyDueIn == -1 ? 0 : 1);
   final Integer dd = Util.getDueInDays(i.getDueDate());
   switch (opts) {
     case 0:
       return true;
     case 1:
       return dd != null && dd >= 0 && dd <= s.showOnlyDueIn;
     case 2:
       return dd != null && dd < 0;
     case 3:
       return dd != null && (dd < 0 || (dd <= s.showOnlyDueIn));
     default:
       return true; // unreachable
   }
 }
Beispiel #2
0
  private static int getItemColor(
      final int defaultColor,
      final int completedColor,
      final int dueTodayColor,
      final int expiredColor,
      final TodoItem i) {
    if (i.isDone()) return completedColor;

    switch (Util.getDueStatus(i.getDueDate())) {
      case EXPIRED:
        return expiredColor;
      case TODAY:
        return dueTodayColor;
      default:
        return defaultColor;
    }
  }