public override int startCapture() { capturing = true; mHandler.postDelayed(newFrame, 1000 / fps); return(0); }
internal virtual bool onTouchEvent(android.view.MotionEvent me) { if (mState == STATE_NONE) { return(false); } int action = me.getAction(); if (action == android.view.MotionEvent.ACTION_DOWN) { if (isPointInside(me.getX(), me.getY())) { if (!mList.isInScrollingContainer()) { beginDrag(); return(true); } mInitialTouchY = me.getY(); startPendingDrag(); } } else { if (action == android.view.MotionEvent.ACTION_UP) { // don't add ACTION_CANCEL here if (mPendingDrag) { // Allow a tap to scroll. beginDrag(); int viewHeight = mList.getHeight(); // Jitter int newThumbY = (int)me.getY() - mThumbH + 10; if (newThumbY < 0) { newThumbY = 0; } else { if (newThumbY + mThumbH > viewHeight) { newThumbY = viewHeight - mThumbH; } } mThumbY = newThumbY; scrollTo((float)mThumbY / (viewHeight - mThumbH)); cancelPendingDrag(); } // Will hit the STATE_DRAGGING check below if (mState == STATE_DRAGGING) { if (mList != null) { // ViewGroup does the right thing already, but there might // be other classes that don't properly reset on touch-up, // so do this explicitly just in case. mList.requestDisallowInterceptTouchEvent(false); mList.reportScrollStateChange(android.widget.AbsListView.OnScrollListenerClass.SCROLL_STATE_IDLE ); } setState(STATE_VISIBLE); android.os.Handler handler = mHandler; handler.removeCallbacks(mScrollFade); if (!mAlwaysShow) { handler.postDelayed(mScrollFade, 1000); } mList.invalidate(); return(true); } } else { if (action == android.view.MotionEvent.ACTION_MOVE) { if (mPendingDrag) { float y = me.getY(); if (System.Math.Abs(y - mInitialTouchY) > mScaledTouchSlop) { setState(STATE_DRAGGING); if (mListAdapter == null && mList != null) { getSectionsFromIndexer(); } if (mList != null) { mList.requestDisallowInterceptTouchEvent(true); mList.reportScrollStateChange(android.widget.AbsListView.OnScrollListenerClass.SCROLL_STATE_TOUCH_SCROLL ); } cancelFling(); cancelPendingDrag(); } } // Will hit the STATE_DRAGGING check below if (mState == STATE_DRAGGING) { int viewHeight = mList.getHeight(); // Jitter int newThumbY = (int)me.getY() - mThumbH + 10; if (newThumbY < 0) { newThumbY = 0; } else { if (newThumbY + mThumbH > viewHeight) { newThumbY = viewHeight - mThumbH; } } if (System.Math.Abs(mThumbY - newThumbY) < 2) { return(true); } mThumbY = newThumbY; // If the previous scrollTo is still pending if (mScrollCompleted) { scrollTo((float)mThumbY / (viewHeight - mThumbH)); } return(true); } } else { if (action == android.view.MotionEvent.ACTION_CANCEL) { cancelPendingDrag(); } } } } return(false); }