예제 #1
0
            ///////////////////////////////////////////////////////////////////////////////////////////
            // public Methods [verb]

            public bool OnTouch(View v, MotionEvent e)
            {
                float _touchPointX = e.GetX();

                Log.Info($"_touchPointX: {_touchPointX}");
                MainActivity _activity = getActivity(v);

                switch (e.Action)
                {
                case MotionEventActions.Down:
                    previousTouchPointX = (int)_touchPointX;
                    break;

                case MotionEventActions.Up:
                    float _dx = _touchPointX - previousTouchPointX;
                    if ((Math.Abs(_dx) > 1))       // TouchDown時のタッチ座標とTouchUp時の座標を比較しどちらにフリックしたか判定
                    {
                        if (_dx > 0)
                        {
                            Log.Info($"{_activity.Idx}/{_activity.Count} touchX: {_touchPointX} 右へフリック: {_dx}");
                            _activity.Increment();
                        }
                        else
                        {
                            Log.Info($"{_activity.Idx}/{_activity.Count} touchX: {_touchPointX} 左へフリック: {_dx}");
                            _activity.Decrement();
                        }
                    }
                    break;

                default:
                    break;
                }
                return(true);
            }