Search in sources :

Example 1 with CourseAdapter

use of com.shu.studentmanager.adpater.CourseAdapter in project student-manager by SYYANI.

the class TeacherFragment method setCoureListRecycleView.

private void setCoureListRecycleView() {
    course_list_recycleview.setHasFixedSize(true);
    course_list_recycleview.setLayoutManager(new LinearLayoutManager(getActivity()));
    courseAdapter = new CourseAdapter(getActivity());
    course_list_recycleview.setAdapter(courseAdapter);
    teacherViewModel.getMutableLiveData_course_list().observe(getActivity(), new Observer<ArrayList<CourseTeacher>>() {

        @Override
        public void onChanged(ArrayList<CourseTeacher> courseTeachers) {
            // Log.d(TAG, "onChanged: update");
            teacherFragmentBinding.teacherFragmentTeacherClassNumber.setText("本学期开设 " + String.valueOf(courseTeachers.size()) + " 门课");
            courseAdapter.updateCourseList(courseTeachers);
        }
    });
}
Also used : CourseAdapter(com.shu.studentmanager.adpater.CourseAdapter) ArrayList(java.util.ArrayList) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) CourseTeacher(com.shu.studentmanager.entity.CourseTeacher)

Aggregations

LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 CourseAdapter (com.shu.studentmanager.adpater.CourseAdapter)1 CourseTeacher (com.shu.studentmanager.entity.CourseTeacher)1 ArrayList (java.util.ArrayList)1