use of com.instructure.speedgrader.activities.HomeActivity in project instructure-android by instructure.
the class AssignmentListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
if (savedInstanceState != null) {
loadSavedInstanceState(savedInstanceState);
}
mAdapterToFragmentCallback = new AssignmentAdapterToFragmentCallback() {
@Override
public void onRowClicked(Assignment assignment) {
if (mSectionsSpinner.getSelectedItem() != null) {
startActivityForResult(DocumentActivity.createIntent(getContext(), getCanvasContext(), assignment, ((Section) mSectionsSpinner.getSelectedItem()).getId()), Const.UPDATED_ASSIGNMENT_FLAGS);
} else {
startActivityForResult(DocumentActivity.createIntent(getContext(), getCanvasContext(), assignment, getAllSectionsItem().getId()), Const.UPDATED_ASSIGNMENT_FLAGS);
}
}
@Override
public void onRefreshFinished() {
setRefreshing(false);
}
@Override
public Section getCurrentSection() {
if (mSectionsSpinner == null || mSectionsSpinner.getSelectedItem() == null) {
return getAllSectionsItem();
}
return (Section) mSectionsSpinner.getSelectedItem();
}
@Override
public void onSectionsLoaded(List<Section> sections) {
if (!isAdded()) {
return;
}
mSections = sections;
if (mSectionsSpinner != null) {
createSectionsSpinner();
}
}
};
if (mRecyclerAdapter == null) {
mRecyclerAdapter = new AssignmentGroupListRecyclerAdapter(getContext(), getCanvasContext(), mAdapterToFragmentCallback);
}
if (getActivity() instanceof HomeActivity) {
((HomeActivity) getActivity()).hideDrawer();
}
handleActionBarColor();
setTitle(getCanvasContext().getName());
configureRecyclerViewAsGrid(mRootView, mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
if (isRouting) {
isRouting = false;
startActivityForResult(DocumentActivity.createIntent(getContext(), getCanvasContext(), mRoutedAssignment, getAllSectionsItem().getId()), Const.UPDATED_ASSIGNMENT_FLAGS);
getActivity().overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
}
return mRootView;
}
Aggregations