Update support, room, and paging libraries

pull/699/head
Alex Baker 6 years ago
parent b356f4cbe3
commit 575be78f9c

@ -107,9 +107,9 @@ configurations {
final DAGGER_VERSION = '2.9'
final BUTTERKNIFE_VERSION = '8.8.1'
final GPS_VERSION = '11.8.0'
final SUPPORT_VERSION = '27.0.2'
final SUPPORT_VERSION = '27.1.0'
final ROOM_VERSION = '1.1.0-beta1'
final STETHO_VERSION = '1.5.0'
final ROOM_VERSION = '1.0.0'
final TESTING_SUPPORT_VERSION = '1.0.0'
dependencies {
@ -121,8 +121,9 @@ dependencies {
implementation "android.arch.persistence.room:rxjava2:${ROOM_VERSION}"
annotationProcessor "android.arch.persistence.room:compiler:${ROOM_VERSION}"
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation "io.reactivex.rxjava2:rxandroid:2.0.1"
implementation "android.arch.paging:runtime:1.0.0-alpha5"
implementation "android.arch.paging:runtime:1.0.0-alpha7"
annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTERKNIFE_VERSION}"
implementation "com.jakewharton:butterknife:${BUTTERKNIFE_VERSION}"

@ -9,7 +9,7 @@ package com.todoroo.astrid.adapter;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.primitives.Longs.asList;
import android.arch.paging.PagedListAdapterHelper;
import android.arch.paging.AsyncPagedListDiffer;
import com.google.common.collect.ObjectArrays;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.LongProperty;
@ -39,7 +39,7 @@ public class TaskAdapter {
TAGS, // Concatenated list of tags
FILE_ID_PROPERTY // File id
}, Property.class);
private PagedListAdapterHelper<Task> helper;
private AsyncPagedListDiffer<Task> helper;
private Set<Long> selected = new HashSet<>();
private OnCompletedTaskListener onCompletedTaskListener = null;
@ -47,7 +47,7 @@ public class TaskAdapter {
return helper.getItemCount();
}
public void setHelper(PagedListAdapterHelper<Task> helper) {
public void setHelper(AsyncPagedListDiffer<Task> helper) {
this.helper = helper;
}

@ -1,10 +1,11 @@
package org.tasks.tasklist;
import android.support.annotation.NonNull;
import android.support.v7.util.DiffUtil.ItemCallback;
import com.todoroo.astrid.adapter.TaskAdapter;
import com.todoroo.astrid.data.Task;
public class DiffCallback extends android.support.v7.recyclerview.extensions.DiffCallback<Task> {
public class DiffCallback extends ItemCallback<Task> {
private final TaskAdapter adapter;

@ -1,11 +1,11 @@
package org.tasks.tasklist;
import android.app.Activity;
import android.arch.paging.AsyncPagedListDiffer;
import android.arch.paging.PagedList;
import android.arch.paging.PagedListAdapterHelper;
import android.graphics.Canvas;
import android.os.Bundle;
import android.support.v7.recyclerview.extensions.ListAdapterConfig;
import android.support.v7.recyclerview.extensions.AsyncDifferConfig;
import android.support.v7.util.ListUpdateCallback;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.RecyclerView;
@ -44,7 +44,7 @@ public class TaskListRecyclerAdapter extends RecyclerView.Adapter<ViewHolder>
private final Tracker tracker;
private final DialogBuilder dialogBuilder;
private final ItemTouchHelper itemTouchHelper;
private final PagedListAdapterHelper<Task> adapterHelper;
private final AsyncPagedListDiffer<Task> adapterHelper;
private ActionMode mode = null;
private boolean dragging;
@ -107,8 +107,8 @@ public class TaskListRecyclerAdapter extends RecyclerView.Adapter<ViewHolder>
this.tracker = tracker;
this.dialogBuilder = dialogBuilder;
itemTouchHelper = new ItemTouchHelper(new ItemTouchHelperCallback());
adapterHelper = new PagedListAdapterHelper<>(this,
new ListAdapterConfig.Builder<Task>().setDiffCallback(new DiffCallback(adapter)).build());
adapterHelper = new AsyncPagedListDiffer<>(this,
new AsyncDifferConfig.Builder<>(new DiffCallback(adapter)).build());
}
public void applyToRecyclerView(RecyclerView recyclerView) {
@ -263,14 +263,14 @@ public class TaskListRecyclerAdapter extends RecyclerView.Adapter<ViewHolder>
}
public void setList(PagedList<Task> list) {
adapterHelper.setList(list);
adapterHelper.submitList(list);
}
public void setAnimate(boolean animate) {
this.animate = animate;
}
public PagedListAdapterHelper<Task> getHelper() {
public AsyncPagedListDiffer<Task> getHelper() {
return adapterHelper;
}

Loading…
Cancel
Save