Introduce a flag to help TaskListFragmentPager not intercept touch events in subtasks mode

pull/14/head
Sam Bosley 13 years ago
parent a0c2d7b7f5
commit 87e38b30c9

@ -41,6 +41,7 @@ import com.commonsware.cwac.tlv.TouchListView.DropListener;
import com.commonsware.cwac.tlv.TouchListView.GrabberClickListener; import com.commonsware.cwac.tlv.TouchListView.GrabberClickListener;
import com.commonsware.cwac.tlv.TouchListView.SwipeListener; import com.commonsware.cwac.tlv.TouchListView.SwipeListener;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.astrid.utility.Flags;
public class DraggableListView extends ListView { public class DraggableListView extends ListView {
@ -422,6 +423,7 @@ public class DraggableListView extends ListView {
mWindowManager.addView(v, mWindowParams); mWindowManager.addView(v, mWindowParams);
mDragView = v; mDragView = v;
mDragging = true; mDragging = true;
Flags.set(Flags.TLFP_NO_INTERCEPT_TOUCH);
} }
private void dragView(MotionEvent ev) { private void dragView(MotionEvent ev) {
@ -505,6 +507,7 @@ public class DraggableListView extends ListView {
} }
mDragging = false; mDragging = false;
Flags.checkAndClear(Flags.TLFP_NO_INTERCEPT_TOUCH);
} }
// --- getters and setters // --- getters and setters

@ -4,10 +4,12 @@ import android.content.Context;
import android.support.v4.view.PagerAdapter; import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent;
import com.todoroo.astrid.activity.TaskListFragment; import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.adapter.TaskListFragmentPagerAdapter; import com.todoroo.astrid.adapter.TaskListFragmentPagerAdapter;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.utility.Flags;
public class TaskListFragmentPager extends ViewPager { public class TaskListFragmentPager extends ViewPager {
@ -52,4 +54,11 @@ public class TaskListFragmentPager extends ViewPager {
public TaskListFragment getCurrentFragment() { public TaskListFragment getCurrentFragment() {
return (TaskListFragment) ((TaskListFragmentPagerAdapter) getAdapter()).lookupFragmentForPosition(getCurrentItem()); return (TaskListFragment) ((TaskListFragmentPagerAdapter) getAdapter()).lookupFragmentForPosition(getCurrentItem());
} }
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (!Flags.check(Flags.TLFP_NO_INTERCEPT_TOUCH))
return super.onInterceptTouchEvent(ev);
return false;
}
} }

@ -31,6 +31,11 @@ public class Flags {
*/ */
public static final int TLA_RESUMED_FROM_VOICE_ADD = 1 << 6; public static final int TLA_RESUMED_FROM_VOICE_ADD = 1 << 6;
/**
* If set, indicates that TaskListFragmentPager should not intercept touch events
*/
public static final int TLFP_NO_INTERCEPT_TOUCH = 1 << 7;
public static boolean checkAndClear(int flag) { public static boolean checkAndClear(int flag) {
boolean set = (state & flag) > 0; boolean set = (state & flag) > 0;
state &= ~flag; state &= ~flag;

Loading…
Cancel
Save