app/src/main/java/com/geekyouup/android/ustopwatch/fragments/StopwatchCustomVectorView.java
// Deal with touch events, either start/stop or swipe
Deal with touch events, either start/stop or swipe
Deal with touch events either start / stop or swipe
@Override
    public boolean onTouchEvent(MotionEvent event) {
        super.onTouchEvent(event);
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            SoundManager sm = SoundManager.getInstance(getContext());
            if (sm.isEndlessAlarmSounding()) {
                sm.stopEndlessAlarm();
            } else {
                mTouching = System.currentTimeMillis();
            }
        } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
            if (mTouching > 0 && System.currentTimeMillis() - mTouching > 1000)
                mTouching = 0L;   
        } else if (event.getAction() == MotionEvent.ACTION_UP) {
            if (mTouching > 0) {
                startStop();
            }
            mTouching = 0L;
        }
        return true;
    }
@ Override public boolean onTouchEvent ( MotionEvent event ) { super . onTouchEvent ( event ) ; if ( event . getAction ( ) == MotionEvent . ACTION_DOWN ) { SoundManager sm = SoundManager . getInstance ( getContext ( ) ) ; if ( sm . isEndlessAlarmSounding ( ) ) { sm . stopEndlessAlarm ( ) ; } else { mTouching = System . currentTimeMillis ( ) ; } } else if ( event . getAction ( ) == MotionEvent . ACTION_MOVE ) { if ( mTouching > 0 && System . currentTimeMillis ( ) - mTouching > 1000 ) mTouching = 0L ; } else if ( event . getAction ( ) == MotionEvent . ACTION_UP ) { if ( mTouching > 0 ) { startStop ( ) ; } mTouching = 0L ; } return true ; }
Deal with touch events, either start/stop or swipe
Deal with touch events either start / stop or swipe
//reset touch if user is swiping