Search in sources :

Example 11 with Navigation

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
}
Also used : Navigation(com.instructure.interactions.Navigation)

Example 12 with Navigation

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())));
        }
    }
}
Also used : ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Navigation(com.instructure.interactions.Navigation) Bundle(android.os.Bundle)

Example 13 with Navigation

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();
            }
        }
    };
}
Also used : Navigation(com.instructure.interactions.Navigation) Submission(com.instructure.canvasapi2.models.Submission) LTITool(com.instructure.canvasapi2.models.LTITool) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) ArrayList(java.util.ArrayList) FileUploadNotification(com.instructure.pandautils.utils.FileUploadNotification) Response(retrofit2.Response) ApiType(com.instructure.canvasapi2.utils.ApiType) FileUploadEvent(com.instructure.pandautils.utils.FileUploadEvent) List(java.util.List) ArrayList(java.util.ArrayList)

Example 14 with Navigation

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);
    }
}
Also used : Navigation(com.instructure.interactions.Navigation)

Example 15 with Navigation

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;
}
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

Navigation (com.instructure.interactions.Navigation)17 Bundle (android.os.Bundle)10 Course (com.instructure.canvasapi2.models.Course)5 View (android.view.View)4 Submission (com.instructure.canvasapi2.models.Submission)3 PageView (com.instructure.canvasapi2.utils.pageview.PageView)3 CardView (android.support.v7.widget.CardView)2 AdapterView (android.widget.AdapterView)2 AdapterToFragmentCallback (com.instructure.candroid.interfaces.AdapterToFragmentCallback)2 Assignment (com.instructure.canvasapi2.models.Assignment)2 ScheduleItem (com.instructure.canvasapi2.models.ScheduleItem)2 ArrayList (java.util.ArrayList)2 Intent (android.content.Intent)1 Paint (android.graphics.Paint)1 AppBarLayout (android.support.design.widget.AppBarLayout)1 AlertDialog (android.support.v7.app.AlertDialog)1 RecyclerView (android.support.v7.widget.RecyclerView)1 KeyEvent (android.view.KeyEvent)1 OnClickListener (android.view.View.OnClickListener)1 ViewGroup (android.view.ViewGroup)1