Fixed off-by-one drag errors. Killed printlines. We are cool.

pull/14/head
Tim Su 14 years ago
parent e78ed319ab
commit a4c2b2bdf8

@ -156,7 +156,6 @@ abstract public class OrderedListUpdater<LIST> {
if(list == null)
return;
System.err.println("u wanna? " + targetTaskId + " before " + moveBeforeTaskId);
Node root = buildTreeModel(filter, list);
Node target = findNode(root, targetTaskId);
@ -167,7 +166,6 @@ abstract public class OrderedListUpdater<LIST> {
target.parent = root;
} else {
Node sibling = findNode(root, moveBeforeTaskId);
System.err.println("siblin found: " + sibling);
if(sibling != null && !ancestorOf(target, sibling)) {
int index = sibling.parent.children.indexOf(sibling);
@ -213,7 +211,6 @@ abstract public class OrderedListUpdater<LIST> {
metadata.setValue(indentProperty(), indent);
if(parentProperty() != null)
metadata.setValue(parentProperty(), node.parent.taskId);
System.err.println("updated metadata " + metadata.getSetValues() + " where " + metadata.getMergedValues());
saveAndUpdateModifiedDate(metadata, node.taskId);
}

@ -101,18 +101,11 @@ public class SubtasksFragmentHelper {
long targetTaskId = taskAdapter.getItemId(from);
long destinationTaskId = taskAdapter.getItemId(to);
System.err.println("move " + from + " to " + to);
updater.debugPrint(getFilter(), list);
if(to == getListView().getCount() - 1)
if(to >= getListView().getCount())
updater.moveTo(getFilter(), list, targetTaskId, -1);
else
updater.moveTo(getFilter(), list, targetTaskId, destinationTaskId);
System.err.println(" --- after ---");
updater.debugPrint(getFilter(), list);
fragment.loadTaskListContent(true);
}
};

@ -23,7 +23,6 @@ public class SubtasksTagListFragment extends TagViewFragment {
protected void postLoadTagData() {
String list = "td:" + tagData.getId(); //$NON-NLS-1$
helper.setList(list);
System.err.println("set list to " + list);
}
/* (non-Javadoc)
@ -51,7 +50,6 @@ public class SubtasksTagListFragment extends TagViewFragment {
@Override
protected void setUpTaskList() {
helper.beforeSetUpTaskList(filter);
System.err.println("sql: " + filter.sqlQuery);
super.setUpTaskList();

@ -216,7 +216,6 @@ public class AstridActivity extends FragmentActivity
}
public final void setupTasklistFragmentWithFilterAndCustomTaskList(Filter filter, Class<?> customTaskList) {
System.err.println("HAJIMEMASHITE setting up fragment with class " + customTaskList); //$NON-NLS-1$
Class<?> component = customTaskList;
if (filter instanceof FilterWithCustomIntent) {
try {
@ -229,7 +228,6 @@ public class AstridActivity extends FragmentActivity
FragmentTransaction transaction = manager.beginTransaction();
try {
System.err.println("setting up fragment with class " + customTaskList); //$NON-NLS-1$
TaskListFragment newFragment = (TaskListFragment) component.newInstance();
transaction.replace(R.id.tasklist_fragment_container, newFragment,
TaskListFragment.TAG_TASKLIST_FRAGMENT);
@ -310,7 +308,6 @@ public class AstridActivity extends FragmentActivity
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentByTag(tag);
if(fragment == null) {
System.err.println("creating fragment of type " + cls.getSimpleName()); //$NON-NLS-1$
try {
fragment = cls.newInstance();
} catch (InstantiationException e) {

@ -427,7 +427,7 @@ public class DraggableListView extends ListView {
if (x > mTouchStartX + SWIPE_THRESHOLD)
mDragView.setPadding(30, 1, 0, 1);
else if (x < mTouchStartX - SWIPE_THRESHOLD)
mDragView.setPadding(-30, 1, 0, 1);
mDragView.setPadding(-30, 2, 0, 2);
else
mDragView.setPadding(0, 0, 0, 0);
@ -437,9 +437,8 @@ public class DraggableListView extends ListView {
if (itemnum >= 0) {
if (ev.getAction() == MotionEvent.ACTION_DOWN
|| itemnum != mDragPos) {
if (mDragListener != null) {
if (mDragListener != null)
mDragListener.drag(mDragPos, itemnum);
}
mDragPos = itemnum;
doExpansion();
}
@ -493,6 +492,8 @@ public class DraggableListView extends ListView {
mSwipeListener.swipeLeft(mFirstDragPos);
} else if(mDropListener != null && mDragPos != mFirstDragPos &&
mDragPos >= 0 && mDragPos < getCount()) {
if(mFirstDragPos < mDragPos)
mDragPos++;
mDropListener.drop(mFirstDragPos, mDragPos);
}
}

Loading…
Cancel
Save