From c7b7e13768606a7d8ca06faafd17b43ee43f95fe Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Wed, 3 Jul 2019 14:52:03 -0500 Subject: [PATCH] Embed CaldavTask in TaskContainer --- .../main/java/org/tasks/data/TaskContainer.java | 17 ++++++++--------- .../tasks/tasklist/TaskListRecyclerAdapter.java | 7 ++++--- .../java/org/tasks/tasklist/ViewHolder.java | 10 +++++----- .../java/org/tasks/ui/TaskListViewModel.java | 3 +-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/org/tasks/data/TaskContainer.java b/app/src/main/java/org/tasks/data/TaskContainer.java index 2980663d8..9b16a8a89 100644 --- a/app/src/main/java/org/tasks/data/TaskContainer.java +++ b/app/src/main/java/org/tasks/data/TaskContainer.java @@ -6,9 +6,9 @@ import com.todoroo.astrid.data.Task; public class TaskContainer { @Embedded public Task task; @Embedded public GoogleTask googletask; + @Embedded public CaldavTask caldavTask; @Embedded public Location location; public String tags; - public String caldav; public int children; public int siblings; public long primarySort; @@ -25,7 +25,7 @@ public class TaskContainer { } public String getCaldav() { - return caldav; + return caldavTask == null ? null : caldavTask.getCalendar(); } public String getNotes() { @@ -131,22 +131,22 @@ public class TaskContainer { if (googletask != null ? !googletask.equals(that.googletask) : that.googletask != null) { return false; } - if (location != null ? !location.equals(that.location) : that.location != null) { + if (caldavTask != null ? !caldavTask.equals(that.caldavTask) : that.caldavTask != null) { return false; } - if (tags != null ? !tags.equals(that.tags) : that.tags != null) { + if (location != null ? !location.equals(that.location) : that.location != null) { return false; } - return caldav != null ? caldav.equals(that.caldav) : that.caldav == null; + return tags != null ? tags.equals(that.tags) : that.tags == null; } @Override public int hashCode() { int result = task != null ? task.hashCode() : 0; result = 31 * result + (googletask != null ? googletask.hashCode() : 0); + result = 31 * result + (caldavTask != null ? caldavTask.hashCode() : 0); result = 31 * result + (location != null ? location.hashCode() : 0); result = 31 * result + (tags != null ? tags.hashCode() : 0); - result = 31 * result + (caldav != null ? caldav.hashCode() : 0); result = 31 * result + children; result = 31 * result + siblings; result = 31 * result + (int) (primarySort ^ (primarySort >>> 32)); @@ -163,14 +163,13 @@ public class TaskContainer { + task + ", googletask=" + googletask + + ", caldavTask=" + + caldavTask + ", location=" + location + ", tags='" + tags + '\'' - + ", caldav='" - + caldav - + '\'' + ", children=" + children + ", siblings=" diff --git a/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java b/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java index bb4f96d2a..83c0ea4ef 100644 --- a/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java +++ b/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java @@ -11,6 +11,7 @@ import androidx.recyclerview.widget.ListUpdateCallback; import androidx.recyclerview.widget.RecyclerView; import com.todoroo.astrid.activity.TaskListFragment; import com.todoroo.astrid.adapter.TaskAdapter; +import com.todoroo.astrid.api.CaldavFilter; import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.GtasksFilter; import com.todoroo.astrid.utility.Flags; @@ -27,7 +28,7 @@ public abstract class TaskListRecyclerAdapter extends RecyclerView.Adapter chips = chipProvider.getChips( context, - task.getCaldav(), - isGoogleTaskList ? null : task.getGoogleTaskList(), + isRemoteList ? null : task.getCaldav(), + isRemoteList ? null : task.getGoogleTaskList(), tagUuids); if (chips.isEmpty()) { chipGroup.setVisibility(View.GONE); diff --git a/app/src/main/java/org/tasks/ui/TaskListViewModel.java b/app/src/main/java/org/tasks/ui/TaskListViewModel.java index e7c767384..333aa3995 100644 --- a/app/src/main/java/org/tasks/ui/TaskListViewModel.java +++ b/app/src/main/java/org/tasks/ui/TaskListViewModel.java @@ -56,8 +56,7 @@ public class TaskListViewModel extends ViewModel implements Observer