Search in sources :

Example 1 with PageListRecyclerAdapter

use of com.instructure.candroid.adapter.PageListRecyclerAdapter in project instructure-android by instructure.

the class PageListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    mRootView = getLayoutInflater().inflate(R.layout.fragment_course_pages, container, false);
    mToolbar = mRootView.findViewById(R.id.toolbar);
    mRecyclerAdapter = new PageListRecyclerAdapter(getContext(), getCanvasContext(), new AdapterToFragmentCallback<Page>() {

        @Override
        public void onRowClicked(Page page, int position, boolean isOpenDetail) {
            Navigation navigation = getNavigation();
            if (navigation != null) {
                Bundle bundle = PageDetailsFragment.Companion.createBundle(page.getUrl(), getCanvasContext());
                navigation.addFragment(FragUtils.getFrag(PageDetailsFragment.class, bundle));
            }
        }

        @Override
        public void onRefreshFinished() {
            setRefreshing(false);
        }
    }, mDefaultSelectedPageTitle);
    configureRecyclerView(mRootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
    return mRootView;
}
Also used : Navigation(com.instructure.interactions.Navigation) PageListRecyclerAdapter(com.instructure.candroid.adapter.PageListRecyclerAdapter) Bundle(android.os.Bundle) AdapterToFragmentCallback(com.instructure.candroid.interfaces.AdapterToFragmentCallback) Page(com.instructure.canvasapi2.models.Page)

Aggregations

Bundle (android.os.Bundle)1 PageListRecyclerAdapter (com.instructure.candroid.adapter.PageListRecyclerAdapter)1 AdapterToFragmentCallback (com.instructure.candroid.interfaces.AdapterToFragmentCallback)1 Page (com.instructure.canvasapi2.models.Page)1 Navigation (com.instructure.interactions.Navigation)1