Пример #1
0
        private void ScrollCellHorizontally(int columnPosition, int offset)
        {
            CellLayoutManager cellLayoutManager = mTableView.GetCellLayoutManager();

            for (int i = cellLayoutManager.FindFirstVisibleItemPosition();
                 i < cellLayoutManager.FindLastVisibleItemPosition() + 1;
                 i++)
            {
                RecyclerView cellRowRecyclerView = (RecyclerView)cellLayoutManager.FindViewByPosition(i);
                if (cellRowRecyclerView != null)
                {
                    ColumnLayoutManager columnLayoutManager =
                        (ColumnLayoutManager)cellRowRecyclerView.GetLayoutManager();
                    columnLayoutManager.ScrollToPositionWithOffset(columnPosition, offset);
                }
            }
        }
        public virtual void AddColumnItems(int column, IList <ICell> cellColumnItems)
        {
            // It should be same size with exist model list.
            if (cellColumnItems.Count != mItemList.Count || cellColumnItems.Contains(null))
            {
                return;
            }

            // Firstly, add columns from visible recyclerViews.
            // To be able provide removing animation, we need to notify just for given column position.
            CellLayoutManager layoutManager = mTableView.GetCellLayoutManager();

            for (int i = layoutManager.FindFirstVisibleItemPosition();
                 i < layoutManager.FindLastVisibleItemPosition() + 1;
                 i++)
            {
                // Get the cell row recyclerView that is located on i position
                RecyclerView cellRowRecyclerView = (RecyclerView)layoutManager.FindViewByPosition(i);
                // Add the item using its adapter.
                ((AbstractRecyclerViewAdapter <ICell>)cellRowRecyclerView.GetAdapter()).AddItem(column,
                                                                                                cellColumnItems[i]);
            }

            // Lets change the model list silently
            IList <IList <ICell> > cellItems = new AList <IList <ICell> >();

            for (int i_1 = 0; i_1 < mItemList.Count; i_1++)
            {
                IList <ICell> rowList = new AList <ICell>((IList <ICell>)mItemList[i_1]);
                if (rowList.Count > column)
                {
                    rowList.Insert(column, cellColumnItems[i_1]);
                }

                cellItems.Add(rowList);
            }

            // Change data without notifying. Because we already did for visible recyclerViews.
            SetItems(cellItems, false);
        }