Remove AbstractModel.containsNonNullValue

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

@ -262,20 +262,6 @@ public abstract class AbstractModel implements Parcelable, Cloneable {
return false; 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 // --- data storage
/** /**

@ -68,15 +68,6 @@ public class TimerPlugin {
task.setTimerStart(DateUtilities.now()); task.setTimerStart(DateUtilities.now());
} }
} else { } 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) { if(task.getTimerStart() > 0) {
int newElapsed = (int)((DateUtilities.now() - task.getTimerStart()) / 1000L); int newElapsed = (int)((DateUtilities.now() - task.getTimerStart()) / 1000L);
task.setTimerStart(0L); task.setTimerStart(0L);

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

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

Loading…
Cancel
Save