Search in sources :

Example 1 with NotificationListRecyclerAdapter

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

the class NotificationListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView = getLayoutInflater().inflate(R.layout.fragment_list_notification, container, false);
    mToolbar = mRootView.findViewById(R.id.toolbar);
    mAdapterToFragmentCallback = new NotificationAdapterToFragmentCallback<StreamItem>() {

        @Override
        public void onRowClicked(StreamItem streamItem, int position, boolean isOpenDetail) {
            mRecyclerAdapter.setSelectedPosition(position);
            Navigation navigation = getNavigation();
            if (navigation != null) {
                onRowClick(streamItem, isOpenDetail);
            }
        }

        @Override
        public void onRefreshFinished() {
            setRefreshing(false);
            mEditOptions.setVisibility(View.GONE);
        }

        @Override
        public void onShowEditView(boolean isVisible) {
            mEditOptions.setVisibility(isVisible ? View.VISIBLE : View.GONE);
        }

        @Override
        public void onShowErrorCrouton(int message) {
            showToast(message);
        }
    };
    mRecyclerAdapter = new NotificationListRecyclerAdapter(getContext(), getCanvasContext(), onNotificationCountInvalidated, mAdapterToFragmentCallback);
    configureRecyclerView(mRootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
    PandaRecyclerView pandaRecyclerView = mRootView.findViewById(R.id.listView);
    pandaRecyclerView.setSelectionEnabled(false);
    configureViews(mRootView);
    return mRootView;
}
Also used : Navigation(com.instructure.interactions.Navigation) NotificationListRecyclerAdapter(com.instructure.candroid.adapter.NotificationListRecyclerAdapter) StreamItem(com.instructure.canvasapi2.models.StreamItem) PandaRecyclerView(com.instructure.pandarecycler.PandaRecyclerView)

Aggregations

NotificationListRecyclerAdapter (com.instructure.candroid.adapter.NotificationListRecyclerAdapter)1 StreamItem (com.instructure.canvasapi2.models.StreamItem)1 Navigation (com.instructure.interactions.Navigation)1 PandaRecyclerView (com.instructure.pandarecycler.PandaRecyclerView)1