Remove swiping code

pull/820/head
Alex Baker 5 years ago
parent c16e0bc6b1
commit ea33eed50a

@ -77,20 +77,6 @@ public final class AstridTaskAdapter extends TaskAdapter {
}
}
@Override
public void swiped(int which, int delta) {
String targetTaskId = getItemUuid(which);
if (!Task.isValidUuid(targetTaskId)) {
return; // This can happen with gestures on empty parts of the list (e.g. extra space below
// tasks)
}
try {
updater.indent(list, filter, targetTaskId, delta);
} catch (Exception e) {
Timber.e(e);
}
}
@Override
public void onTaskCreated(String uuid) {
updater.onCreateTask(list, filter, uuid);

@ -113,8 +113,4 @@ public final class GoogleTaskAdapter extends TaskAdapter {
googleTaskDao.validateSorting(task.getGoogleTaskList());
}
}
@Override
public void swiped(int which, int delta) {
}
}

@ -87,8 +87,6 @@ public class TaskAdapter {
public void moved(int from, int to, int indent) {}
public void swiped(int position, int delta) {}
public TaskContainer getTask(int position) {
return helper.getItem(position);
}

@ -20,7 +20,6 @@ public class ItemTouchHelperCallback extends ItemTouchHelper.Callback {
private int from = -1;
private int to = -1;
private boolean dragging;
private boolean swiping;
ItemTouchHelperCallback(
TaskAdapter adapter, TaskListRecyclerAdapter recyclerAdapter, Runnable onClear) {
@ -38,9 +37,6 @@ public class ItemTouchHelperCallback extends ItemTouchHelper.Callback {
dragging = true;
int position = viewHolder.getAdapterPosition();
updateIndents((ViewHolder) viewHolder, position, position);
} else if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
((ViewHolder) viewHolder).setSwiping(true);
swiping = true;
}
}
@ -133,9 +129,7 @@ public class ItemTouchHelperCallback extends ItemTouchHelper.Callback {
super.clearView(recyclerView, viewHolder);
ViewHolder vh = (ViewHolder) viewHolder;
vh.setMoving(false);
vh.setSwiping(false);
dragging = false;
swiping = false;
onClear.run();
if (recyclerAdapter.isActionModeActive()) {
recyclerAdapter.toggle(vh);
@ -163,19 +157,10 @@ public class ItemTouchHelperCallback extends ItemTouchHelper.Callback {
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
ViewHolder vh = (ViewHolder) viewHolder;
vh.setSwiping(false);
swiping = false;
int delta = direction == ItemTouchHelper.RIGHT ? 1 : -1;
int position = viewHolder.getAdapterPosition();
recyclerAdapter.swiped(position, delta);
throw new UnsupportedOperationException();
}
boolean isDragging() {
return dragging;
}
boolean isSwiping() {
return swiping;
}
}

@ -99,7 +99,7 @@ public class TaskListRecyclerAdapter extends RecyclerView.Adapter<ViewHolder>
updates.add(update);
if (!itemTouchHelperCallback.isDragging() && !itemTouchHelperCallback.isSwiping()) {
if (!itemTouchHelperCallback.isDragging()) {
drainQueue();
}
}
@ -264,8 +264,4 @@ public class TaskListRecyclerAdapter extends RecyclerView.Adapter<ViewHolder>
list.add(from < to ? to - 1 : to, task);
taskList.loadTaskListContent();
}
void swiped(int position, int delta) {
adapter.swiped(position, delta);
}
}

@ -83,7 +83,6 @@ public class ViewHolder extends RecyclerView.ViewHolder {
private boolean selected;
private boolean moving;
private boolean isGoogleTaskList;
private boolean swiping;
private int minIndent;
private int maxIndent;
@ -331,14 +330,6 @@ public class ViewHolder extends RecyclerView.ViewHolder {
return indent;
}
void setSwiping(boolean swiping) {
this.swiping = swiping;
}
boolean isSwiping() {
return swiping;
}
void setMinIndent(int minIndent) {
this.minIndent = minIndent;
if (task.getTargetIndent() < minIndent) {

Loading…
Cancel
Save