Example #1
0
        public virtual void ScrollToColumnPosition(int columnPosition)
        {
            // TableView is not on screen yet.
            if (!((Android.Views.View)mTableView).IsShown)
            {
                // Change default value of the listener
                mTableView.GetHorizontalRecyclerViewListener().SetScrollPosition(columnPosition);
            }

            // Column Header should be scrolled firstly because of fitting column width process.
            ScrollColumnHeader(columnPosition, 0);
            ScrollCellHorizontally(columnPosition, 0);
        }
        public virtual AbstractViewHolder OnCreateAbstractViewHolder(ViewGroup parent, int viewType)
        {
            // Create a RecyclerView as a Row of the CellRecyclerView
            CellRecyclerView recyclerView = new CellRecyclerView(mContext);

            // Use the same view pool
            recyclerView.SetRecycledViewPool(mRecycledViewPool);
            if (mTableView.IsShowHorizontalSeparators())
            {
                // Add divider
                recyclerView.AddItemDecoration(mTableView.GetHorizontalItemDecoration());
            }

            // To get better performance for fixed size TableView
            recyclerView.HasFixedSize = mTableView.HasFixedWidth();
            // set touch mHorizontalListener to scroll synchronously
            recyclerView.AddOnItemTouchListener(mTableView.GetHorizontalRecyclerViewListener());
            // Add Item click listener for cell views
            recyclerView.AddOnItemTouchListener(new CellRecyclerViewItemClickListener(recyclerView, mTableView));
            // Set the Column layout manager that helps the fit width of the cell and column header
            // and it also helps to locate the scroll position of the horizontal recyclerView
            // which is row recyclerView
            recyclerView.SetLayoutManager(new ColumnLayoutManager(mContext, mTableView));
            // Create CellRow adapter
            recyclerView.SetAdapter(new CellRowRecyclerViewAdapter(mContext, mTableView));
            // This is for testing purpose to find out which recyclerView is displayed.
            recyclerView.Id = mRecyclerViewId;
            mRecyclerViewId++;
            return(new CellRecyclerViewAdapter.CellRowViewHolder(recyclerView));
        }
        // Add new one
        public override void OnAttachedToWindow(RecyclerView view)
        {
            base.OnAttachedToWindow(view);
            // initialize the instances
            if (mCellRecyclerView == null)
            {
                mCellRecyclerView = mTableView.GetCellRecyclerView();
            }

            if (mHorizontalListener == null)
            {
                mHorizontalListener = mTableView.GetHorizontalRecyclerViewListener();
            }
        }