Search in sources :

Example 1 with AdapterToFragmentCallback

use of com.instructure.candroid.interfaces.AdapterToFragmentCallback 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)

Example 2 with AdapterToFragmentCallback

use of com.instructure.candroid.interfaces.AdapterToFragmentCallback in project instructure-android by instructure.

the class RubricFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_list, container, false);
    rootView.findViewById(R.id.fragment_container).setBackgroundColor(Color.WHITE);
    EmptyPandaView emptyRubricView = (EmptyPandaView) rootView.findViewById(R.id.emptyPandaView);
    mRecyclerAdapter = new RubricRecyclerAdapter(getContext(), getCanvasContext(), new AdapterToFragmentCallback() {

        @Override
        public void onRowClicked(Object o, int position, boolean isOpenDetail) {
        }

        @Override
        public void onRefreshFinished() {
            setRefreshing(false);
        }
    });
    configureRecyclerView(rootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
    PandaRecyclerView pandaRecyclerView = (PandaRecyclerView) rootView.findViewById(R.id.listView);
    pandaRecyclerView.addItemDecoration(new RubricDecorator(getContext()));
    return rootView;
}
Also used : EmptyPandaView(com.instructure.candroid.view.EmptyPandaView) PandaRecyclerView(com.instructure.pandarecycler.PandaRecyclerView) RubricDecorator(com.instructure.candroid.decorations.RubricDecorator) AdapterToFragmentCallback(com.instructure.candroid.interfaces.AdapterToFragmentCallback) BeforePageView(com.instructure.canvasapi2.utils.pageview.BeforePageView) PageView(com.instructure.canvasapi2.utils.pageview.PageView) EmptyPandaView(com.instructure.candroid.view.EmptyPandaView) View(android.view.View) PandaRecyclerView(com.instructure.pandarecycler.PandaRecyclerView) RubricRecyclerAdapter(com.instructure.candroid.adapter.RubricRecyclerAdapter)

Example 3 with AdapterToFragmentCallback

use of com.instructure.candroid.interfaces.AdapterToFragmentCallback in project instructure-android by instructure.

the class MasteryPathOptionsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    mRootView = getLayoutInflater().inflate(R.layout.fragment_mastery_paths_options, container, false);
    mRecyclerAdapter = new MasteryPathOptionsRecyclerAdapter(getContext(), getCanvasContext(), mAssignments, new AdapterToFragmentCallback<Assignment>() {

        @Override
        public void onRowClicked(Assignment assignment, int position, boolean isOpenDetail) {
            Navigation navigation = getNavigation();
            if (navigation != null) {
                Bundle bundle = AssignmentBasicFragment.createBundle(getCanvasContext(), assignment);
                navigation.addFragment(FragUtils.getFrag(AssignmentBasicFragment.class, bundle));
            }
        }

        @Override
        public void onRefreshFinished() {
        }
    });
    configureRecyclerView(mRootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
    // disable the swiperefreshlayout because we don't want to pull to refresh. It doesn't make an API call, so it wouldn't refresh anything
    mRootView.findViewById(R.id.swipeRefreshLayout).setEnabled(false);
    mSelect = (Button) mRootView.findViewById(R.id.select_option);
    mSelect.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            ModuleManager.selectMasteryPath(getCanvasContext(), mModuleObjectId, mModuleItemId, mAssignmentSet.getId(), mSelectOptionCallback);
        }
    });
    setupCallbacks();
    return mRootView;
}
Also used : MasteryPathAssignment(com.instructure.canvasapi2.models.MasteryPathAssignment) Assignment(com.instructure.canvasapi2.models.Assignment) Navigation(com.instructure.interactions.Navigation) MasteryPathOptionsRecyclerAdapter(com.instructure.candroid.adapter.MasteryPathOptionsRecyclerAdapter) Bundle(android.os.Bundle) AdapterToFragmentCallback(com.instructure.candroid.interfaces.AdapterToFragmentCallback) View(android.view.View)

Aggregations

AdapterToFragmentCallback (com.instructure.candroid.interfaces.AdapterToFragmentCallback)3 Bundle (android.os.Bundle)2 View (android.view.View)2 Navigation (com.instructure.interactions.Navigation)2 MasteryPathOptionsRecyclerAdapter (com.instructure.candroid.adapter.MasteryPathOptionsRecyclerAdapter)1 PageListRecyclerAdapter (com.instructure.candroid.adapter.PageListRecyclerAdapter)1 RubricRecyclerAdapter (com.instructure.candroid.adapter.RubricRecyclerAdapter)1 RubricDecorator (com.instructure.candroid.decorations.RubricDecorator)1 EmptyPandaView (com.instructure.candroid.view.EmptyPandaView)1 Assignment (com.instructure.canvasapi2.models.Assignment)1 MasteryPathAssignment (com.instructure.canvasapi2.models.MasteryPathAssignment)1 Page (com.instructure.canvasapi2.models.Page)1 BeforePageView (com.instructure.canvasapi2.utils.pageview.BeforePageView)1 PageView (com.instructure.canvasapi2.utils.pageview.PageView)1 PandaRecyclerView (com.instructure.pandarecycler.PandaRecyclerView)1