use of com.lieverandiver.thesisproject.adapter.StudentAdapter in project classify-system by anverliedoit.
the class GradeViewActivity method initRView.
public void initRView(final long classId) {
final Handler handler = new Handler(getMainLooper());
new Thread(new Runnable() {
@Override
public void run() {
try {
final ClassServiceImpl classService = new ClassServiceImpl();
final List<Student> studenList = new ArrayList<>();
final Set<Student> studentSet = classService.getStudentList(classId);
for (Student student : studentSet) studenList.add(student);
final StudentAdapter studentAdapter = new StudentAdapter(GradeViewActivity.this, studenList);
final LinearLayoutManager layoutManager = new LinearLayoutManager(GradeViewActivity.this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
handler.post(new Runnable() {
@Override
public void run() {
recyclerView.setAdapter(studentAdapter);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
if (studenList.size() < 1)
txtMsgContent.setVisibility(View.VISIBLE);
}
});
} catch (ClassException e) {
e.printStackTrace();
}
}
}).start();
}
use of com.lieverandiver.thesisproject.adapter.StudentAdapter in project classify-system by anverliedoit.
the class StudentViewActivity method initRView.
public void initRView(final long classId) {
final Handler handler = new Handler(getMainLooper());
new Thread(new Runnable() {
@Override
public void run() {
try {
final ClassServiceImpl classService = new ClassServiceImpl();
final List<Student> studenList = new ArrayList<>();
final Set<Student> studentSet = classService.getStudentList(classId);
for (Student student : studentSet) studenList.add(student);
Collections.sort(studenList, new Comparator<Student>() {
@Override
public int compare(final Student object1, final Student object2) {
return object1.getLastName().compareTo(object2.getLastName());
}
});
final StudentAdapter studentAdapter = new StudentAdapter(StudentViewActivity.this, studenList);
final LinearLayoutManager layoutManager = new LinearLayoutManager(StudentViewActivity.this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
handler.post(new Runnable() {
@Override
public void run() {
recyclerView.setAdapter(studentAdapter);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
if (studenList.size() < 1)
txtMsgContent.setVisibility(View.VISIBLE);
}
});
} catch (ClassException e) {
e.printStackTrace();
}
}
}).start();
}
Aggregations