submissionアクティビティに提出状況を確認するlistの表示の実装完了
コメント追加
This commit is contained in:
parent
943b5ebc22
commit
832c716435
|
@ -23,6 +23,8 @@ import java.util.concurrent.Executors;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
// ID作成のTextViewとImageView
|
// ID作成のTextViewとImageView
|
||||||
private TextView creatUUID;
|
private TextView creatUUID;
|
||||||
private ImageView imageUuid;
|
private ImageView imageUuid;
|
||||||
|
|
|
@ -24,12 +24,14 @@ public class SubmissionActivity extends AppCompatActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.submission);
|
setContentView(R.layout.submission);
|
||||||
|
|
||||||
|
// 戻るボタンの処理
|
||||||
ImageView backButton = findViewById(R.id.BackMain_fromSubmission);
|
ImageView backButton = findViewById(R.id.BackMain_fromSubmission);
|
||||||
backButton.setOnClickListener(v -> {
|
backButton.setOnClickListener(v -> {
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// インテントから提出状況の生徒の数を取得
|
||||||
studentNumbers=getIntent().getIntegerArrayListExtra("submissionStudents");
|
studentNumbers=getIntent().getIntegerArrayListExtra("submissionStudents");
|
||||||
|
|
||||||
recyclerView = findViewById(R.id.recyclerView);
|
recyclerView = findViewById(R.id.recyclerView);
|
||||||
|
@ -37,6 +39,7 @@ public class SubmissionActivity extends AppCompatActivity {
|
||||||
submissionAdapter = new SubmissionAdapter(students);
|
submissionAdapter = new SubmissionAdapter(students);
|
||||||
recyclerView.setAdapter(submissionAdapter);
|
recyclerView.setAdapter(submissionAdapter);
|
||||||
|
|
||||||
|
// 生徒のリストを取得
|
||||||
fetchStudents();
|
fetchStudents();
|
||||||
}
|
}
|
||||||
private void fetchStudents() {
|
private void fetchStudents() {
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.St
|
||||||
|
|
||||||
public StudentViewHolder(View view) {
|
public StudentViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
|
// レイアウトファイルのTextViewを取得
|
||||||
studentNumberTextView = view.findViewById(R.id.studentNumberTextView);
|
studentNumberTextView = view.findViewById(R.id.studentNumberTextView);
|
||||||
statusTextView = view.findViewById(R.id.statusTextView);
|
statusTextView = view.findViewById(R.id.statusTextView);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +39,7 @@ public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.St
|
||||||
public void onBindViewHolder(StudentViewHolder holder, int position) {
|
public void onBindViewHolder(StudentViewHolder holder, int position) {
|
||||||
SubmissionStudent student = students.get(position);
|
SubmissionStudent student = students.get(position);
|
||||||
holder.studentNumberTextView.setText(String.valueOf(student.getStudentNumber()));
|
holder.studentNumberTextView.setText(String.valueOf(student.getStudentNumber()));
|
||||||
|
// 提出済みかどうかで表示を変える
|
||||||
if (student.isSubmitted()) {
|
if (student.isSubmitted()) {
|
||||||
holder.statusTextView.setText("提出済み");
|
holder.statusTextView.setText("提出済み");
|
||||||
holder.statusTextView.setBackgroundColor(Color.BLACK);
|
holder.statusTextView.setBackgroundColor(Color.BLACK);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user