Remove AbstractModel.containsNonNullValue

pull/618/head
Alex Baker 6 years ago
parent 6cc5bcac14
commit c46ceb366f

@ -262,20 +262,6 @@ public abstract class AbstractModel implements Parcelable, Cloneable {
return false;
}
/**
* @return true if setValues or values contains this property, and the value
* stored is not null
*/
public boolean containsNonNullValue(Property<?> property) {
if(setValues != null && setValues.containsKey(property.getColumnName())) {
return setValues.get(property.getColumnName()) != null;
}
if(values != null && values.containsKey(property.getColumnName())) {
return values.get(property.getColumnName()) != null;
}
return false;
}
// --- data storage
/**

@ -68,15 +68,6 @@ public class TimerPlugin {
task.setTimerStart(DateUtilities.now());
}
} else {
// if this call comes from tasklist, then we need to fill in the gaps to handle this correctly
// this is needed just for stopping a task
if (!task.containsNonNullValue(Task.TIMER_START)) {
task = taskDao.fetch(task.getId());
}
if (task == null) {
return;
}
if(task.getTimerStart() > 0) {
int newElapsed = (int)((DateUtilities.now() - task.getTimerStart()) / 1000L);
task.setTimerStart(0L);

@ -7,6 +7,7 @@ package com.todoroo.astrid.utility;
import android.text.TextUtils;
import com.google.common.base.Strings;
import com.google.ical.values.Frequency;
import com.google.ical.values.RRule;
import com.mdimension.jchronic.AstridChronic;
@ -165,7 +166,7 @@ public class TitleParser {
//Day of week (e.g. Monday, Tuesday,..) is overridden by a set date (e.g. October 23 2013).
//Vague times (e.g. breakfast, night) are overridden by a set time (9 am, at 10, 17:00)
private static boolean dayHelper(Task task ) {
if (task.containsNonNullValue(Task.DUE_DATE)) {
if (task.getDueDate() > 0) {
return false;
}
String inputText = task.getTitle();
@ -372,7 +373,7 @@ public class TitleParser {
//Parses through the text and sets the frequency of the task.
private static boolean repeatHelper(Task task) {
if (task.containsNonNullValue(Task.RECURRENCE)) {
if (!Strings.isNullOrEmpty(task.getRecurrence())) {
return false;
}
String inputText = task.getTitle();

@ -8,7 +8,6 @@ import android.provider.CalendarContract;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
import org.tasks.injection.ForApplication;
@ -35,17 +34,14 @@ public class CalendarEventProvider {
};
private final ContentResolver contentResolver;
private final TaskDao taskDao;
private final PermissionChecker permissionChecker;
private final CalendarEventAttendeeProvider calendarEventAttendeeProvider;
@Inject
public CalendarEventProvider(@ForApplication Context context, PermissionChecker permissionChecker,
CalendarEventAttendeeProvider calendarEventAttendeeProvider,
TaskDao taskDao) {
CalendarEventAttendeeProvider calendarEventAttendeeProvider) {
this.permissionChecker = permissionChecker;
this.calendarEventAttendeeProvider = calendarEventAttendeeProvider;
this.taskDao = taskDao;
contentResolver = context.getContentResolver();
}
@ -63,12 +59,6 @@ public class CalendarEventProvider {
}
public boolean deleteEvent(Task task) {
if (!task.containsNonNullValue(Task.CALENDAR_URI)) {
task = taskDao.fetch(task.getId());
if(task == null) {
return false;
}
}
String uri = task.getCalendarURI();
task.setCalendarUri("");
return deleteEvent(uri);

Loading…
Cancel
Save