use of com.lieverandiver.thesisproject.adapter.CriteriaAdapter2 in project classify-system by anverliedoit.
the class SubjectViewActivity method init.
private void init() {
imageViewBackButton = (Button) findViewById(R.id.add_backsubject);
imageViewBackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
finish();
}
});
linearLayoutm = (LinearLayout) findViewById(R.id.midterm_setting);
linearLayoutf = (LinearLayout) findViewById(R.id.finals_setting);
name = (TextView) findViewById(R.id.a_class_f_view_subject_name);
code = (TextView) findViewById(R.id.a_class_f_view_subject_code);
desc = (TextView) findViewById(R.id.a_class_f_view_subject_desc);
unit = (TextView) findViewById(R.id.a_class_f_view_subject_unit);
toggleButtonM = (ToggleButton) findViewById(toggle_midview);
toggleButtonF = (ToggleButton) findViewById(toggle_finview);
textViewMidtermPercent = (TextView) findViewById(R.id.midterm_percent_sub_view);
textViewFinalsPercent = (TextView) findViewById(R.id.finals_percent_sub_view);
recyclerViewMidterm = (RecyclerView) findViewById(R.id.midterm_recycleview);
recyclerViewFinals = (RecyclerView) findViewById(R.id.finals_recycleview);
recyclerViewFinals.setVisibility(View.GONE);
recyclerViewMidterm.setVisibility(View.GONE);
new Handler(getMainLooper()).post(new Runnable() {
@Override
public void run() {
try {
recyclerViewMidterm.setVisibility(View.GONE);
recyclerViewFinals.setVisibility(View.GONE);
toggleButtonM.setOnCheckedChangeListener(SubjectViewActivity.this);
toggleButtonF.setOnCheckedChangeListener(SubjectViewActivity.this);
linearLayoutm.setOnClickListener(SubjectViewActivity.this);
linearLayoutf.setOnClickListener(SubjectViewActivity.this);
name.setText(subject.getName());
code.setText(subject.getCode());
desc.setText(subject.getDescription());
unit.setText(String.valueOf(subject.getUnit()));
Formula formula = formulaService.getFormulaBySubjectAndTeacherId(subject.getId(), teacher.getId(), 1);
if (formula != null && formula.getSubject() != null) {
if (formula.getSubject().getId() == subject.getId()) {
formulaMidterm = formula;
String[] percents = new String[6];
percents[0] = formula.getActivityPercentage() + "%";
percents[1] = formula.getAssignmentPercentage() + "%";
percents[2] = formula.getAttendancePercentage() + "%";
percents[3] = formula.getExamPercentage() + "%";
percents[4] = formula.getProjectPercentage() + "%";
percents[5] = formula.getQuizPercentage() + "%";
CriteriaAdapter2 criteriaAdapter = new CriteriaAdapter2(SubjectViewActivity.this, percents);
LinearLayoutManager layoutManager = new LinearLayoutManager(SubjectViewActivity.this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerViewMidterm.setAdapter(criteriaAdapter);
recyclerViewMidterm.setLayoutManager(layoutManager);
recyclerViewMidterm.setItemAnimator(new DefaultItemAnimator());
}
}
formula = formulaService.getFormulaBySubjectAndTeacherId(subject.getId(), teacher.getId(), 2);
if (formula != null && formula.getSubject() != null) {
if (formula.getSubject().getId() == subject.getId()) {
formulaFinalterm = formula;
String[] percents = new String[6];
percents[0] = formula.getActivityPercentage() + "%";
percents[1] = formula.getAssignmentPercentage() + "%";
percents[2] = formula.getAttendancePercentage() + "%";
percents[3] = formula.getExamPercentage() + "%";
percents[4] = formula.getProjectPercentage() + "%";
percents[5] = formula.getQuizPercentage() + "%";
CriteriaAdapter2 criteriaAdapter = new CriteriaAdapter2(SubjectViewActivity.this, percents);
LinearLayoutManager layoutManager = new LinearLayoutManager(SubjectViewActivity.this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerViewFinals.setAdapter(criteriaAdapter);
recyclerViewFinals.setLayoutManager(layoutManager);
recyclerViewFinals.setItemAnimator(new DefaultItemAnimator());
}
}
} catch (GradingFactorException e) {
e.printStackTrace();
}
}
});
}
Aggregations