Add nullable annotation to googletask/caldav lists

pull/996/head
Alex Baker 4 years ago
parent b9de4ea7ef
commit 2568383a71

@ -29,11 +29,11 @@ open class CaldavTaskAdapter internal constructor(private val taskDao: TaskDao,
val newParent = changeParent(task, indent, to)
if (newParent != task.parent) {
val newPosition = if (newTasksOnTop) {
caldavDao.findFirstTask(task.caldav, newParent)
caldavDao.findFirstTask(task.caldav!!, newParent)
?.takeIf { task.creationDate.toAppleEpoch() >= it}
?.minus(1)
} else {
caldavDao.findLastTask(task.caldav, newParent)
caldavDao.findLastTask(task.caldav!!, newParent)
?.takeIf { task.creationDate.toAppleEpoch() <= it }
?.plus(1)
}

@ -53,7 +53,7 @@ open class GoogleTaskAdapter internal constructor(private val taskDao: TaskDao,
}
taskDao.touch(task.id)
if (BuildConfig.DEBUG) {
googleTaskDao.validateSorting(task.googleTaskList)
googleTaskDao.validateSorting(task.googleTaskList!!)
}
}
}

@ -31,7 +31,7 @@ class GoogleTaskManualSortAdapter internal constructor(val taskDao: TaskDao, val
}
taskDao.touch(task.id)
if (BuildConfig.DEBUG) {
googleTaskDao.validateSorting(task.googleTaskList)
googleTaskDao.validateSorting(task.googleTaskList!!)
}
}
}

@ -198,9 +198,9 @@ abstract class CaldavDao {
val previousPosition = task.caldavSortOrder
if (newPosition != null) {
if (newParent == previousParent && newPosition < previousPosition) {
shiftDown(task.caldav, newParent, newPosition, previousPosition)
shiftDown(task.caldav!!, newParent, newPosition, previousPosition)
} else {
shiftDown(task.caldav, newParent, newPosition)
shiftDown(task.caldav!!, newParent, newPosition)
}
}
caldavTask.cd_order = newPosition

@ -1,5 +1,6 @@
package org.tasks.data;
import androidx.annotation.Nullable;
import androidx.room.Embedded;
import com.todoroo.astrid.data.Task;
import java.util.Objects;
@ -21,12 +22,20 @@ public class TaskContainer {
return tags;
}
public String getGoogleTaskList() {
return googletask == null ? null : googletask.getListId();
public @Nullable String getGoogleTaskList() {
return isGoogleTask() ? googletask.getListId() : null;
}
public String getCaldav() {
return caldavTask == null ? null : caldavTask.getCd_calendar();
public boolean isGoogleTask() {
return googletask != null;
}
public @Nullable String getCaldav() {
return isCaldavTask() ? caldavTask.getCd_calendar() : null;
}
public boolean isCaldavTask() {
return caldavTask != null;
}
public String getNotes() {

Loading…
Cancel
Save