全ての変数名に型名がわかるように追記

This commit is contained in:
it232115 2024-07-09 12:10:14 +09:00
parent 0652ce505b
commit 470abcd53e
12 changed files with 147 additions and 218 deletions

View File

@ -16,11 +16,11 @@ public class Converters {
// タイムスタンプを文字列(yyyy-mm-dd,日時)に変換
@TypeConverter
public static List<String> fromTimestampList(List<Timestamp> timestamps) {
List<String> strings = new ArrayList<>();
List<String> stringsList = new ArrayList<>();
for (Timestamp timestamp : timestamps) {
strings.add(format.format(timestamp.toDate()));
stringsList.add(format.format(timestamp.toDate()));
}
return strings;
return stringsList;
}
@TypeConverter

View File

@ -7,10 +7,10 @@ public class CreateUUID {
public static int generateUUID(List<Integer> classIdList ){
while (true){
int uuid = (int)(Math.random() * 1000000);
int uuidInt = (int)(Math.random() * 1000000);
boolean isDuplicate = false;
for(int classId : classIdList){
if(classId==uuid){
for(int classIdInt : classIdList){
if(classIdInt==uuidInt){
//重複があればフラグを立てループを抜ける
isDuplicate = true;
break;
@ -20,10 +20,10 @@ public class CreateUUID {
if (!isDuplicate) {
//firestoreに挿入処理
InsertClassIdforFirebase insertClassIdforFirebase = new InsertClassIdforFirebase();
insertClassIdforFirebase.insertClassId(uuid);
insertClassIdforFirebase.insertClassId(uuidInt);
//テスト用
uuid=100;
return uuid;
uuidInt=100;
return uuidInt;
}
}
}

View File

@ -7,8 +7,8 @@ import android.widget.DatePicker;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import java.util.Calendar;
import java.util.Objects;
public class DatePick extends DialogFragment implements
DatePickerDialog.OnDateSetListener {
@ -19,16 +19,16 @@ public class DatePick extends DialogFragment implements
//デフォルトのタイムゾーンおよびロケールを使用してカレンダを取得
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
int yearInt = c.get(Calendar.YEAR);
int monthInt = c.get(Calendar.MONTH);
int dayInt = c.get(Calendar.DAY_OF_MONTH);
return new DatePickerDialog(requireActivity(), (DatePickerDialog.OnDateSetListener) getActivity(), year, month, day);
return new DatePickerDialog(requireActivity(), (DatePickerDialog.OnDateSetListener) getActivity(), yearInt, monthInt, dayInt);
}
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
public void onDateSet(DatePicker datePicker, int yearInt, int monthInt, int dayInt) {
}
}

View File

@ -4,8 +4,6 @@ import android.util.Log;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
@ -14,7 +12,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class FirestoreReception_classIdDatabase {
private FirebaseFirestore db;
private List<Integer> classIdList= new ArrayList<>();

View File

@ -1,59 +0,0 @@
package com.example.oplogy;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.util.Log;
import com.google.android.gms.maps.model.LatLng;
import com.google.firebase.Timestamp;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class GeoCoder {
private Context context;
public void processData(Map<String, Object> data, Context context) {
try {
this.context = context;
//家庭訪問先の住所
List<String> address = (List<String>) data.get("address");
//家庭訪問の第一希望日(配列0が希望時間帯のはじめ配列1がおわり)
List<Timestamp> firstDay = (List<Timestamp>) data.get("firstDay");
//出席番号
Long studentNumber = (Long) data.get("studentNumber");
// 住所を緯度経度に変換
LatLng latLng = geocodeAddress(address.get(0));
//デバッグ用ログ
Log.d("FirestoreReception", "address: " + address.get(0));
Log.d("FirestoreReception", "firstDay: " + firstDay.get(0));
Log.d("FirestoreReception", "firstDay: " + firstDay.get(1));
Log.d("FirestoreReception", "studentNumber: " + studentNumber);
Log.d("FirestoreReception", "latLng: " + latLng);
} catch (NullPointerException e) {
Log.e("NullPointerException", "getの中身がnull" + e);
}
}
private LatLng geocodeAddress(String address) {
try {
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocationName(address, 1);
if (addresses != null && !addresses.isEmpty()) {
Address addressResult = addresses.get(0);
double latitude = addressResult.getLatitude();
double longitude = addressResult.getLongitude();
return new LatLng(latitude, longitude);
}
} catch (IOException e) {
Log.e("GeocodingException", "Error geocoding address: " + address, e);
}
return null;
}
}

View File

@ -195,12 +195,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
executor.execute(() -> {
AppDatabase db = getDatabaseInstance(); SetUpTableDao setUpTableDao = db.setUpTableDao();
int totalStudent = setUpTableDao.getTotalStudent();
int myDataListSize = firestoreReception.getMyDataListSize();
int totalStudentInt = setUpTableDao.getTotalStudent();
int myDataListSizeInt = firestoreReception.getMyDataListSize();
//総生徒数と提出済みになっている生徒の数が一致するかの確認
runOnUiThread(() -> {
if (totalStudent != myDataListSize) {
if (totalStudentInt != myDataListSizeInt) {
//未提出者がいることの警告ダイアログ
showRouteCreationDialog();
} else {
@ -271,10 +271,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// MyDataListをJSON形式に変換
Gson gson = new Gson();
String json = gson.toJson(myDataList);
String jsonString = gson.toJson(myDataList);
// JSON形式のデータを共有プリファレンスに保存
editor.putString("myDataList", json);
editor.putString("myDataList", jsonString);
editor.apply();
}
@ -320,17 +320,17 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// 1. Roomデータベースから全生徒数を取得
AppDatabase db = getDatabaseInstance();
SetUpTableDao setUpTableDao = db.setUpTableDao();
int totalStudent = setUpTableDao.getTotalStudent();
int totalStudentInt = setUpTableDao.getTotalStudent();
// 2. Firestoreから生徒番号のリストを取得
ArrayList<Integer> firestoreStudentNumbers = new ArrayList<>();
ArrayList<Integer> firestoreStudentNumbersList = new ArrayList<>();
for (MyDataClass myData : myDataList) {
int studentNumber = myData.getStudentNumber();
firestoreStudentNumbers.add(studentNumber);
int studentNumberInt = myData.getStudentNumber();
firestoreStudentNumbersList.add(studentNumberInt);
}
// 3. SubmissionStudentオブジェクトのリストを作成
for (int i = 1; i <= totalStudent; i++) {
boolean submitted = firestoreStudentNumbers.contains(i);
for (int i = 1; i <= totalStudentInt; i++) {
boolean submitted = firestoreStudentNumbersList.contains(i);
submissionStudents.add(new SubmissionStudent(i, submitted));
}

View File

@ -44,9 +44,7 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
ImageView backMain;
private GoogleMap mMap;
private MapsBinding binding;
private LinearLayout locationsName;
private Spinner dateSpinner;
//GoogleMapAPiで使用可能な色
private static final int[] COLORS = new int[]{Color.parseColor("#007FFF"), // HUE_AZURE
Color.parseColor("#0000FF"), // HUE_BLUE
@ -60,20 +58,18 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
Color.parseColor("#FFFF00") // HUE_YELLOW
};
private int colorIndex = 0;
private List<LatLng> latLngList = new ArrayList<>();
private List<String> nameList = new ArrayList<>();
private List<Integer> colorList = new ArrayList<>();
private final List<LatLng> latLngList = new ArrayList<>();
private final List<String> nameList = new ArrayList<>();
private final List<Integer> colorList = new ArrayList<>();
private Map<String, Runnable> dateMap = new HashMap<>();
private AppDatabase db = null;
private final Map<String, Runnable> dateMap = new HashMap<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// バインディングの設定
binding = MapsBinding.inflate(getLayoutInflater());
com.example.oplogy.databinding.MapsBinding binding = MapsBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
// マップフラグメントの設定
@ -103,7 +99,7 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
dateMap.put(formattedDayString, () -> loadMapAndNames(createlocationData(finalI), getscrollViewlData(finalI)));
}
dateSpinner = findViewById(R.id.date);
Spinner dateSpinner = findViewById(R.id.date);
dateSpinner.setAdapter(adapter);
// スピナーのアイテム選択リスナーを設定

View File

@ -31,17 +31,17 @@ import java.util.concurrent.Executors;
public class SetUpActivity extends FragmentActivity
implements TimePickerDialog.OnTimeSetListener, DatePickerDialog.OnDateSetListener {
String teacherName;
String startPoint;
String firstDay;
String secondDay;
String thirdDay;
String startTime;
String endTime;
String intervalTime;
String startBreakTime;
String endBreakTime;
int totalStudent;
String teacherNameString;
String startPointString;
String firstDayString;
String secondDayString;
String thirdDayString;
String startTimeString;
String endTimeString;
String intervalTimeString;
String startBreakTimeString;
String endBreakTimeString;
int totalStudentString;
private TextView setTeacherName;
private TextView setStartPoint;
private TextView setStartTime;
@ -49,16 +49,16 @@ public class SetUpActivity extends FragmentActivity
private TextView setStartBreakTime;
private TextView setEndBreakTime;
private TextView setTotalStudent;
private int isDateSelected;
private int isStartTimeSelected;
private int isDateSelectedInt;
private int isStartTimeSelectedInt;
String stringYear;
String stringMonth;
String stringDayOfMonth;
String stringYearString;
String stringMonthString;
String stringDayOfMonthString;
String stringHourOfDay;
String stringMinute;
String stringHourOfDayString;
String stringMinuteString;
Button setFirstDay;
Button setSecondDay;
@ -74,7 +74,7 @@ public class SetUpActivity extends FragmentActivity
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_up);
int classId= getIntent().getIntExtra("classId", 100000);
int classIdInt= getIntent().getIntExtra("classId", 100000);
setTeacherName = findViewById(R.id.teacherName); //先生の名前
setStartPoint = findViewById(R.id.startPoint); //開始地点
@ -110,29 +110,29 @@ public class SetUpActivity extends FragmentActivity
setUp.setOnClickListener(view -> {
teacherName = setTeacherName.getText().toString(); //各変数に値を挿入
Log.d(TAG, "Teacher Name: " + teacherName);
startPoint = setStartPoint.getText().toString();
Log.d(TAG, "Start Point: " + startPoint);
Log.d(TAG, "First Day:" + firstDay);
Log.d(TAG, "Second Day:" + secondDay);
Log.d(TAG, "Third Day:" + thirdDay);
Log.d(TAG, "Start Time" + startTime);
Log.d(TAG, "End Time" + endTime);
teacherNameString = setTeacherName.getText().toString(); //各変数に値を挿入
Log.d(TAG, "Teacher Name: " + teacherNameString);
startPointString = setStartPoint.getText().toString();
Log.d(TAG, "Start Point: " + startPointString);
Log.d(TAG, "First Day:" + firstDayString);
Log.d(TAG, "Second Day:" + secondDayString);
Log.d(TAG, "Third Day:" + thirdDayString);
Log.d(TAG, "Start Time" + startTimeString);
Log.d(TAG, "End Time" + endTimeString);
if (setTenMinute.isChecked()){ //ラジオボタンの状態を取得
intervalTime = "10";
intervalTimeString = "10";
} else if (setFifteenMinute.isChecked()) {
intervalTime = "15";
intervalTimeString = "15";
} else if (setThirtyMinute.isChecked()) {
intervalTime = "30";
intervalTimeString = "30";
} else {
intervalTime = "0";
intervalTimeString = "0";
}
Log.d(TAG, "Interval Time" + intervalTime);
Log.d(TAG, "Start Break Time" + startBreakTime);
Log.d(TAG, "End Break Time" + endBreakTime);
totalStudent = Integer.parseInt(setTotalStudent.getText().toString()); //数値型に変更
Log.d(TAG, "Total Student" + totalStudent);
Log.d(TAG, "Interval Time" + intervalTimeString);
Log.d(TAG, "Start Break Time" + startBreakTimeString);
Log.d(TAG, "End Break Time" + endBreakTimeString);
totalStudentString = Integer.parseInt(setTotalStudent.getText().toString()); //数値型に変更
Log.d(TAG, "Total Student" + totalStudentString);
Log.d(TAG, "onClick: できてるよ");
@ -147,19 +147,19 @@ public class SetUpActivity extends FragmentActivity
SetUpTableDao setUpTableDao = db.setUpTableDao();
// Roomの操作を行う
SetUpTable setUpTable = new SetUpTable(
teacherName,
startPoint,
startTime,
endTime,
intervalTime,
startBreakTime,
endBreakTime,
totalStudent,
classId
teacherNameString,
startPointString,
startTimeString,
endTimeString,
intervalTimeString,
startBreakTimeString,
endBreakTimeString,
totalStudentString,
classIdInt
);
// 同じ名前のエントリが存在するかどうかを確認
SetUpTable existingSetUpTable = setUpTableDao.findByName(teacherName);
SetUpTable existingSetUpTable = setUpTableDao.findByName(teacherNameString);
if (existingSetUpTable != null) {
// エントリが存在する場合はそのエントリを更新
setUpTable.setId(existingSetUpTable.getId()); // 既存のIDを設定
@ -175,9 +175,9 @@ public class SetUpActivity extends FragmentActivity
SharedPreferences sharedPreferences=getSharedPreferences("visitingDate",MODE_PRIVATE);
SharedPreferences.Editor editor= sharedPreferences.edit();
editor.putString("day1",firstDay);
editor.putString("day2",secondDay);
editor.putString("day3",thirdDay);
editor.putString("day1",firstDayString);
editor.putString("day2",secondDayString);
editor.putString("day3",thirdDayString);
editor.apply();
@ -187,37 +187,37 @@ public class SetUpActivity extends FragmentActivity
});
setFirstDay.setOnClickListener(v ->{
isDateSelected = 1;
isDateSelectedInt = 1;
showDatePickerDialog(); //DatePickerの表示
});
setSecondDay.setOnClickListener(v ->{
isDateSelected = 2;
isDateSelectedInt = 2;
showDatePickerDialog();
});
setThirdDay.setOnClickListener(v ->{
isDateSelected = 3;
isDateSelectedInt = 3;
showDatePickerDialog();
});
setStartTimeButton.setOnClickListener(v -> {
isStartTimeSelected = 1; //ボタンの判別
isStartTimeSelectedInt = 1; //ボタンの判別
showTimePickerDialog(); //TimePickerの表示
});
setEndTimeButton.setOnClickListener(v -> {
isStartTimeSelected = 2;
isStartTimeSelectedInt = 2;
showTimePickerDialog();
});
setStartBreakTime.setOnClickListener(v -> {
isStartTimeSelected = 3;
isStartTimeSelectedInt = 3;
showTimePickerDialog();
});
setEndBreakTime.setOnClickListener(v -> {
isStartTimeSelected = 4;
isStartTimeSelectedInt = 4;
showTimePickerDialog();
});
@ -247,25 +247,25 @@ public class SetUpActivity extends FragmentActivity
// DatePickerDialogで選択された日付を処理する
String str = String.format(Locale.JAPAN, "%02d/%02d", month + 1, dayOfMonth); // TextViewに表示する日付の形式を設定
if (isDateSelected == 1) {
stringYear = String.valueOf(year); //
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1); //
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth); //
firstDay = stringYear + stringMonth + stringDayOfMonth;
if (isDateSelectedInt == 1) {
stringYearString = String.valueOf(year); //
stringMonthString = String.format(Locale.JAPAN, "%02d", month + 1); //
stringDayOfMonthString = String.format(Locale.JAPAN, "%02d", dayOfMonth); //
firstDayString = stringYearString + stringMonthString + stringDayOfMonthString;
setFirstDay.setText(str);
} else if (isDateSelected == 2) {
stringYear = String.valueOf(year);
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1);
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth);
secondDay = stringYear + stringMonth + stringDayOfMonth;
} else if (isDateSelectedInt == 2) {
stringYearString = String.valueOf(year);
stringMonthString = String.format(Locale.JAPAN, "%02d", month + 1);
stringDayOfMonthString = String.format(Locale.JAPAN, "%02d", dayOfMonth);
secondDayString = stringYearString + stringMonthString + stringDayOfMonthString;
setSecondDay.setText(str);
} else if (isDateSelected == 3) {
stringYear = String.valueOf(year);
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1);
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth);
thirdDay = stringYear + stringMonth + stringDayOfMonth;
} else if (isDateSelectedInt == 3) {
stringYearString = String.valueOf(year);
stringMonthString = String.format(Locale.JAPAN, "%02d", month + 1);
stringDayOfMonthString = String.format(Locale.JAPAN, "%02d", dayOfMonth);
thirdDayString = stringYearString + stringMonthString + stringDayOfMonthString;
setThirdDay.setText(str);
}
@ -276,28 +276,28 @@ public class SetUpActivity extends FragmentActivity
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String str = String.format(Locale.JAPAN, "%02d:%02d", hourOfDay, minute); // Textviewに保存する形式を設定
if (isStartTimeSelected == 1) {
stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute);
startTime = stringHourOfDay + stringMinute;
if (isStartTimeSelectedInt == 1) {
stringHourOfDayString = String.format("%02d", hourOfDay);
stringMinuteString = String.format("%02d", minute);
startTimeString = stringHourOfDayString + stringMinuteString;
setStartTime.setText(str);
} else if (isStartTimeSelected == 2) {
stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute);
endTime = stringHourOfDay + stringMinute;
} else if (isStartTimeSelectedInt == 2) {
stringHourOfDayString = String.format("%02d", hourOfDay);
stringMinuteString = String.format("%02d", minute);
endTimeString = stringHourOfDayString + stringMinuteString;
setEndTime.setText(str);
} else if (isStartTimeSelected == 3) {
stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute);
startBreakTime =stringHourOfDay + stringMinute;
} else if (isStartTimeSelectedInt == 3) {
stringHourOfDayString = String.format("%02d", hourOfDay);
stringMinuteString = String.format("%02d", minute);
startBreakTimeString =stringHourOfDayString + stringMinuteString;
setStartBreakTime.setText(" " + str + " ");
} else if (isStartTimeSelected == 4) {
stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute);
endBreakTime = stringHourOfDay + stringMinute;
} else if (isStartTimeSelectedInt == 4) {
stringHourOfDayString = String.format("%02d", hourOfDay);
stringMinuteString = String.format("%02d", minute);
endBreakTimeString = stringHourOfDayString + stringMinuteString;
setEndBreakTime.setText(" " + str + " ");
}
}

View File

@ -1,13 +1,11 @@
package com.example.oplogy;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.widget.ImageView;
import com.example.oplogy.databinding.SubmissionBinding;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
@ -15,9 +13,8 @@ import java.util.List;
public class SubmissionActivity extends AppCompatActivity {
private RecyclerView recyclerView;
private SubmissionAdapter submissionAdapter;
private List<SubmissionStudent> students = new ArrayList<>();
ArrayList<Integer> studentNumbers = new ArrayList<>();
private int totalStudent = 10;
private final List<SubmissionStudent> studentsList = new ArrayList<>();
ArrayList<Integer> studentNumbersList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -26,17 +23,15 @@ public class SubmissionActivity extends AppCompatActivity {
// 戻るボタンの処理
ImageView backButton = findViewById(R.id.BackMain_fromSubmission);
backButton.setOnClickListener(v -> {
finish();
});
backButton.setOnClickListener(v -> finish());
// インテントから提出状況の生徒の数を取得
studentNumbers=getIntent().getIntegerArrayListExtra("submissionStudents");
studentNumbersList=getIntent().getIntegerArrayListExtra("submissionStudents");
recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
submissionAdapter = new SubmissionAdapter(students);
submissionAdapter = new SubmissionAdapter(studentsList);
recyclerView.setAdapter(submissionAdapter);
// 生徒のリストを取得
@ -44,12 +39,10 @@ public class SubmissionActivity extends AppCompatActivity {
}
private void fetchStudents() {
// インテントから生徒のリストを取得
ArrayList<SubmissionStudent> submissionStudents = getIntent().getParcelableArrayListExtra("submissionStudents");
ArrayList<SubmissionStudent> submissionStudentsList = getIntent().getParcelableArrayListExtra("submissionStudents");
// 生徒のリストを反復処理しそれをRecyclerViewに表示
for (SubmissionStudent student : submissionStudents) {
students.add(student);
}
studentsList.addAll(submissionStudentsList);
// データが変更されたことをアダプターに通知
submissionAdapter.notifyDataSetChanged();

View File

@ -5,12 +5,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.StudentViewHolder> {
private List<SubmissionStudent> students;
private final List<SubmissionStudent> studentsList;
public static class StudentViewHolder extends RecyclerView.ViewHolder {
public TextView studentNumberTextView;
@ -25,9 +27,10 @@ public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.St
}
public SubmissionAdapter(List<SubmissionStudent> students) {
this.students = students;
this.studentsList = students;
}
@NonNull
@Override
public StudentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
@ -37,7 +40,7 @@ public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.St
@Override
public void onBindViewHolder(StudentViewHolder holder, int position) {
SubmissionStudent student = students.get(position);
SubmissionStudent student = studentsList.get(position);
holder.studentNumberTextView.setText(String.valueOf(student.getStudentNumber()));
// 提出済みかどうかで表示を変える
if (student.isSubmitted()) {
@ -57,6 +60,6 @@ public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.St
@Override
public int getItemCount() {
return students.size();
return studentsList.size();
}
}

View File

@ -3,16 +3,16 @@ import android.os.Parcel;
import android.os.Parcelable;
public class SubmissionStudent implements Parcelable {
private int studentNumber;
private int studentNumberInt;
private boolean submitted;
public SubmissionStudent(int studentNumber, boolean submitted) {
this.studentNumber = studentNumber;
this.studentNumberInt = studentNumber;
this.submitted = submitted;
}
protected SubmissionStudent(Parcel in) {
studentNumber = in.readInt();
studentNumberInt = in.readInt();
submitted = in.readByte() != 0;
}
@ -29,7 +29,7 @@ public class SubmissionStudent implements Parcelable {
};
public int getStudentNumber() {
return studentNumber;
return studentNumberInt;
}
public boolean isSubmitted() {
@ -43,7 +43,7 @@ public class SubmissionStudent implements Parcelable {
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(studentNumber);
parcel.writeInt(studentNumberInt);
parcel.writeByte((byte) (submitted ? 1 : 0));
}
}

View File

@ -2,7 +2,6 @@ package com.example.oplogy;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.TimePicker;
@ -18,14 +17,14 @@ public class TimePick extends DialogFragment implements
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) { // TimePeckerの生成
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
int hourInt = c.get(Calendar.HOUR_OF_DAY);
int minuteInt = c.get(Calendar.MINUTE);
return new TimePickerDialog((Context) getActivity(),
(TimePickerDialog.OnTimeSetListener) getActivity(), hour, minute, true);
return new TimePickerDialog(getActivity(),
(TimePickerDialog.OnTimeSetListener) getActivity(), hourInt, minuteInt, true);
}
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
public void onTimeSet(TimePicker view, int hourOfDayInt, int minuteInt) {
}
}