Example usage for org.joda.time LocalDate LocalDate

List of usage examples for org.joda.time LocalDate LocalDate

Introduction

In this page you can find the example usage for org.joda.time LocalDate LocalDate.

Prototype

public LocalDate() 

Source Link

Document

Constructs an instance set to the current local time evaluated using ISO chronology in the default zone.

Usage

From source file:de.azapps.mirakel.helper.TaskHelper.java

License:Open Source License

/**
 * Returns the ID of the ColorResource for a DueDate
 * /*  ww w .j a  v  a2 s .co m*/
 * @param origDue
 *            The DueDate
 * @param isDone
 *            Is the Task done?
 * @return ID of the ColorResource
 */
public static int getTaskDueColor(Calendar origDue, boolean isDone) {
    if (origDue == null)
        return R.color.Grey;
    LocalDate today = new LocalDate();
    LocalDate nextWeek = new LocalDate().plusDays(7);
    LocalDate due = new LocalDate(origDue);
    int cmpr = today.compareTo(due);
    int color;
    if (isDone) {
        color = R.color.Grey;
    } else if (cmpr > 0) {
        color = R.color.Red;
    } else if (cmpr == 0) {
        color = R.color.Orange;
    } else if (nextWeek.compareTo(due) >= 0) {
        color = R.color.Yellow;
    } else {
        color = R.color.Green;
    }
    return color;
}