Esempio n. 1
0
        public void stop(NumberPicker picker, long elapsedTime)
        {
            // Execute dummy touch to adjust the position of the picker
            long      now          = SystemClock.UptimeMillis();
            int       touchX       = picker.Width / 2;
            int       topTouchY    = picker.Height / 5;
            int       bottomTouchY = picker.Height * 4 / 5;
            const int metaState    = 0;

            // Dummy touch of upper side of the picker
            MotionEvent e = MotionEvent.Obtain(
                now,
                now,
                MotionEventActions.Down,
                touchX,
                topTouchY,
                metaState);

            picker.DispatchTouchEvent(e);

            e.Action = MotionEventActions.Up;
            picker.DispatchTouchEvent(e);

            // Dummy touch of bottom side of the picker
            e = MotionEvent.Obtain(
                now,
                now,
                MotionEventActions.Down,
                touchX,
                bottomTouchY,
                metaState);
            picker.DispatchTouchEvent(e);

            e.Action = MotionEventActions.Up;
            picker.DispatchTouchEvent(e);
        }