use of com.shu.studentmanager.entity.CourseTeacher in project student-manager by SYYANI.
the class CourseAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull CourseAdapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
if (coursesList != null && coursesList.size() > 0) {
CourseTeacher course_entity = coursesList.get(position);
holder.course_id_cid.setText(course_entity.getCid());
holder.course_name_cname.setText(course_entity.getCname());
holder.course_credit_ccredit.setText(course_entity.getCcredit());
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
new MaterialAlertDialogBuilder(context).setTitle("确认").setMessage("确定不开设该课程?").setNeutralButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Log.d(TAG, "onClick: " + which + " " + position);
enSureDelete(coursesList.get(position));
}
}).show();
return false;
}
});
} else {
return;
}
}
use of com.shu.studentmanager.entity.CourseTeacher in project student-manager by SYYANI.
the class CourseManageAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull CourseManageAdapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
if (courseManageList != null && courseManageList.size() > 0) {
CourseTeacher courseEntity = courseManageList.get(position);
holder.course_id_cid.setText(courseEntity.getCid());
holder.course_name_cname.setText(courseEntity.getCname());
holder.course_credit_ccredit.setText(courseEntity.getCcredit());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.P)
@Override
public void onClick(View view) {
showAlertDialogMode(position, holder.course_name_cname);
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
new MaterialAlertDialogBuilder(context).setTitle("确认").setMessage("确定删除该课程?").setNeutralButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Log.d(TAG, "onClick: " + which + " " + position);
enSureDelete(courseManageList.get(position));
}
}).show();
return false;
}
});
} else {
return;
}
}
use of com.shu.studentmanager.entity.CourseTeacher 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);
}
});
}
Aggregations