-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClassViewHolder.java
89 lines (68 loc) · 2.41 KB
/
ClassViewHolder.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package naomi.me.spotopen;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by naomikoo on 2016-08-09.
*/
public class ClassViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.subjectnumber)
TextView subjectNumberView;
@BindView(R.id.enrollment_results)
TextView enrollmentResultsView;
@BindView(R.id.term)
TextView termView;
@BindView(R.id.course_name)
TextView nameView;
@BindView(R.id.section)
TextView sectionView;
private String mCourseNumber;
private String mEnrollmentResults;
private String mName;
private String mTerm;
private String mCourseSubject;
private String mSection;
public ClassViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
// subjectNumberView = (TextView) view.findViewById(R.id.subjectnumber);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("Naomi", "onClick");
Intent intent = new Intent(v.getContext(), ClassDescriptionActivity.class);
intent.putExtra(ClassDescriptionActivity.SUBJECT, mCourseSubject);
intent.putExtra(ClassDescriptionActivity.NUMBER, mCourseNumber);
intent.putExtra(ClassDescriptionActivity.TERM, mTerm);
intent.putExtra(ClassDescriptionActivity.SECTION, mSection);
// TODO should include section number
v.getContext().startActivity(intent);
}
});
}
public void setSubjectNumberView(String courseSubject, String courseNumber) {
mCourseSubject = courseSubject;
mCourseNumber = courseNumber;
subjectNumberView.setText(courseSubject + courseNumber);
}
public void setSectionView(String section) {
mSection = section;
sectionView.setText(section);
}
public void setEnrollmentResultsView(String results) {
mEnrollmentResults = results;
enrollmentResultsView.setText(results);
}
public void setTermView(String term) {
mTerm = term;
termView.setText(term);
}
public void setNameView(String name) {
mName = name;
nameView.setText(name);
}
}