public boolean dispatchTouchEvent(MotionEvent ev) {
   if (isEnabled() && isSlideEnable()) {
     int action = MotionEventCompat.getActionMasked(ev);
     if (action == MotionEvent.ACTION_DOWN) {
       int downPosition = pointToPosition((int) ev.getX(), (int) ev.getY());
       int opendPosition = mTouchListener.getOpendPosition();
       // There is a item in opend or half opend(exception occured in
       // previous slideing event) status
       if (opendPosition != INVALID_POSITION) {
         // if slideing or auto
         // slideing(SlideTouchListener.autoScroll()) has not
         // finished,drop this motion event(avoid
         // NullPointerException)
         if (mTouchListener.isInSliding()) {
           return false;
         }
         // if down position not equals the opend position,drop this
         // motion event and close the opend item
         if (downPosition != opendPosition) {
           mTouchListener.closeOpenedItem();
           return false;
         }
       }
     }
   }
   return super.dispatchTouchEvent(ev);
 }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   if (mTouchListener.isOpend()) {
     mTouchListener.closeOpenedItem();
     return;
   }
   if (mOnItemClickListener != null) {
     mOnItemClickListener.onItemClick(parent, view, position, id);
   }
 }
 public void setSlideMode(SlideMode slideMode) {
   if (mSlideMode != slideMode) {
     if (isSlideAdapter()) {
       if (mTouchListener.isOpend()) {
         mTouchListener.closeOpenedItem();
       }
       mAdapter.setSlideMode(slideMode);
       mAdapter.notifyDataSetInvalidated();
     }
     mSlideMode = slideMode;
   }
 }
 public void setSlideRightAction(SlideAction slideAction) {
   if (mSlideRightAction != slideAction) {
     if (isSlideAdapter()) {
       if (mTouchListener.isOpend()) {
         mTouchListener.closeOpenedItem();
       }
     }
     mSlideRightAction = slideAction;
     if (isSlideAdapter()) {
       SlideBaseAdapter adapter = mAdapter;
       setAdapter(null);
       setAdapter(adapter);
     }
   }
 }
 @Override
 public void setAdapter(ListAdapter adapter) {
   mAdapter = null;
   if (adapter != null && adapter instanceof SlideBaseAdapter) {
     mAdapter = (SlideBaseAdapter) adapter;
     mAdapter.setSlideMode(mSlideMode);
     mAdapter.setSlideLeftAction(mSlideLeftAction);
     mAdapter.setSlideRightAction(mSlideRightAction);
   }
   super.setAdapter(adapter);
   mTouchListener.reset();
   if (adapter != null) {
     adapter.registerDataSetObserver(
         new DataSetObserver() {
           @Override
           public void onChanged() {
             super.onChanged();
             if (DEUBG) {
               Log.e(TAG, "Adapter data has changed");
             }
             if (mTouchListener.isOpend()) {
               mTouchListener.closeOpenedItem();
             }
             mTouchListener.reset();
           }
         });
   }
 }
 @Override
 public boolean onInterceptTouchEvent(MotionEvent ev) {
   if (isEnabled() && isSlideEnable()) {
     if (mTouchListener.onInterceptTouchEvent(ev)) {
       return true;
     }
   }
   return super.onInterceptTouchEvent(ev);
 }