use of com.instructure.candroid.adapter.AssignmentDateListRecyclerAdapter in project instructure-android by instructure.
the class AssignmentListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mRootView = inflater.inflate(R.layout.assignment_list_layout, container, false);
mToolbar = mRootView.findViewById(R.id.toolbar);
setUpCallbacks();
mAdapterToAssignmentsCallback = new AdapterToAssignmentsCallback() {
@Override
public void setTermSpinnerState(boolean isEnabled) {
mTermSpinner.setEnabled(isEnabled);
if (mTermAdapter != null) {
if (isEnabled) {
mTermAdapter.setIsLoading(false);
} else {
mTermAdapter.setIsLoading(true);
}
mTermAdapter.notifyDataSetChanged();
}
}
@Override
public void onRowClicked(Assignment assignment, int position, boolean isOpenDetail) {
Navigation navigation = getNavigation();
if (navigation != null) {
Bundle bundle = AssignmentFragment.Companion.createBundle((Course) getCanvasContext(), assignment);
navigation.addFragment(FragUtils.getFrag(AssignmentFragment.class, bundle));
}
}
@Override
public void onRefreshFinished() {
setRefreshing(false);
}
};
// Just load the AssignmentGroup list in the case that its a Group
mRecyclerAdapter = new AssignmentDateListRecyclerAdapter(getContext(), getCanvasContext(), mGradingPeriodsCallback, mAdapterToAssignmentsCallback);
configureRecyclerView(mRootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
mTermSpinner = mRootView.findViewById(R.id.termSpinner);
mTermSpinnerLayout = mRootView.findViewById(R.id.termSpinnerLayout);
AppBarLayout appBarLayout = mRootView.findViewById(R.id.appbar);
View shadow = mRootView.findViewById(R.id.shadow);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
shadow.setVisibility(View.GONE);
} else {
shadow.setVisibility(View.VISIBLE);
}
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
// workaround for Toolbar not showing with swipe to refresh
if (i == 0) {
setRefreshingEnabled(true);
} else {
setRefreshingEnabled(false);
}
}
});
return mRootView;
}
Aggregations