Search in sources :

Example 1 with DividerItemDecoration

use of com.thebluealliance.androidclient.DividerItemDecoration in project the-blue-alliance-android by the-blue-alliance.

the class RecyclerViewFragment method onCreateView.

@Override
@Nullable
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v;
    // to do it programmatically.
    if (shouldShowScrollbars()) {
        v = inflater.inflate(R.layout.recycler_view_with_spinner, null);
    } else {
        v = inflater.inflate(R.layout.recycler_view_with_spinner_no_scrollbar, null);
    }
    mBinder.setRootView(v);
    mBinder.setRecyclerViewBinderMapper(this);
    mRecyclerView = (RecyclerView) v.findViewById(R.id.list);
    mRecyclerView.setHasFixedSize(true);
    if (shouldShowDividers()) {
        mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL_LIST));
    }
    mLayoutManager = new LinearLayoutManager(getContext());
    mRecyclerView.setLayoutManager(mLayoutManager);
    ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.progress);
    if (mAdapter != null) {
        mRecyclerView.setAdapter(mAdapter);
        mLayoutManager.onRestoreInstanceState(mListState);
        progressBar.setVisibility(View.GONE);
    }
    mBinder.setNoDataView((NoDataView) v.findViewById(R.id.no_data));
    return v;
}
Also used : DividerItemDecoration(com.thebluealliance.androidclient.DividerItemDecoration) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) NoDataView(com.thebluealliance.androidclient.views.NoDataView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) ProgressBar(android.widget.ProgressBar) Nullable(androidx.annotation.Nullable)

Aggregations

View (android.view.View)1 ProgressBar (android.widget.ProgressBar)1 Nullable (androidx.annotation.Nullable)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 DividerItemDecoration (com.thebluealliance.androidclient.DividerItemDecoration)1 NoDataView (com.thebluealliance.androidclient.views.NoDataView)1