Search in sources :

Example 1 with StudentCourseAdapter

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

the class StudentFragment method setStudentCoureListRecycleView.

private void setStudentCoureListRecycleView() {
    student_course_list_recyclerview.setHasFixedSize(true);
    student_course_list_recyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
    studentCourseAdapter = new StudentCourseAdapter(getActivity());
    student_course_list_recyclerview.setAdapter(studentCourseAdapter);
    // studentViewModel.get
    studentViewModel.getMutableLiveData_student_course_list().observe(getActivity(), new Observer<ArrayList<CourseStudent>>() {

        @Override
        public void onChanged(ArrayList<CourseStudent> courseStudents) {
            // Log.d(TAG, "onChanged: update");
            studentFragmentBinding.studentFragmentStudentClassNumber.setText("本学期共有 " + String.valueOf(courseStudents.size()) + " 门课");
            studentCourseAdapter.updateCourseList(courseStudents);
        }
    });
}
Also used : StudentCourseAdapter(com.shu.studentmanager.adpater.StudentCourseAdapter) CourseStudent(com.shu.studentmanager.entity.CourseStudent) ArrayList(java.util.ArrayList) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

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