From ea33eed50a570d8e1810518d950afcda4fadebd0 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Fri, 7 Jun 2019 13:34:35 -0500 Subject: [PATCH] Remove swiping code --- .../astrid/adapter/AstridTaskAdapter.java | 14 -------------- .../astrid/adapter/GoogleTaskAdapter.java | 4 ---- .../com/todoroo/astrid/adapter/TaskAdapter.java | 2 -- .../tasks/tasklist/ItemTouchHelperCallback.java | 17 +---------------- .../tasks/tasklist/TaskListRecyclerAdapter.java | 6 +----- .../java/org/tasks/tasklist/ViewHolder.java | 9 --------- 6 files changed, 2 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/com/todoroo/astrid/adapter/AstridTaskAdapter.java b/app/src/main/java/com/todoroo/astrid/adapter/AstridTaskAdapter.java index 64aa066c0..de5d07b5a 100644 --- a/app/src/main/java/com/todoroo/astrid/adapter/AstridTaskAdapter.java +++ b/app/src/main/java/com/todoroo/astrid/adapter/AstridTaskAdapter.java @@ -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); diff --git a/app/src/main/java/com/todoroo/astrid/adapter/GoogleTaskAdapter.java b/app/src/main/java/com/todoroo/astrid/adapter/GoogleTaskAdapter.java index 6159f0f3f..49b3501f1 100644 --- a/app/src/main/java/com/todoroo/astrid/adapter/GoogleTaskAdapter.java +++ b/app/src/main/java/com/todoroo/astrid/adapter/GoogleTaskAdapter.java @@ -113,8 +113,4 @@ public final class GoogleTaskAdapter extends TaskAdapter { googleTaskDao.validateSorting(task.getGoogleTaskList()); } } - - @Override - public void swiped(int which, int delta) { - } } diff --git a/app/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java b/app/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java index 6d56722bd..bcab58c1e 100644 --- a/app/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java +++ b/app/src/main/java/com/todoroo/astrid/adapter/TaskAdapter.java @@ -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); } diff --git a/app/src/main/java/org/tasks/tasklist/ItemTouchHelperCallback.java b/app/src/main/java/org/tasks/tasklist/ItemTouchHelperCallback.java index 92079ebe6..b7ea44eb2 100644 --- a/app/src/main/java/org/tasks/tasklist/ItemTouchHelperCallback.java +++ b/app/src/main/java/org/tasks/tasklist/ItemTouchHelperCallback.java @@ -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; - } } diff --git a/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java b/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java index 1142ac23a..7ea4e23f7 100644 --- a/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java +++ b/app/src/main/java/org/tasks/tasklist/TaskListRecyclerAdapter.java @@ -99,7 +99,7 @@ public class TaskListRecyclerAdapter extends RecyclerView.Adapter updates.add(update); - if (!itemTouchHelperCallback.isDragging() && !itemTouchHelperCallback.isSwiping()) { + if (!itemTouchHelperCallback.isDragging()) { drainQueue(); } } @@ -264,8 +264,4 @@ public class TaskListRecyclerAdapter extends RecyclerView.Adapter list.add(from < to ? to - 1 : to, task); taskList.loadTaskListContent(); } - - void swiped(int position, int delta) { - adapter.swiped(position, delta); - } } diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolder.java b/app/src/main/java/org/tasks/tasklist/ViewHolder.java index b80b98d61..82d5a5dd7 100644 --- a/app/src/main/java/org/tasks/tasklist/ViewHolder.java +++ b/app/src/main/java/org/tasks/tasklist/ViewHolder.java @@ -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) {