use of com.lieverandiver.thesisproject.ScheduleAdapter in project classify-system by anverliedoit.
the class Home_Schedule_Slidebar_Fragment method init.
public void init() {
new Thread(new Runnable() {
@Override
public void run() {
try {
final List<Schedule> scheduleList = new ArrayList<>();
TeacherHelper teacherHelper = new TeacherHelper(getContext());
ClassServiceImpl classService = new ClassServiceImpl();
Class _class = null;
for (Class c : classService.getClassList()) {
if (c.getTeacher() == null)
continue;
if (c.getTeacher().getId() == teacherHelper.loadUser().get().getId()) {
_class = c;
Log.i("myTAG", "id : " + c.getId());
break;
}
}
// test
_class = classService.getClassById(40);
if (_class != null) {
for (Schedule schedule : classService.getScheduleList(_class.getId())) scheduleList.add(schedule);
}
handler.post(new Runnable() {
@Override
public void run() {
scheduleRecyclerView = (RecyclerView) customView.findViewById(R.id.shedule_recyclerview);
ScheduleAdapter scheduleAdapter = new ScheduleAdapter(getContext(), scheduleList);
scheduleRecyclerView.setAdapter(scheduleAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
scheduleRecyclerView.setLayoutManager(layoutManager);
scheduleRecyclerView.setItemAnimator(new DefaultItemAnimator());
}
});
} catch (ClassException e) {
e.printStackTrace();
}
}
}).start();
}
Aggregations