protected void initAdapter(bool refreshable, bool loadmoreable)
        {
            if (mAdapter != null)
            {
                mAdapter.setOnItemClickListener(this);
                var errorView = mAdapter.setError(Resource.Layout.common_error_view);
                errorView.Click += (sender, e) =>
                {
                    mAdapter.resumeMore();
                };
                if (loadmoreable)
                {
                    mAdapter.setMore(Resource.Layout.common_more_view, this);
                    mAdapter.setNoMore(Resource.Layout.common_nomore_view);
                }
                if (refreshable && mRecyclerView != null)
                {
                    mRecyclerView.setRefreshListener(this);
                }
            }

            if (mRecyclerView != null)
            {
                mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
                mRecyclerView.setItemDecoration(ContextCompat.GetColor(this, Resource.Color.common_divider_narrow), 1, 0, 0);
                mRecyclerView.setAdapterWithProgress(mAdapter);
            }
        }
示例#2
0
        public override void configViews()
        {
            mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
            mRecyclerView.setItemDecoration(ContextCompat.GetColor(this, Resource.Color.common_divider_narrow), 1, 0, 0);

            mAdapter = new RecommendAdapter(this);
            mAdapter.setOnItemClickListener(this);
            mRecyclerView.setAdapterWithProgress(mAdapter);

            queryFiles();
        }