package com.monits.agilefant.model;

import java.util.concurrent.atomic.AtomicInteger;

import android.content.Context;
import android.os.SystemClock;
import android.support.v4.app.NotificationCompat;


public class NotificationHolder {

	private final static AtomicInteger GENERATED_ID = new AtomicInteger(0);

	private final Task trackedTask;

	private final int notificationId;
	private boolean isChronometerRunning;
	private long elapsedTime;
	private long chronometerBaseTime;

	private final NotificationCompat.Builder notifBuilder;

	/**
	 * Constructor
	 * @param context The context
	 * @param trackedTask The tracked task.
	 */
	public NotificationHolder(final Context context, final Task trackedTask) {
		this.notificationId = GENERATED_ID.incrementAndGet();
		this.trackedTask = trackedTask;
		notifBuilder = new NotificationCompat.Builder(context);
	}

	/**
	 * @return The notification id
	 */
	public int getNotificationId() {
		return notificationId;
	}

	/**
	 * @return The tracked task
	 */
	public Task getTrackedTask() {
		return trackedTask;
	}

	/**
	 * @return true if the chronometer is running
	 */
	public boolean isChronometerRunning() {
		return isChronometerRunning;
	}

	/**
	 * @return the chronometer base time
	 */
	public long getChronometerBaseTime() {
		return chronometerBaseTime;
	}

	/**
	 * @return the chronometer base time
	 */
	public long getElapsedTime() {
		return elapsedTime;
	}

	/**
	 * @return the notification builder
	 */
	public NotificationCompat.Builder getNotificationBuilder() {
		return notifBuilder;
	}

	/**
	 * Set the chronometer to active
	 */
	public void resume() {
		if (!isChronometerRunning) {
			isChronometerRunning = true;
			updateBase();
		}
	}

	/**
	 * Set the chronometer to paused
	 */
	public void pause() {
		if (isChronometerRunning) {
			isChronometerRunning = false;
			elapsedTime = chronometerBaseTime - SystemClock.elapsedRealtime();
		}
	}

	/**
	 * Update the chronometer base time
	 */
	public void updateBase() {
		chronometerBaseTime = SystemClock.elapsedRealtime() + elapsedTime;
	}
}

@@ -2068,11 +2068,358 @@
 Time;%0A%09%7D
+%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09return %22NotificationHolder%7B%22%0A%09%09%09%09+ %22trackedTask=%22 + trackedTask%0A%09%09%09%09+ %22, notificationId=%22 + notificationId%0A%09%09%09%09+ %22, isChronometerRunning=%22 + isChronometerRunning%0A%09%09%09%09+ %22, elapsedTime=%22 + elapsedTime%0A%09%09%09%09+ %22, chronometerBaseTime=%22 + chronometerBaseTime%0A%09%09%09%09+ %22, notifBuilder=%22 + notifBuilder%0A%09%09%09%09+ '%7D';%0A%09%7D
 %0A%7D%0A

Fix lint issues in NotificationHolder.java