Search in sources :

Example 1 with AttendanceInputAdapter

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

the class AttendanceInputActivity method init.

public void init() {
    try {
        hidesomthing = (CardView) findViewById(R.id.input_attendance_hide_save);
        editTextName = (TextView) findViewById(R.id.input_attendance_name);
        textViewDate = (TextView) findViewById(R.id.txtv_date3);
        btnBack = (Button) findViewById(R.id.input_back3);
        buttonSubmit = (Button) findViewById(btn_submit3_attendance);
        btnSelectAll = (Button) findViewById(R.id.btn_selectall3);
        recyclerViewStudentInput = (RecyclerView) findViewById(R.id.recyclerview_view3attendance);
        cardmessage = (CardView) findViewById(R.id.card_message_status);
        txMessageStatus = (TextView) findViewById(R.id.card_message_status_text);
        rlDisruptor = (RelativeLayout) findViewById(R.id.disruptor_loading);
        cardViewSucces = (CardView) findViewById(R.id.input_succes3);
        cardViewFailed = (CardView) findViewById(R.id.input_failed3);
        btnTryagain = (Button) findViewById(R.id.input_tryagain3);
        btnOk = (Button) findViewById(R.id.input_ok3);
        rlDisruptor.setVisibility(View.GONE);
        cardViewSucces.setVisibility(View.GONE);
        cardViewFailed.setVisibility(View.GONE);
        for (Student s : classService.getStudentList(classId)) studentList.add(s);
        attendanceInputAdapter = new AttendanceInputAdapter(this, studentList);
        listener = attendanceInputAdapter;
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerViewStudentInput.setAdapter(attendanceInputAdapter);
        recyclerViewStudentInput.setLayoutManager(layoutManager);
        recyclerViewStudentInput.setItemAnimator(new DefaultItemAnimator());
        String date = String.format(Locale.ENGLISH, "%02d/%02d/%d", Calendar.getInstance().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + 1, Calendar.getInstance().get(Calendar.YEAR));
        textViewDate.setText(date);
        btnSelectAll.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                listener.onSelect(toggleMark);
                if (toggleMark) {
                    btnSelectAll.setText("All unselect");
                    toggleMark = false;
                } else {
                    btnSelectAll.setText("All select");
                    toggleMark = true;
                }
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Student(com.remswork.project.alice.model.Student) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) AttendanceInputAdapter(com.lieverandiver.thesisproject.adapter.AttendanceInputAdapter)

Example 2 with AttendanceInputAdapter

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

the class AttendanceInputActivityF method init.

public void init() {
    try {
        hidesomthing = (CardView) findViewById(R.id.input_attendance_hide_save);
        editTextName = (TextView) findViewById(R.id.input_attendance_name);
        textViewDate = (TextView) findViewById(R.id.txtv_date3);
        btnBack = (Button) findViewById(R.id.input_back3);
        buttonSubmit = (Button) findViewById(btn_submit3_attendance);
        btnSelectAll = (Button) findViewById(R.id.btn_selectall3);
        recyclerViewStudentInput = (RecyclerView) findViewById(R.id.recyclerview_view3attendance);
        cardmessage = (CardView) findViewById(R.id.card_message_status);
        txMessageStatus = (TextView) findViewById(R.id.card_message_status_text);
        rlDisruptor = (RelativeLayout) findViewById(R.id.disruptor_loading);
        cardViewSucces = (CardView) findViewById(R.id.input_succes3);
        cardViewFailed = (CardView) findViewById(R.id.input_failed3);
        btnTryagain = (Button) findViewById(R.id.input_tryagain3);
        btnOk = (Button) findViewById(R.id.input_ok3);
        rlDisruptor.setVisibility(View.GONE);
        cardViewSucces.setVisibility(View.GONE);
        cardViewFailed.setVisibility(View.GONE);
        for (Student s : classService.getStudentList(classId)) studentList.add(s);
        attendanceInputAdapter = new AttendanceInputAdapter(this, studentList);
        listener = attendanceInputAdapter;
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerViewStudentInput.setAdapter(attendanceInputAdapter);
        recyclerViewStudentInput.setLayoutManager(layoutManager);
        recyclerViewStudentInput.setItemAnimator(new DefaultItemAnimator());
        String date = String.format(Locale.ENGLISH, "%02d/%02d/%d", Calendar.getInstance().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + 1, Calendar.getInstance().get(Calendar.YEAR));
        textViewDate.setText(date);
        btnSelectAll.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                listener.onSelect(toggleMark);
                if (toggleMark) {
                    btnSelectAll.setText("All unselect");
                    toggleMark = false;
                } else {
                    btnSelectAll.setText("All select");
                    toggleMark = true;
                }
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Student(com.remswork.project.alice.model.Student) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) AttendanceInputAdapter(com.lieverandiver.thesisproject.adapter.AttendanceInputAdapter)

Aggregations

CardView (android.support.v7.widget.CardView)2 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 TextView (android.widget.TextView)2 AttendanceInputAdapter (com.lieverandiver.thesisproject.adapter.AttendanceInputAdapter)2 GradingFactorException (com.remswork.project.alice.exception.GradingFactorException)2 Student (com.remswork.project.alice.model.Student)2