Search in sources :

Example 21 with ScheduleItem

use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.

the class ScheduleItemTest method getContextIdTest_Course.

@Test
public void getContextIdTest_Course() throws Exception {
    ScheduleItem scheduleItem = new ScheduleItem();
    scheduleItem.setContextCode("course_12345");
    assertEquals(12345, scheduleItem.getContextId());
}
Also used : ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Test(org.junit.Test)

Example 22 with ScheduleItem

use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.

the class ScheduleItemTest method getUserIdTest.

@Test
public void getUserIdTest() throws Exception {
    ScheduleItem scheduleItem = new ScheduleItem();
    scheduleItem.setContextCode("user_12345");
    assertEquals(12345, scheduleItem.getUserId());
}
Also used : ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Test(org.junit.Test)

Example 23 with ScheduleItem

use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.

the class ScheduleItemTest method getCourseIdTest.

@Test
public void getCourseIdTest() throws Exception {
    ScheduleItem scheduleItem = new ScheduleItem();
    scheduleItem.setContextCode("course_12345");
    assertEquals(12345, scheduleItem.getCourseId());
}
Also used : ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Test(org.junit.Test)

Example 24 with ScheduleItem

use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.

the class ScheduleListFragment method onCreateView.

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

        @Override
        public void onRowClicked(ScheduleItem scheduleItem, int position, boolean isOpenDetail) {
            Navigation navigation = getNavigation();
            if (navigation != null) {
                ParentFragment fragment;
                if (scheduleItem.getAssignment() != null) {
                    fragment = FragUtils.getFrag(AssignmentFragment.class, AssignmentFragment.Companion.createBundle((Course) getCanvasContext(), scheduleItem.getAssignment()));
                } else if (scheduleItem.getItemType() == ScheduleItem.Type.TYPE_SYLLABUS) {
                    fragment = FragUtils.getFrag(SyllabusFragment.class, SyllabusFragment.Companion.createBundle((Course) getCanvasContext(), scheduleItem));
                } else {
                    fragment = FragUtils.getFrag(CalendarEventFragment.class, CalendarEventFragment.createBundle(getCanvasContext(), scheduleItem));
                }
                navigation.addFragment(fragment);
            }
        }

        @Override
        public void onRefreshFinished() {
            setRefreshing(false);
        }
    };
    mRecyclerAdapter = new SyllabusRecyclerAdapter(getContext(), getCanvasContext(), mAdapterToFragmentCallback);
    configureRecyclerView(mRootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
    return mRootView;
}
Also used : SyllabusRecyclerAdapter(com.instructure.candroid.adapter.SyllabusRecyclerAdapter) ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Navigation(com.instructure.interactions.Navigation) Course(com.instructure.canvasapi2.models.Course)

Example 25 with ScheduleItem

use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.

the class ScheduleListFragment method handleIntentExtras.

@Override
public void handleIntentExtras(Bundle extras) {
    super.handleIntentExtras(extras);
    if (extras == null) {
        return;
    }
    ViewUtils.showCroutonFromBundle(getActivity(), extras);
    addSyllabus = Tab.SYLLABUS_ID.equals(extras.getString(Const.TAB_ID)) || extras.getBoolean(Const.ADD_SYLLABUS);
    if (extras.containsKey(Const.SELECTED_ITEM)) {
        ScheduleItem scheduleItem = extras.getParcelable(Const.SELECTED_ITEM);
        if (scheduleItem != null) {
            setDefaultSelectedId(scheduleItem.getId());
        }
    }
}
Also used : ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem)

Aggregations

ScheduleItem (com.instructure.canvasapi2.models.ScheduleItem)29 Test (org.junit.Test)19 Date (java.util.Date)13 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)9 RestParams (com.instructure.canvasapi2.builders.RestParams)8 Assignment (com.instructure.canvasapi2.models.Assignment)7 ArrayList (java.util.ArrayList)5 View (android.view.View)3 Course (com.instructure.canvasapi2.models.Course)3 List (java.util.List)3 Drawable (android.graphics.drawable.Drawable)2 NonNull (android.support.annotation.NonNull)2 Gson (com.google.gson.Gson)2 GsonBuilder (com.google.gson.GsonBuilder)2 ToDo (com.instructure.canvasapi2.models.ToDo)2 Navigation (com.instructure.interactions.Navigation)2 DateTime (hirondelle.date4j.DateTime)2 Bundle (android.os.Bundle)1 TextView (android.widget.TextView)1 SyllabusRecyclerAdapter (com.instructure.candroid.adapter.SyllabusRecyclerAdapter)1