Fixed a bug in draggable list activity

pull/14/head
Sam Bosley 13 years ago
parent ac40dc9d4f
commit 3a5b3f9eb5

@ -248,12 +248,14 @@ public class DraggableListView extends ListView {
switch (action) { switch (action) {
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
if(mDragging) if(mDragging) {
stopDragging(); stopDragging();
} else {
else { if (dragThread != null && mClickListener != null) {
if (dragThread != null && mClickListener != null) dragThread.interrupt();
dragThread = null;
mClickListener.onClick(viewAtPosition()); mClickListener.onClick(viewAtPosition());
}
else if (mSwipeListener != null && else if (mSwipeListener != null &&
Math.abs(mTouchCurrentY - mTouchStartY) < MOVEMENT_THRESHOLD) { Math.abs(mTouchCurrentY - mTouchStartY) < MOVEMENT_THRESHOLD) {
@ -480,6 +482,7 @@ public class DraggableListView extends ListView {
unExpandViews(false); unExpandViews(false);
if (mDragView != null) { if (mDragView != null) {
System.err.println("removing view");
WindowManager wm = (WindowManager) getContext().getSystemService( WindowManager wm = (WindowManager) getContext().getSystemService(
Context.WINDOW_SERVICE); Context.WINDOW_SERVICE);
wm.removeView(mDragView); wm.removeView(mDragView);

Loading…
Cancel
Save