use of com.instructure.interactions.Navigation in project instructure-android by instructure.
the class ToDoListFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
String title = getArguments().getString(Const.TITLE, title());
mToolbar.setTitle(title);
Navigation navigation = getNavigation();
if (navigation != null)
navigation.attachNavigationDrawer(this, mToolbar);
// Styling done in attachNavigationDrawer
}
use of com.instructure.interactions.Navigation in project instructure-android by instructure.
the class ToDoListFragment method onRowClick.
private void onRowClick(ToDo toDo) {
if (toDo == null) {
return;
}
Bundle bundle = new Bundle();
bundle.putParcelable(Const.SELECTED_ITEM, toDo);
Navigation navigation = getNavigation();
if (navigation != null) {
if (toDo.getAssignment() != null) {
// Launch assignment details fragment.
navigation.addFragment(FragUtils.getFrag(AssignmentFragment.class, createBundle(toDo.getCanvasContext(), toDo.getAssignment())));
} else if (toDo.getScheduleItem() != null) {
// It's a Calendar event from the Upcoming API.
ScheduleItem scheduleItem = toDo.getScheduleItem();
String actionBarTitle = "";
if (scheduleItem.getContextType() == CanvasContext.Type.COURSE) {
actionBarTitle = toDo.getCanvasContext().getName();
} else if (scheduleItem.getContextType() == CanvasContext.Type.USER) {
actionBarTitle = getContext().getString(R.string.PersonalCalendar);
}
navigation.addFragment(FragUtils.getFrag(CalendarEventFragment.class, createBundle(toDo.getCanvasContext(), actionBarTitle, toDo.getScheduleItem())));
}
}
}
use of com.instructure.interactions.Navigation in project instructure-android by instructure.
the class AddSubmissionFragment method setUpCallback.
// /////////////////////////////////////////////////////////////////////////
// CallBack
// /////////////////////////////////////////////////////////////////////////
public void setUpCallback() {
canvasCallbackSubmission = new StatusCallback<Submission>() {
@Override
public void onResponse(@NonNull Response<Submission> response, @NonNull LinkHeaders linkHeaders, @NonNull ApiType type) {
if (!apiCheck()) {
return;
}
Submission result = response.body();
if (result.getBody() != null || result.getUrl() != null) {
Toast.makeText(getActivity(), R.string.successPostingSubmission, Toast.LENGTH_LONG).show();
// clear text fields because they are saved
textSubmission.setText("");
urlSubmission.setText("");
// Send broadcast so list is updated.
EventBus.getDefault().post(new FileUploadEvent(new FileUploadNotification(null, new ArrayList<Attachment>())));
Navigation navigation = getNavigation();
if (navigation != null)
navigation.popCurrentFragment();
} else {
Toast.makeText(getActivity(), R.string.errorPostingSubmission, Toast.LENGTH_LONG).show();
}
}
};
mLTIToolCallback = new StatusCallback<List<LTITool>>() {
@Override
public void onResponse(@NonNull Response<List<LTITool>> response, @NonNull LinkHeaders linkHeaders, @NonNull ApiType type) {
for (LTITool ltiTool : response.body()) {
final String url = ltiTool.getUrl();
if (url != null && url.contains("instructuremedia.com/lti/launch")) {
mArcUpload.setVisibility(View.VISIBLE);
mArcLTITool = ltiTool;
break;
}
}
// check to see if we should automatically show the file upload dialog
showFileUploadDialog();
}
@Override
public void onFail(@Nullable Call<List<LTITool>> call, @NonNull Throwable error, @Nullable Response response) {
// we don't want to show it if this failed due to there being no cache
if (response != null && response.code() != 504) {
showFileUploadDialog();
}
}
};
}
use of com.instructure.interactions.Navigation in project instructure-android by instructure.
the class CalendarListViewFragment method eventCreation.
private void eventCreation() {
if (!APIHelper.hasNetworkConnection()) {
Toast.makeText(getContext(), getContext().getString(R.string.notAvailableOffline), Toast.LENGTH_SHORT).show();
return;
}
Analytics.trackAppFlow(getActivity(), CreateCalendarEventFragment.class);
Navigation navigation = getNavigation();
if (navigation != null) {
ParentFragment fragment = FragUtils.getFrag(CreateCalendarEventFragment.class, CreateCalendarEventFragment.createBundle(getCanvasContext(), mRecyclerAdapter.getSelectedDay().getMilliseconds(TimeZone.getDefault())));
navigation.addFragment(fragment);
}
}
use of com.instructure.interactions.Navigation 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;
}
Aggregations