Ejemplo n.º 1
0
        public override void OnScrollStateChanged(RecyclerView recyclerView, int newState)
        {
            base.OnScrollStateChanged(recyclerView, newState);
            var state = (ScrollState)newState;
            var x     = _recyclerView.GetHorizontalScrollOffset() / _density;
            var y     = _startScrollPosition / _density;

            if (_lastState == ScrollState.Idle && (state == ScrollState.TouchScroll || state == ScrollState.Fling))
            {
                _startScrollPosition = _recyclerView.GetVerticalScrollOffset();
            }

            if (state == ScrollState.TouchScroll || state == ScrollState.Fling)
            {
                _fastGridView.RaiseOnStartScroll(x, y,
                                                 state == ScrollState.TouchScroll ? ScrollActionType.Finger : ScrollActionType.Fling);
            }

            if (_lastState == ScrollState.TouchScroll && (state == ScrollState.Fling || state == ScrollState.Idle))
            {
                _fastGridView.RaiseOnStopScroll(x, y, ScrollActionType.Finger, state == ScrollState.Idle);
            }

            if (_lastState == ScrollState.Fling && state == ScrollState.Idle)
            {
                _fastGridView.RaiseOnStopScroll(x, y, ScrollActionType.Fling, true);
            }

            _lastState = state;
        }
Ejemplo n.º 2
0
        void GetScrollPosition(object obj)
        {
            var func = obj as Func <Point, object>;

            if (func == null)
            {
                return;
            }
            var point = new Point(_recyclerView.GetHorizontalScrollOffset() / _density,
                                  _recyclerView.GetVerticalScrollOffset() / _density);

            func.Invoke(point);
        }