Wired up swipe detector to behave as expected, restored old grabber icon at Jon's request, now indnet works

pull/14/head
Tim Su 15 years ago
parent 6d127a8071
commit f24907cbb6

@ -44,6 +44,7 @@ public class TouchListView extends ListView {
private int mFirstDragPos; // where was the dragged item originally private int mFirstDragPos; // where was the dragged item originally
private int mDragPoint; // at what offset inside the item did the user grab it private int mDragPoint; // at what offset inside the item did the user grab it
private int mCoordOffset; // the difference between screen coordinates and coordinates in this view private int mCoordOffset; // the difference between screen coordinates and coordinates in this view
private int mDragStartX;
private DragListener mDragListener; private DragListener mDragListener;
private DropListener mDropListener; private DropListener mDropListener;
private SwipeListener mSwipeListener; private SwipeListener mSwipeListener;
@ -123,6 +124,7 @@ public class TouchListView extends ListView {
int touchSlop = mTouchSlop; int touchSlop = mTouchSlop;
mUpperBound = Math.min(y - touchSlop, mHeight / 3); mUpperBound = Math.min(y - touchSlop, mHeight / 3);
mLowerBound = Math.max(y + touchSlop, mHeight * 2 /3); mLowerBound = Math.max(y + touchSlop, mHeight * 2 /3);
mDragStartX = x;
return false; return false;
} }
mDragView = null; mDragView = null;
@ -260,13 +262,12 @@ public class TouchListView extends ListView {
Rect r = mTempRect; Rect r = mTempRect;
mDragView.getDrawingRect(r); mDragView.getDrawingRect(r);
stopDragging(); stopDragging();
if (ev.getX() > mDragStartX + 20) {
if (mRemoveMode == SLIDE_RIGHT && ev.getX() > r.left+(r.width()*3/4)) {
if (mSwipeListener!= null) { if (mSwipeListener!= null) {
mSwipeListener.swipeRight(mFirstDragPos); mSwipeListener.swipeRight(mFirstDragPos);
} }
unExpandViews(true); unExpandViews(true);
} else if (mRemoveMode == SLIDE_LEFT && ev.getX() < r.left+(r.width()/4)) { } else if (ev.getX() < mDragStartX - 20) {
if (mSwipeListener!= null) { if (mSwipeListener!= null) {
mSwipeListener.swipeLeft(mFirstDragPos); mSwipeListener.swipeLeft(mFirstDragPos);
} }

@ -7,8 +7,8 @@ import android.gesture.Gesture;
import android.gesture.GestureLibraries; import android.gesture.GestureLibraries;
import android.gesture.GestureLibrary; import android.gesture.GestureLibrary;
import android.gesture.GestureOverlayView; import android.gesture.GestureOverlayView;
import android.gesture.Prediction;
import android.gesture.GestureOverlayView.OnGesturePerformedListener; import android.gesture.GestureOverlayView.OnGesturePerformedListener;
import android.gesture.Prediction;
import com.todoroo.andlib.widget.GestureService.GestureInterface; import com.todoroo.andlib.widget.GestureService.GestureInterface;
@ -22,6 +22,7 @@ public class Api4GestureDetector implements OnGesturePerformedListener {
if(mLibrary.load()) { if(mLibrary.load()) {
GestureOverlayView gestures = (GestureOverlayView) activity.findViewById(view); GestureOverlayView gestures = (GestureOverlayView) activity.findViewById(view);
if(gestures != null)
gestures.addOnGesturePerformedListener(this); gestures.addOnGesturePerformedListener(this);
} }
} }

@ -62,14 +62,14 @@ public class GtasksListActivity extends DraggableTaskListActivity {
public void swipeRight(int which) { public void swipeRight(int which) {
long targetTaskId = taskAdapter.getItemId(which); long targetTaskId = taskAdapter.getItemId(which);
gtasksTaskListUpdater.indent(listId, targetTaskId, 1); gtasksTaskListUpdater.indent(listId, targetTaskId, 1);
taskAdapter.notifyDataSetChanged(); loadTaskListContent(true);
} }
@Override @Override
public void swipeLeft(int which) { public void swipeLeft(int which) {
long targetTaskId = taskAdapter.getItemId(which); long targetTaskId = taskAdapter.getItemId(which);
gtasksTaskListUpdater.indent(listId, targetTaskId, -1); gtasksTaskListUpdater.indent(listId, targetTaskId, -1);
taskAdapter.notifyDataSetChanged(); loadTaskListContent(true);
} }
}; };

@ -6,9 +6,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import android.text.TextUtils; import android.text.TextUtils;
import android.widget.Toast;
import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
@ -77,6 +79,7 @@ public class GtasksTaskListUpdater {
// if indenting is warranted, indent me and my children // if indenting is warranted, indent me and my children
if(indent + delta <= previousIndent.get() + 1 && indent + delta >= 0) { if(indent + delta <= previousIndent.get() + 1 && indent + delta >= 0) {
targetTaskIndent.set(indent); targetTaskIndent.set(indent);
Toast.makeText(ContextManager.getContext(), "indent: " + (indent + delta), Toast.LENGTH_SHORT).show();
metadata.setValue(GtasksMetadata.INDENT, indent + delta); metadata.setValue(GtasksMetadata.INDENT, indent + delta);
if(delta > 0) if(delta > 0)
metadata.setValue(GtasksMetadata.PARENT_TASK, previousTask.get()); metadata.setValue(GtasksMetadata.PARENT_TASK, previousTask.get());

@ -9,10 +9,10 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.andlib.utility.Preferences;
/** /**
* Exposes Task Detail for notes * Exposes Task Detail for notes
@ -44,7 +44,6 @@ public class NoteDetailExposer extends BroadcastReceiver {
} }
public String getTaskDetails(long id, boolean extended) { public String getTaskDetails(long id, boolean extended) {
if(Preferences.getBoolean(R.string.p_showNotes, false)) { if(Preferences.getBoolean(R.string.p_showNotes, false)) {
if(extended) if(extended)
return null; return null;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 550 B

@ -27,12 +27,13 @@
android:layout_width="0dip" android:layout_width="0dip"
android:layout_height="fill_parent"/> android:layout_height="fill_parent"/>
<!-- completion check-box -->
<CheckBox android:id="@+id/completeBox" <!-- grabber -->
<ImageView android:id="@+id/grabber"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="5dip" android:scaleType="center"
android:button="@drawable/btn_check"/> android:src="@drawable/grabber"/>
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -59,12 +60,12 @@
</LinearLayout> </LinearLayout>
<!-- grabber --> <!-- completion check-box -->
<ImageView android:id="@+id/grabber" <CheckBox android:id="@+id/completeBox"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:scaleType="center" android:paddingLeft="5dip"
android:src="@drawable/grabber"/> android:button="@drawable/btn_check"/>
</LinearLayout> </LinearLayout>

@ -1,14 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- See the file "LICENSE" for the full license governing this code. --> <!-- See the file "LICENSE" for the full license governing this code. -->
<android.gesture.GestureOverlayView xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gestures"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_weight="100"
android:uncertainGestureColor="#00000000"
android:eventsInterceptionEnabled="true"
android:orientation="vertical">
<!-- No Tasks label --> <!-- No Tasks label -->
<TextView android:id="@android:id/empty" <TextView android:id="@android:id/empty"
@ -33,4 +27,4 @@
tlv:grabber="@+id/grabber" tlv:grabber="@+id/grabber"
/> />
</android.gesture.GestureOverlayView> </FrameLayout>

Loading…
Cancel
Save