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 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 mDragStartX;
private DragListener mDragListener;
private DropListener mDropListener;
private SwipeListener mSwipeListener;
@ -123,6 +124,7 @@ public class TouchListView extends ListView {
int touchSlop = mTouchSlop;
mUpperBound = Math.min(y - touchSlop, mHeight / 3);
mLowerBound = Math.max(y + touchSlop, mHeight * 2 /3);
mDragStartX = x;
return false;
}
mDragView = null;
@ -260,13 +262,12 @@ public class TouchListView extends ListView {
Rect r = mTempRect;
mDragView.getDrawingRect(r);
stopDragging();
if (mRemoveMode == SLIDE_RIGHT && ev.getX() > r.left+(r.width()*3/4)) {
if (ev.getX() > mDragStartX + 20) {
if (mSwipeListener!= null) {
mSwipeListener.swipeRight(mFirstDragPos);
}
unExpandViews(true);
} else if (mRemoveMode == SLIDE_LEFT && ev.getX() < r.left+(r.width()/4)) {
} else if (ev.getX() < mDragStartX - 20) {
if (mSwipeListener!= null) {
mSwipeListener.swipeLeft(mFirstDragPos);
}

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

@ -62,14 +62,14 @@ public class GtasksListActivity extends DraggableTaskListActivity {
public void swipeRight(int which) {
long targetTaskId = taskAdapter.getItemId(which);
gtasksTaskListUpdater.indent(listId, targetTaskId, 1);
taskAdapter.notifyDataSetChanged();
loadTaskListContent(true);
}
@Override
public void swipeLeft(int which) {
long targetTaskId = taskAdapter.getItemId(which);
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 android.text.TextUtils;
import android.widget.Toast;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.api.Filter;
@ -77,6 +79,7 @@ public class GtasksTaskListUpdater {
// if indenting is warranted, indent me and my children
if(indent + delta <= previousIndent.get() + 1 && indent + delta >= 0) {
targetTaskIndent.set(indent);
Toast.makeText(ContextManager.getContext(), "indent: " + (indent + delta), Toast.LENGTH_SHORT).show();
metadata.setValue(GtasksMetadata.INDENT, indent + delta);
if(delta > 0)
metadata.setValue(GtasksMetadata.PARENT_TASK, previousTask.get());

@ -9,10 +9,10 @@ import android.content.Context;
import android.content.Intent;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.Task;
import com.todoroo.andlib.utility.Preferences;
/**
* Exposes Task Detail for notes
@ -44,7 +44,6 @@ public class NoteDetailExposer extends BroadcastReceiver {
}
public String getTaskDetails(long id, boolean extended) {
if(Preferences.getBoolean(R.string.p_showNotes, false)) {
if(extended)
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_height="fill_parent"/>
<!-- completion check-box -->
<CheckBox android:id="@+id/completeBox"
<!-- grabber -->
<ImageView android:id="@+id/grabber"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingLeft="5dip"
android:button="@drawable/btn_check"/>
android:scaleType="center"
android:src="@drawable/grabber"/>
<LinearLayout
android:layout_width="fill_parent"
@ -58,13 +59,13 @@
android:singleLine="true"/>
</LinearLayout>
<!-- grabber -->
<ImageView android:id="@+id/grabber"
<!-- completion check-box -->
<CheckBox android:id="@+id/completeBox"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:scaleType="center"
android:src="@drawable/grabber"/>
android:paddingLeft="5dip"
android:button="@drawable/btn_check"/>
</LinearLayout>

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

Loading…
Cancel
Save