You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tasks/app/src/main/java/org/tasks/jobs/ReminderEntry.java

72 lines
1.6 KiB
Java

package org.tasks.jobs;
import static org.tasks.time.DateTimeUtils.currentTimeMillis;
import static org.tasks.time.DateTimeUtils.printTimestamp;
import org.tasks.notifications.Notification;
public class ReminderEntry implements NotificationQueueEntry {
private final long taskId;
private final long time;
private final int type;
public ReminderEntry(long taskId, long time, int type) {
this.taskId = taskId;
this.time = time;
this.type = type;
}
@Override
public long getId() {
return taskId;
}
@Override
public long getTime() {
return time;
}
@Override
public Notification toNotification() {
Notification notification = new Notification();
notification.setTaskId(taskId);
notification.setType(type);
notification.setTimestamp(currentTimeMillis());
return notification;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ReminderEntry reminderEntry = (ReminderEntry) o;
if (taskId != reminderEntry.taskId) {
return false;
}
if (time != reminderEntry.time) {
return false;
}
return type == reminderEntry.type;
}
@Override
public int hashCode() {
int result = (int) (taskId ^ (taskId >>> 32));
result = 31 * result + (int) (time ^ (time >>> 32));
result = 31 * result + type;
return result;
}
@Override
public String toString() {
return "ReminderEntry{" + "taskId=" + taskId + ", time=" + printTimestamp(time) + ", type=" + type + '}';
}
}