Search in sources :

Example 1 with SubjectAdapter

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

the class TeacherViewActivity method init.

private void init() {
    txtName = (TextView) findViewById(R.id.txtv_fullname);
    txtDept = (TextView) findViewById(R.id.txtv_dept);
    btnBack = (Button) findViewById(R.id.add_backsubject);
    rView = (RecyclerView) findViewById(R.id.recyclerview_view_subject);
    try {
        SubjectAdapter subjectAdapter = new SubjectAdapter(this, subjectService.getSubjectListByTeacherIdUnique(teacher.getId()));
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        rView.setAdapter(subjectAdapter);
        rView.setLayoutManager(layoutManager);
        rView.setItemAnimator(new DefaultItemAnimator());
        txtName.setText(teacher.getFirstName() + " " + teacher.getMiddleName().substring(0, 1) + ". " + teacher.getLastName());
        txtDept.setText(teacher.getDepartment() != null ? teacher.getDepartment().getName() : "None");
        btnBack.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                finish();
            }
        });
    } catch (SubjectException e) {
        e.printStackTrace();
    }
}
Also used : SubjectAdapter(com.lieverandiver.thesisproject.adapter.SubjectAdapter) SubjectException(com.remswork.project.alice.exception.SubjectException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 2 with SubjectAdapter

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

the class Teacher_Activity_Teacher_Profile method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TeacherServiceImpl teacherService = new TeacherServiceImpl();
    Teacher teacher;
    try {
        teacher = teacherService.getTeacherById(getIntent().getExtras().getLong("teacherId"));
    } catch (Exception e) {
        e.printStackTrace();
        teacher = new Teacher();
    }
    setContentView(R.layout.teacher_activity_view_teacher_profile);
    txtvName = (TextView) findViewById(R.id.txtv_fullname);
    txtvDept = (TextView) findViewById(R.id.txtv_dept);
    buttonback = (Button) findViewById(R.id.add_backsubject);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerview_view_subject);
    SubjectServiceImpl subjectService = new SubjectServiceImpl();
    SubjectAdapter subjectAdapter = null;
    try {
        subjectAdapter = new SubjectAdapter(this, subjectService.getSubjectListByTeacherId(teacher.getId()));
    } catch (SubjectException e) {
        e.printStackTrace();
    }
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setAdapter(subjectAdapter);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    txtvName.setText(teacher.getFirstName() + " " + teacher.getMiddleName().substring(0, 1) + ". " + teacher.getLastName());
    txtvDept.setText(teacher.getDepartment() != null ? teacher.getDepartment().getName() : "None");
    buttonback.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            finish();
        }
    });
}
Also used : SubjectServiceImpl(com.remswork.project.alice.service.impl.SubjectServiceImpl) Teacher(com.remswork.project.alice.model.Teacher) SubjectAdapter(com.lieverandiver.thesisproject.adapter.SubjectAdapter) SubjectException(com.remswork.project.alice.exception.SubjectException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) SubjectException(com.remswork.project.alice.exception.SubjectException) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) TeacherServiceImpl(com.remswork.project.alice.service.impl.TeacherServiceImpl)

Aggregations

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 SubjectAdapter (com.lieverandiver.thesisproject.adapter.SubjectAdapter)2 SubjectException (com.remswork.project.alice.exception.SubjectException)2 Teacher (com.remswork.project.alice.model.Teacher)1 SubjectServiceImpl (com.remswork.project.alice.service.impl.SubjectServiceImpl)1 TeacherServiceImpl (com.remswork.project.alice.service.impl.TeacherServiceImpl)1