Search in sources :

Example 1 with ClassAdapter

use of com.lieverandiver.thesisproject.adapter.ClassAdapter 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)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 ClassAdapter (com.lieverandiver.thesisproject.adapter.ClassAdapter)1 TeacherHelper (com.lieverandiver.thesisproject.helper.TeacherHelper)1 ClassException (com.remswork.project.alice.exception.ClassException)1 Class (com.remswork.project.alice.model.Class)1 ClassServiceImpl (com.remswork.project.alice.service.impl.ClassServiceImpl)1