Search in sources :

Example 1 with ClassServiceImpl

use of com.remswork.project.alice.service.impl.ClassServiceImpl in project classify-system by anverliedoit.

the class ScheduleViewActivity 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<Schedule> scheduleList = new ArrayList<>();
                final Set<Schedule> scheduleSet = classService.getScheduleList(classId);
                for (Schedule schedule : scheduleSet) scheduleList.add(schedule);
                final ScheduleAdapter scheduleAdapter = new ScheduleAdapter(ScheduleViewActivity.this, scheduleList);
                final LinearLayoutManager layoutManager = new LinearLayoutManager(ScheduleViewActivity.this);
                layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                handler.post(new Runnable() {

                    @Override
                    public void run() {
                        recyclerView.setAdapter(scheduleAdapter);
                        recyclerView.setLayoutManager(layoutManager);
                        recyclerView.setItemAnimator(new DefaultItemAnimator());
                        if (scheduleSet.size() < 1)
                            txtMsgContent.setVisibility(View.VISIBLE);
                    }
                });
            } catch (ClassException e) {
                e.printStackTrace();
            }
        }
    }).start();
}
Also used : ScheduleAdapter(com.lieverandiver.thesisproject.adapter.ScheduleAdapter) ArrayList(java.util.ArrayList) Handler(android.os.Handler) ClassException(com.remswork.project.alice.exception.ClassException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) Schedule(com.remswork.project.alice.model.Schedule) ClassServiceImpl(com.remswork.project.alice.service.impl.ClassServiceImpl)

Example 2 with ClassServiceImpl

use of com.remswork.project.alice.service.impl.ClassServiceImpl 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();
}
Also used : ScheduleAdapter(com.lieverandiver.thesisproject.ScheduleAdapter) ArrayList(java.util.ArrayList) ClassException(com.remswork.project.alice.exception.ClassException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) Schedule(com.remswork.project.alice.model.Schedule) ClassServiceImpl(com.remswork.project.alice.service.impl.ClassServiceImpl) Class(com.remswork.project.alice.model.Class) RecyclerView(android.support.v7.widget.RecyclerView) TeacherHelper(com.lieverandiver.thesisproject.helper.TeacherHelper)

Example 3 with ClassServiceImpl

use of com.remswork.project.alice.service.impl.ClassServiceImpl 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();
}
Also used : ArrayList(java.util.ArrayList) StudentAdapter(com.lieverandiver.thesisproject.adapter.StudentAdapter) Handler(android.os.Handler) ClassException(com.remswork.project.alice.exception.ClassException) Student(com.remswork.project.alice.model.Student) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) ClassServiceImpl(com.remswork.project.alice.service.impl.ClassServiceImpl)

Example 4 with ClassServiceImpl

use of com.remswork.project.alice.service.impl.ClassServiceImpl 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();
}
Also used : ArrayList(java.util.ArrayList) StudentAdapter(com.lieverandiver.thesisproject.adapter.StudentAdapter) Handler(android.os.Handler) ClassException(com.remswork.project.alice.exception.ClassException) Student(com.remswork.project.alice.model.Student) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) ClassServiceImpl(com.remswork.project.alice.service.impl.ClassServiceImpl)

Example 5 with ClassServiceImpl

use of com.remswork.project.alice.service.impl.ClassServiceImpl in project classify-system by anverliedoit.

the class SliderClassFragment method init.

public void init() {
    new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                List<Class> classList = new ClassServiceImpl().getClassListByTeacherId(new TeacherHelper(getContext()).loadUser().get().getId());
                final ClassAdapter classAdapter = new ClassAdapter(getContext(), classList);
                final RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(), 2);
                handler.post(new Runnable() {

                    @Override
                    public void run() {
                        recyclerView.setAdapter(classAdapter);
                        recyclerView.setLayoutManager(layoutManager);
                        recyclerView.setItemAnimator(new DefaultItemAnimator());
                        progressBar.setVisibility(View.INVISIBLE);
                    }
                });
            } catch (ClassException e) {
                e.printStackTrace();
            }
        }
    }).start();
}
Also used : ClassAdapter(com.lieverandiver.thesisproject.adapter.ClassAdapter) ClassException(com.remswork.project.alice.exception.ClassException) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) GridLayoutManager(android.support.v7.widget.GridLayoutManager) ClassServiceImpl(com.remswork.project.alice.service.impl.ClassServiceImpl) Class(com.remswork.project.alice.model.Class) RecyclerView(android.support.v7.widget.RecyclerView) TeacherHelper(com.lieverandiver.thesisproject.helper.TeacherHelper)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)5 ClassException (com.remswork.project.alice.exception.ClassException)5 ClassServiceImpl (com.remswork.project.alice.service.impl.ClassServiceImpl)5 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 ArrayList (java.util.ArrayList)4 Handler (android.os.Handler)3 RecyclerView (android.support.v7.widget.RecyclerView)2 StudentAdapter (com.lieverandiver.thesisproject.adapter.StudentAdapter)2 TeacherHelper (com.lieverandiver.thesisproject.helper.TeacherHelper)2 Class (com.remswork.project.alice.model.Class)2 Schedule (com.remswork.project.alice.model.Schedule)2 Student (com.remswork.project.alice.model.Student)2 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 ScheduleAdapter (com.lieverandiver.thesisproject.ScheduleAdapter)1 ClassAdapter (com.lieverandiver.thesisproject.adapter.ClassAdapter)1 ScheduleAdapter (com.lieverandiver.thesisproject.adapter.ScheduleAdapter)1