Search in sources :

Example 1 with Course

use of com.shu.studentmanager.entity.Course in project student-manager by SYYANI.

the class ScoreStudentAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull ScoreStudentAdapter.ViewHolder holder, int position) {
    if (scoreStudentList != null && scoreStudentList.size() > 0) {
        Course courseStudentEntity = scoreStudentList.get(position);
        holder.score_review_course_id_cid.setText(courseStudentEntity.getCid());
        holder.score_review_course_name_cname.setText(courseStudentEntity.getCname());
        holder.score_review_teacher_tid.setText(courseStudentEntity.getTid());
        holder.score_review_teacher_tname.setText(courseStudentEntity.getTname());
        holder.score_review_student_grade.setText(courseStudentEntity.getGrade());
        holder.score_review_study_ccredit.setText(courseStudentEntity.getCcredit());
    }
}
Also used : Course(com.shu.studentmanager.entity.Course)

Example 2 with Course

use of com.shu.studentmanager.entity.Course in project student-manager by SYYANI.

the class ScoreReviewFragment method initScoreReviewList.

private void initScoreReviewList() {
    StudentManagerApplication application = (StudentManagerApplication) getActivity().getApplication();
    String url = "http://101.35.20.64:10086/SCT/findBySid/" + application.getId() + "/" + application.getCurrentTerm();
    new Thread() {

        @Override
        public void run() {
            super.run();
            OkHttpClient client = new OkHttpClient().newBuilder().build();
            Request request = new Request.Builder().url(url).method("GET", null).build();
            Response response;
            try {
                response = client.newCall(request).execute();
                if (response.isSuccessful()) {
                    ArrayList<Course> slist = null;
                    slist = new Gson().fromJson(response.body().string(), new TypeToken<ArrayList<Course>>() {
                    }.getType());
                    scoreReviewViewModel.setMutableLiveData_score_review_score_list(slist);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }.start();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) Request(okhttp3.Request) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) IOException(java.io.IOException) Response(okhttp3.Response) TypeToken(com.google.gson.reflect.TypeToken) StudentManagerApplication(com.shu.studentmanager.StudentManagerApplication) Course(com.shu.studentmanager.entity.Course)

Example 3 with Course

use of com.shu.studentmanager.entity.Course in project student-manager by SYYANI.

the class ScoreReviewFragment method setScoreListRecyclerview.

private void setScoreListRecyclerview() {
    score_review_list_recyclerview.setHasFixedSize(true);
    score_review_list_recyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
    scoreStudentAdapter = new ScoreStudentAdapter(getActivity());
    score_review_list_recyclerview.setAdapter(scoreStudentAdapter);
    scoreReviewViewModel.getMutableLiveData_score_review_score_list().observe(getActivity(), new Observer<ArrayList<Course>>() {

        @Override
        public void onChanged(ArrayList<Course> courses) {
            scoreStudentAdapter.updateScoreStudentList(courses);
        }
    });
}
Also used : ScoreStudentAdapter(com.shu.studentmanager.adpater.ScoreStudentAdapter) ArrayList(java.util.ArrayList) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Course(com.shu.studentmanager.entity.Course)

Aggregations

Course (com.shu.studentmanager.entity.Course)3 ArrayList (java.util.ArrayList)2 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 Gson (com.google.gson.Gson)1 TypeToken (com.google.gson.reflect.TypeToken)1 StudentManagerApplication (com.shu.studentmanager.StudentManagerApplication)1 ScoreStudentAdapter (com.shu.studentmanager.adpater.ScoreStudentAdapter)1 IOException (java.io.IOException)1 OkHttpClient (okhttp3.OkHttpClient)1 Request (okhttp3.Request)1 Response (okhttp3.Response)1