Java Code Examples for android.widget.AbsListView#setOnTouchListener()

The following examples show how to use android.widget.AbsListView#setOnTouchListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PullDownLinearLayout.java    From Musicoco with Apache License 2.0 6 votes vote down vote up
public void setListView(AbsListView listView) {
    if (-1 == this.indexOfChild(listView)) {
        return;
    }

    this.listView = listView;
    listView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            float y = event.getY();
            if (event.getAction() == MotionEvent.ACTION_MOVE) {
                //手指往下滑,列表往下滚,
                if ((y - lastYForListView) > touchSlop) {
                    //此时 ListView 接受了事件序列,但用户在下滑列表,
                    // 此时需要在该次事件序列下一个事件到达时再次检查是否需要截断 onInterceptTouchEvent
                    PullDownLinearLayout.this.requestDisallowInterceptTouchEvent(false);
                    lastYForListView = y;
                }
            }
            return false;
        }
    });
}
 
Example 2
Source File: SwipeDismissAdapter.java    From ALLGO with Apache License 2.0 5 votes vote down vote up
@Override
public void setAbsListView(AbsListView listView) {
	super.setAbsListView(listView);
	if (mDecoratedBaseAdapter instanceof ArrayAdapter<?>) {
		// fix #35 dirty trick !
		// if ArrayAdapter we assume that items manipulation will come from it
		((ArrayAdapter<?>)mDecoratedBaseAdapter).propagateNotifyDataSetChanged(this);
	}
	mSwipeDismissListViewTouchListener = createListViewTouchListener(listView);
	mSwipeDismissListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer());
	mSwipeDismissListViewTouchListener.setTouchChild(getTouchChild());
	listView.setOnTouchListener(mSwipeDismissListViewTouchListener);
}
 
Example 3
Source File: ContextualUndoAdapter.java    From ALLGO with Apache License 2.0 5 votes vote down vote up
@Override
public void setAbsListView(AbsListView listView) {
	super.setAbsListView(listView);
	mContextualUndoListViewTouchListener = new ContextualUndoListViewTouchListener(listView, this);
	mContextualUndoListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer());
	mContextualUndoListViewTouchListener.setTouchChild(getTouchChild());
	listView.setOnTouchListener(mContextualUndoListViewTouchListener);
	listView.setOnScrollListener(mContextualUndoListViewTouchListener.makeScrollListener());
	listView.setRecyclerListener(new RecycleViewListener());
}
 
Example 4
Source File: SwipeDismissAdapter.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void setAbsListView(final AbsListView listView) {
    super.setAbsListView(listView);
    if (mDecoratedBaseAdapter instanceof ArrayAdapter<?>) {
        ((ArrayAdapter<?>) mDecoratedBaseAdapter).propagateNotifyDataSetChanged(this);
    }
    mSwipeDismissListViewTouchListener = createListViewTouchListener(listView);
    mSwipeDismissListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer());
    mSwipeDismissListViewTouchListener.setTouchChild(getTouchChild());
    listView.setOnTouchListener(mSwipeDismissListViewTouchListener);
}
 
Example 5
Source File: ContextualUndoAdapter.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void setAbsListView(final AbsListView listView) {
    super.setAbsListView(listView);
    mContextualUndoListViewTouchListener = new ContextualUndoListViewTouchListener(listView, this);
    mContextualUndoListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer());
    mContextualUndoListViewTouchListener.setTouchChild(getTouchChild());
    listView.setOnTouchListener(mContextualUndoListViewTouchListener);
    listView.setOnScrollListener(mContextualUndoListViewTouchListener.makeScrollListener());
    listView.setOnHierarchyChangeListener(new HierarchyChangeListener());
}
 
Example 6
Source File: SwipeDismissAdapter.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void setAbsListView(final AbsListView listView) {
    super.setAbsListView(listView);
    if (mDecoratedBaseAdapter instanceof ArrayAdapter<?>) {
        ((ArrayAdapter<?>) mDecoratedBaseAdapter).propagateNotifyDataSetChanged(this);
    }
    mSwipeDismissListViewTouchListener = createListViewTouchListener(listView);
    mSwipeDismissListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer());
    mSwipeDismissListViewTouchListener.setTouchChild(getTouchChild());
    listView.setOnTouchListener(mSwipeDismissListViewTouchListener);
}
 
Example 7
Source File: ContextualUndoAdapter.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void setAbsListView(final AbsListView listView) {
    super.setAbsListView(listView);
    mContextualUndoListViewTouchListener = new ContextualUndoListViewTouchListener(listView, this);
    mContextualUndoListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer());
    mContextualUndoListViewTouchListener.setTouchChild(getTouchChild());
    listView.setOnTouchListener(mContextualUndoListViewTouchListener);
    listView.setOnScrollListener(mContextualUndoListViewTouchListener.makeScrollListener());
    listView.setOnHierarchyChangeListener(new HierarchyChangeListener());
}
 
Example 8
Source File: SwipeDismissAdapter.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void setAbsListView(final AbsListView listView) {
    super.setAbsListView(listView);
    if (mDecoratedBaseAdapter instanceof ArrayAdapter<?>) {
        ((ArrayAdapter<?>) mDecoratedBaseAdapter).propagateNotifyDataSetChanged(this);
    }
    mSwipeDismissListViewTouchListener = createListViewTouchListener(listView);
    mSwipeDismissListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer());
    mSwipeDismissListViewTouchListener.setTouchChild(getTouchChild());
    listView.setOnTouchListener(mSwipeDismissListViewTouchListener);
}
 
Example 9
Source File: ContextualUndoAdapter.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void setAbsListView(final AbsListView listView) {
    super.setAbsListView(listView);
    mContextualUndoListViewTouchListener = new ContextualUndoListViewTouchListener(listView, this);
    mContextualUndoListViewTouchListener.setIsParentHorizontalScrollContainer(isParentHorizontalScrollContainer());
    mContextualUndoListViewTouchListener.setTouchChild(getTouchChild());
    listView.setOnTouchListener(mContextualUndoListViewTouchListener);
    listView.setOnScrollListener(mContextualUndoListViewTouchListener.makeScrollListener());
    listView.setOnHierarchyChangeListener(new HierarchyChangeListener());
}
 
Example 10
Source File: Notifications.java    From Klyph with MIT License 4 votes vote down vote up
@Override
public void setAbsListView(AbsListView listView)
{
	super.setAbsListView(listView);
	listView.setOnTouchListener(new NotificationSwipeDismissListViewTouchListener(listView, mCallback));
}