Remove SubtaskDiffCallback

pull/996/head
Alex Baker 5 years ago
parent 61c7f2f0e8
commit 3a7d62f469

@ -1,19 +0,0 @@
package org.tasks.tasklist;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;
import org.tasks.data.TaskContainer;
class ItemCallback extends DiffUtil.ItemCallback<TaskContainer> {
@Override
public boolean areItemsTheSame(@NonNull TaskContainer oldItem, @NonNull TaskContainer newItem) {
return oldItem.getId() == newItem.getId();
}
@Override
public boolean areContentsTheSame(
@NonNull TaskContainer oldItem, @NonNull TaskContainer newItem) {
return oldItem.equals(newItem);
}
}

@ -0,0 +1,10 @@
package org.tasks.tasklist
import androidx.recyclerview.widget.DiffUtil
import org.tasks.data.TaskContainer
internal class ItemCallback : DiffUtil.ItemCallback<TaskContainer>() {
override fun areItemsTheSame(old: TaskContainer, new: TaskContainer) = old.id == new.id
override fun areContentsTheSame(old: TaskContainer, new: TaskContainer) = old == new
}

@ -1,19 +0,0 @@
package org.tasks.tasklist;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;
import org.tasks.data.TaskContainer;
class SubtaskDiffCallback extends DiffUtil.ItemCallback<TaskContainer> {
@Override
public boolean areItemsTheSame(@NonNull TaskContainer oldItem, @NonNull TaskContainer newItem) {
return oldItem.getId() == newItem.getId();
}
@Override
public boolean areContentsTheSame(
@NonNull TaskContainer oldItem, @NonNull TaskContainer newItem) {
return oldItem.equals(newItem);
}
}

@ -39,7 +39,7 @@ public class SubtasksRecyclerAdapter extends RecyclerView.Adapter<SubtaskViewHol
this.callbacks = callbacks; this.callbacks = callbacks;
differ = differ =
new AsyncListDiffer<>( new AsyncListDiffer<>(
this, new AsyncDifferConfig.Builder<>(new SubtaskDiffCallback()).build()); this, new AsyncDifferConfig.Builder<>(new ItemCallback()).build());
metrics = activity.getResources().getDisplayMetrics(); metrics = activity.getResources().getDisplayMetrics();
} }

Loading…
Cancel
Save