Ejemplo n.º 1
0
        public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
        {
            _pos = ((LinearLayoutManager)recyclerView.GetLayoutManager()).FindFirstVisibleItemPosition();
            var lastPos = ((LinearLayoutManager)recyclerView.GetLayoutManager()).FindLastVisibleItemPosition();

            ScrolledToPosition?.Invoke(lastPos);

            // TODO: temporary solution
            if (lastPos > _prevPos && lastPos != _prevPos)
            {
                if (lastPos >= _prevPos + packSize / 2)
                {
                    ScrolledToBottom?.Invoke();
                    _prevPos = _prevPos + packSize;
                }
            }

            /*if (lastPos > _prevPos && lastPos != _prevPos)
             * {
             *  if (lastPos == recyclerView.GetAdapter().ItemCount - 1)
             *  {
             *      if (lastPos < recyclerView.GetAdapter().ItemCount)
             *      {
             *          ScrolledToBottom?.Invoke();
             *          _prevPos = lastPos;
             *      }
             *  }
             * }*/
        }
Ejemplo n.º 2
0
        public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
        {
            _pos = ((LinearLayoutManager)recyclerView.GetLayoutManager()).FindFirstVisibleItemPosition();
            var lastPos = ((LinearLayoutManager)recyclerView.GetLayoutManager()).FindLastVisibleItemPosition();

            ScrolledToPosition?.Invoke(lastPos);
            if (lastPos > _prevPos && lastPos != _prevPos)
            {
                if (lastPos == recyclerView.GetAdapter().ItemCount - 1)
                {
                    if (lastPos < recyclerView.GetAdapter().ItemCount)
                    {
                        ScrolledToBottom?.Invoke();
                        _prevPos = lastPos;
                    }
                }
            }
        }