Search in sources :

Example 1 with ScheduleAdapter

use of com.lieverandiver.thesisproject.adapter.ScheduleAdapter 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 ScheduleAdapter

use of com.lieverandiver.thesisproject.adapter.ScheduleAdapter in project classify-system by anverliedoit.

the class SliderScheduleFragment method init.

public void init() {
    Collections.sort(scheduleList, new Comparator<Schedule>() {

        @Override
        public int compare(Schedule o1, Schedule o2) {
            return (o1.getTime().compareTo(o2.getTime()));
        }
    });
    scheduleRecyclerView = (RecyclerView) customView.findViewById(R.id.shedule_recyclerview);
    scheduleAdapter = new ScheduleAdapter(getContext(), scheduleList);
    scheduleRecyclerView.setAdapter(scheduleAdapter);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    scheduleRecyclerView.setLayoutManager(layoutManager);
    scheduleRecyclerView.setItemAnimator(new DefaultItemAnimator());
    scheduleRecyclerView.setVisibility(View.VISIBLE);
    progressBar.setVisibility(View.INVISIBLE);
}
Also used : ScheduleAdapter(com.lieverandiver.thesisproject.adapter.ScheduleAdapter) Schedule(com.remswork.project.alice.model.Schedule) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 ScheduleAdapter (com.lieverandiver.thesisproject.adapter.ScheduleAdapter)2 Schedule (com.remswork.project.alice.model.Schedule)2 Handler (android.os.Handler)1 ClassException (com.remswork.project.alice.exception.ClassException)1 ClassServiceImpl (com.remswork.project.alice.service.impl.ClassServiceImpl)1 ArrayList (java.util.ArrayList)1