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{
|
||||
|
||||
//
|
||||
|
||||
// ID作成のTextViewとImageView
|
||||
private TextView creatUUID;
|
||||
private ImageView imageUuid;
|
||||
|
|
|
@ -24,12 +24,14 @@ public class SubmissionActivity extends AppCompatActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.submission);
|
||||
|
||||
// 戻るボタンの処理
|
||||
ImageView backButton = findViewById(R.id.BackMain_fromSubmission);
|
||||
backButton.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
|
||||
|
||||
// インテントから提出状況の生徒の数を取得
|
||||
studentNumbers=getIntent().getIntegerArrayListExtra("submissionStudents");
|
||||
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
|
@ -37,6 +39,7 @@ public class SubmissionActivity extends AppCompatActivity {
|
|||
submissionAdapter = new SubmissionAdapter(students);
|
||||
recyclerView.setAdapter(submissionAdapter);
|
||||
|
||||
// 生徒のリストを取得
|
||||
fetchStudents();
|
||||
}
|
||||
private void fetchStudents() {
|
||||
|
|
|
@ -18,6 +18,7 @@ public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.St
|
|||
|
||||
public StudentViewHolder(View view) {
|
||||
super(view);
|
||||
// レイアウトファイルのTextViewを取得
|
||||
studentNumberTextView = view.findViewById(R.id.studentNumberTextView);
|
||||
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) {
|
||||
SubmissionStudent student = students.get(position);
|
||||
holder.studentNumberTextView.setText(String.valueOf(student.getStudentNumber()));
|
||||
// 提出済みかどうかで表示を変える
|
||||
if (student.isSubmitted()) {
|
||||
holder.statusTextView.setText("提出済み");
|
||||
holder.statusTextView.setBackgroundColor(Color.BLACK);
|
||||
|
|
Loading…
Reference in New Issue
Block a user