datePicker #40

Merged
Utahshi merged 11 commits from datePicker into master 2024-07-08 01:21:12 +00:00
4 changed files with 222 additions and 190 deletions
Showing only changes of commit 1b0356f4c2 - Show all commits

View File

@ -114,12 +114,12 @@ public class CreateRoot {
// 希望時間帯の終了時刻から開始時刻を引いて希望時間帯の長さ(timezone)に入れる // 希望時間帯の終了時刻から開始時刻を引いて希望時間帯の長さ(timezone)に入れる
data = myDataList.get(i); data = myDataList.get(i);
//保護者の第一希望日 //保護者の第一希望日
List<Timestamp> firstDay = data.getFirstDay(); List<Timestamp> firstDayList = data.getFirstDay();
//保護者の第一希望日の開始時間 //保護者の第一希望日の開始時間
Timestamp parentStartTimestamp = firstDay.get(0); Timestamp parentStartTimestamp = firstDayList.get(0);
//保護者の第一希望日の終了時間 //保護者の第一希望日の終了時間
Timestamp parentEndTimestamp = firstDay.get(1); Timestamp parentEndTimestamp = firstDayList.get(1);
//保護者の第一希望日の希望時間帯の長さ //保護者の第一希望日の希望時間帯の長さ
Long timezoneLong = parentEndTimestamp.getSeconds() - parentStartTimestamp.getSeconds(); Long timezoneLong = parentEndTimestamp.getSeconds() - parentStartTimestamp.getSeconds();
data.setTimezone(timezoneLong); data.setTimezone(timezoneLong);
@ -158,11 +158,11 @@ public class CreateRoot {
data = myDataList.get(i); data = myDataList.get(i);
if (myDataList.get(i).getSecondDay() != null) { if (myDataList.get(i).getSecondDay() != null) {
//保護者の第二希望日 //保護者の第二希望日
List<Timestamp> secondDay = data.getSecondDay(); List<Timestamp> secondDayList = data.getSecondDay();
//保護者の第二希望日の開始時間 //保護者の第二希望日の開始時間
Timestamp parentStartTimestamp = secondDay.get(0); Timestamp parentStartTimestamp = secondDayList.get(0);
//保護者の第二希望日の終了時間 //保護者の第二希望日の終了時間
Timestamp parentEndTimestamp = secondDay.get(1); Timestamp parentEndTimestamp = secondDayList.get(1);
//保護者の第二希望日の希望時間帯の長さ //保護者の第二希望日の希望時間帯の長さ
Long secondDayTimezoneLong = parentEndTimestamp.getSeconds() - parentStartTimestamp.getSeconds(); Long secondDayTimezoneLong = parentEndTimestamp.getSeconds() - parentStartTimestamp.getSeconds();
data.setTimezone(secondDayTimezoneLong); data.setTimezone(secondDayTimezoneLong);
@ -264,17 +264,18 @@ public class CreateRoot {
if (intervalMinutesInt % 100 >= 60) { if (intervalMinutesInt % 100 >= 60) {
intervalMinutesInt += 40; // 下2桁が60以上の場合は繰り上げる intervalMinutesInt += 40; // 下2桁が60以上の場合は繰り上げる
} }
//教師の休憩時間を除く処理
if (intervalMinutesInt < startBreakTimeMinutesInt || intervalMinutesInt >= endBreakTimeMinutesInt) { if (intervalMinutesInt < startBreakTimeMinutesInt || intervalMinutesInt >= endBreakTimeMinutesInt) {
intervalList.add(intervalMinutesInt); intervalList.add(intervalMinutesInt);
} }
} }
//[3]は家庭訪問の日目
int[][][] intervalArrayInt = new int[3][intervalList.size()][2]; int[][][] intervalArrayInt = new int[3][intervalList.size()][2];
for (int i = 0; i < intervalList.size(); i++) { for (int i = 0; i < intervalList.size(); i++) {
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
intervalArrayInt[j][i][0] = intervalList.get(i); intervalArrayInt[j][i][0] = intervalList.get(i);//家庭訪問のスケジュール区切りの時間を要素に入れる
intervalArrayInt[j][i][1] = 0;//割り当てされていないことを表す intervalArrayInt[j][i][1] = 0;//家庭訪問のスケジュールにまだ保護者が割り当てられていないことを表す
} }
} }
@ -293,6 +294,8 @@ public class CreateRoot {
for (int i = 0; i < myDataList.size(); i++) { for (int i = 0; i < myDataList.size(); i++) {
for (int j = 0; j < intervalArrayInt[0].length - 1; j++) { for (int j = 0; j < intervalArrayInt[0].length - 1; j++) {
for (int x = 0; x < 3; x++) { for (int x = 0; x < 3; x++) {
//家庭訪問の日目が保護者の第一希望日かを判定する
//まだスケジュールを割り当てていない保護者かを判定する
if (testdata[x].equals(myDataList.get(i).getStartDateString()) && myDataList.get(i).getSchedule() == 0) { if (testdata[x].equals(myDataList.get(i).getStartDateString()) && myDataList.get(i).getSchedule() == 0) {
checkSchedule(myDataList, intervalArrayInt, i, j, x, myDataList.get(i).getStartDateString()); checkSchedule(myDataList, intervalArrayInt, i, j, x, myDataList.get(i).getStartDateString());
break; break;
@ -303,7 +306,7 @@ public class CreateRoot {
} }
for (int i = 0; i < myDataList.size(); i++) { for (int i = 0; i < myDataList.size(); i++) {
if (myDataList.get(i).getSchedule() == 0) { if (myDataList.get(i).getSchedule() == 0) {//重複により割り当てがされていない保護者がいないかの確認
return false; return false;
} }
} }
@ -314,6 +317,8 @@ public class CreateRoot {
for (int i = 0; i < myDataList.size(); i++) { for (int i = 0; i < myDataList.size(); i++) {
for (int j = 0; j < intervalArrayInt[0].length - 1; j++) { for (int j = 0; j < intervalArrayInt[0].length - 1; j++) {
for (int x = 0; x < 3; x++) { for (int x = 0; x < 3; x++) {
//家庭訪問の日目が保護者の第一希望日かを判定する
//まだスケジュールを割り当てていない保護者かを判定する
if (testdata[x].equals(myDataList.get(i).getSecondDayStartDateString()) && myDataList.get(i).getSchedule() == 0) { if (testdata[x].equals(myDataList.get(i).getSecondDayStartDateString()) && myDataList.get(i).getSchedule() == 0) {
checkSchedule(myDataList, intervalArrayInt, i, j, x, myDataList.get(i).getSecondDayStartDateString()); checkSchedule(myDataList, intervalArrayInt, i, j, x, myDataList.get(i).getSecondDayStartDateString());
} }
@ -322,23 +327,24 @@ public class CreateRoot {
} }
for (int i = 0; i < myDataList.size(); i++) { for (int i = 0; i < myDataList.size(); i++) {
if (myDataList.get(i).getSchedule() == 0) { if (myDataList.get(i).getSchedule() == 0) {//重複により割り当てがされていない保護者がいないかの確認
return false; return false;
} }
} }
return true; return true;
} }
private void checkSchedule(List<MyDataClass> myDataList, int[][][] intervalArrayInt, int i, int j, int x, String desiredDateString) { private void checkSchedule(List<MyDataClass> myDataList, int[][][] intervalArrayInt, int i, int j, int x, String desiredDateString) {
//保護者の希望時間の開始と終了の間にまだ保護者の割り当てがされていないスケジュールの空き時間があるかの判定
if (intervalArrayInt[x][j][0] >= Integer.parseInt(myDataList.get(i).getParentStartTimeString()) && intervalArrayInt[x][j + 1][0] <= Integer.parseInt(myDataList.get(i).getParentEndTimeString()) && intervalArrayInt[x][j][1] == 0) { if (intervalArrayInt[x][j][0] >= Integer.parseInt(myDataList.get(i).getParentStartTimeString()) && intervalArrayInt[x][j + 1][0] <= Integer.parseInt(myDataList.get(i).getParentEndTimeString()) && intervalArrayInt[x][j][1] == 0) {
intervalArrayInt[x][j][1] += 1;//割り当て済みを表す intervalArrayInt[x][j][1] += 1;//その時間が割り当て済みでありこと
myDataList.get(i).setSchedule(Integer.parseInt(desiredDateString.substring(4, 8) + intervalArrayInt[x][j][0])); myDataList.get(i).setSchedule(Integer.parseInt(desiredDateString.substring(4, 8) + intervalArrayInt[x][j][0]));//スケジュールをmyDataListに入れる(:6041240(6月4日12時40分))
} }
} }
private void sortSchedule(List<MyDataClass> myDataList) { private void sortSchedule(List<MyDataClass> myDataList) {
Comparator<MyDataClass> comparator = Comparator.comparing(MyDataClass::getSchedule); Comparator<MyDataClass> comparator = Comparator.comparing(MyDataClass::getSchedule);
//スケジュールを元にmyDataListをソートする
myDataList.sort(comparator); myDataList.sort(comparator);
} }
@ -347,11 +353,13 @@ public class CreateRoot {
try { try {
Geocoder geocoder = new Geocoder(context, Locale.getDefault()); Geocoder geocoder = new Geocoder(context, Locale.getDefault());
for (int i = 0; i < myDataList.size(); i++) { for (int i = 0; i < myDataList.size(); i++) {
List<Address> addresses = geocoder.getFromLocationName(myDataList.get(i).getAddress().toString(), 1); List<Address> addressesList = geocoder.getFromLocationName(myDataList.get(i).getAddress().toString(), 1);
if (addresses != null && !addresses.isEmpty()) { if (addressesList != null && !addressesList.isEmpty()) {
Address addressResult = addresses.get(0); Address addressResult = addressesList.get(0);
//保護者の住所を緯度経度に変換する
double latitudeDouble = addressResult.getLatitude(); double latitudeDouble = addressResult.getLatitude();
double longitudeDouble = addressResult.getLongitude(); double longitudeDouble = addressResult.getLongitude();
//保護者の住所の緯度経度をmyDataListに追加する
myDataList.get(i).setLatLng(new LatLng(latitudeDouble, longitudeDouble)); myDataList.get(i).setLatLng(new LatLng(latitudeDouble, longitudeDouble));
} }
} }

View File

@ -87,12 +87,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
Log.d("MainActivity","geocodeAddress"); Log.d("MainActivity","geocodeAddress");
//TODO:classIdの初期値を取得
ExecutorService executor = Executors.newSingleThreadExecutor(); ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(() -> { executor.execute(() -> {
try { try {
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable") AppDatabase db = getDatabaseInstance();
.build();
SetUpTableDao setUpTableDao = db.setUpTableDao(); SetUpTableDao setUpTableDao = db.setUpTableDao();
classId = setUpTableDao.getClassId(); classId = setUpTableDao.getClassId();
firestoreReception.getDocumentsByClassId(classId); firestoreReception.getDocumentsByClassId(classId);
@ -159,7 +157,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
} }
} }
//UUIDを表示するかのダイアログ //IDに関する処理
private void showUUIDYesNoDialog() { private void showUUIDYesNoDialog() {
firestoreReception_classIdDatabase = new FirestoreReception_classIdDatabase(); firestoreReception_classIdDatabase = new FirestoreReception_classIdDatabase();
List<Integer> classIdList = firestoreReception_classIdDatabase.getAllDocumentsFromClassIdDatabase(); List<Integer> classIdList = firestoreReception_classIdDatabase.getAllDocumentsFromClassIdDatabase();
@ -167,19 +165,30 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("クラスID"); builder.setTitle("クラスID");
builder.setMessage("あなたのクラスIDを表示しますか?"); builder.setMessage("あなたのクラスIDを表示/もしくは新規で作成しますか?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { builder.setPositiveButton("作成", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
classId = CreateUUID.generateUUID(classIdList); classId = CreateUUID.generateUUID(classIdList);
Toast.makeText(MainActivity.this, "クラスID: " + classId, Toast.LENGTH_SHORT).show(); // 生成されたクラスIDを表示するメソッド
showClassIdDialog("生成されたクラスID",classId);
} }
}); });
builder.setNegativeButton("No", new DialogInterface.OnClickListener() { builder.setNegativeButton("表示", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Log.d("DialogNO", "DialogでNoが選ばれました"); //roomを扱うため非同期処理
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(() -> {
// 現在のクラスIDを取得
int currentClassId = getCurrentClassIdFromRoom();
runOnUiThread(() -> {
// 現在のクラスIDを表示するダイアログ
showClassIdDialog("現在のクラスID",currentClassId);
});
});
executor.shutdown();
} }
}); });
@ -187,97 +196,108 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
alertDialog.show(); alertDialog.show();
} }
private int getCurrentClassIdFromRoom() {
AppDatabase db = getDatabaseInstance();
SetUpTableDao setUpTableDao = db.setUpTableDao();
// 現在のクラスIDを取得
return setUpTableDao.getClassId();
}
//クラスIDを表示するダイアログ
private void showClassIdDialog(String title, int classId) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(title);
builder.setMessage("クラスID: " + classId);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
//ルート作成の非同期処理 //ルート作成の非同期処理
private void fetchDataAndCreateRoute() { private void fetchDataAndCreateRoute() {
//非同期処理の開始
ExecutorService executor = Executors.newSingleThreadExecutor(); ExecutorService executor = Executors.newSingleThreadExecutor();
CountDownLatch latch = new CountDownLatch(2);
// タスク1: ローカルDBから生徒数を取得してtotalStudentと比較
executor.execute(() -> { executor.execute(() -> {
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build(); AppDatabase db = getDatabaseInstance(); SetUpTableDao setUpTableDao = db.setUpTableDao();
SetUpTableDao setUpTableDao = db.setUpTableDao();
Log.d("MainActivity", "db" + setUpTableDao.getAll());
int totalStudent = setUpTableDao.getTotalStudent(); int totalStudent = setUpTableDao.getTotalStudent();
int myDataListSize = firestoreReception.getMyDataListSize(); int myDataListSize = firestoreReception.getMyDataListSize();
//総生徒数と提出済みになっている生徒の数が一致するかの確認
runOnUiThread(() -> { runOnUiThread(() -> {
if (totalStudent != myDataListSize) { if (totalStudent != myDataListSize) {
showRouteCreationDialog(latch); //未提出者がいることの警告ダイアログ
showRouteCreationDialog();
} else { } else {
latch.countDown(); //ルート作成
createRoute(executor);
} }
}); });
}); });
// タスク2: ルート作成を行う // `fetchDataAndCreateRoute`メソッド内ではshutdownを呼び出さない
}
private void showRouteCreationDialog() {
new AlertDialog.Builder(MainActivity.this)
.setTitle("警告")
.setMessage("人数が足りてませんがそれでもルート作成を行いますか?")
.setPositiveButton("OK", (dialog, which) -> {
// 新しいExecutorServiceを作成してタスクを実行
ExecutorService dialogExecutor = Executors.newSingleThreadExecutor();
createRoute(dialogExecutor);
dialogExecutor.shutdown();
})
.setNegativeButton("Cancel", (dialog, which) -> {
dialog.dismiss();
})
.show();
}
private void createRoute(ExecutorService executor) {
executor.execute(() -> { executor.execute(() -> {
List<MyDataClass> myDataList = null; List<MyDataClass> myDataList = null;
while (myDataList == null) { while (myDataList == null) {
myDataList = firestoreReception.getMyDataList(); myDataList = firestoreReception.getMyDataList();
try { try {
Thread.sleep(3000); Thread.sleep(3000);
Log.d("MainActivity", "myDataList" + myDataList.size());
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); Thread.currentThread().interrupt();
return;
} }
} }
Log.d("MainActivity", "myDataList" + myDataList.size());
CreateRoot createRoot = new CreateRoot(MainActivity.this);
Boolean notDuplicates = createRoot.receiveData(myDataList,getApplicationContext());
latch.countDown();
//final宣言することによってスレッドセーフになる(ラムダ式内で使えるようにする)
final List<MyDataClass> finalMyDataList = myDataList;
CreateRoot createRoot = new CreateRoot(MainActivity.this);
Boolean notDuplicates = createRoot.receiveData(finalMyDataList, getApplicationContext());
runOnUiThread(() -> {
if (notDuplicates) { if (notDuplicates) {
Log.d("MainActivity", "スケジュール作成成功"); Log.d("MainActivity", "スケジュール作成成功");
} else {
showErrorDialog(latch, myDataList);
}
});
new Thread(() -> {
try {
latch.await(); // Both tasks must call countDown() before this returns
runOnUiThread(() -> {
Intent toRoot = new Intent(MainActivity.this, Maps.class); Intent toRoot = new Intent(MainActivity.this, Maps.class);
startActivity(toRoot); startActivity(toRoot);
} else {
//保護者の重複による警告ダイアログ
showErrorDialog(finalMyDataList);
}
}); });
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
// createRouteの最後にexecutorをシャットダウン
executor.shutdown(); executor.shutdown();
});
} }
//ルート作成のダイアログ private void showErrorDialog(List<MyDataClass> myDataList) {
private void showRouteCreationDialog(CountDownLatch latch) {
new AlertDialog.Builder(MainActivity.this)
.setTitle("警告")
.setMessage("人数が足りてませんがそれでもルート作成を行いますか?")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
latch.countDown();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.show();
}
public void showErrorDialog(CountDownLatch latch, List<MyDataClass> myDataList) {
List<Integer> studentNumbers = new ArrayList<>(); List<Integer> studentNumbers = new ArrayList<>();
for (int i = 0; i < myDataList.size(); i++) { for (MyDataClass data : myDataList) {
if (myDataList.get(i).getSchedule() == 0) { if (data.getSchedule() == 0) {
studentNumbers.add(myDataList.get(i).getStudentNumber()); studentNumbers.add(data.getStudentNumber());
} }
} }
StringBuilder message = new StringBuilder("保護者の重複が重大でルート作成ができません。調整してください。\n出席番号: "); StringBuilder message = new StringBuilder("保護者の重複が重大でルート作成ができません。調整してください。\n出席番号: ");
@ -290,15 +310,19 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
new AlertDialog.Builder(MainActivity.this) new AlertDialog.Builder(MainActivity.this)
.setTitle("警告") .setTitle("警告")
.setMessage(message.toString()) .setMessage(message.toString())
.setPositiveButton("OK", new DialogInterface.OnClickListener() { .setPositiveButton("OK", (dialog, which) -> {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
}
}) })
.show(); .show();
} }
private AppDatabase getDatabaseInstance() {
return Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
}
//提出状況の取得 //提出状況の取得
private ArrayList<SubmissionStudent> getSubmissionStudents() { private ArrayList<SubmissionStudent> getSubmissionStudents() {
ArrayList<SubmissionStudent> submissionStudents = new ArrayList<>(); ArrayList<SubmissionStudent> submissionStudents = new ArrayList<>();
@ -309,7 +333,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
executor.execute(() -> { executor.execute(() -> {
// 1. Roomデータベースから全生徒数を取得 // 1. Roomデータベースから全生徒数を取得
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build(); AppDatabase db = getDatabaseInstance();
SetUpTableDao setUpTableDao = db.setUpTableDao(); SetUpTableDao setUpTableDao = db.setUpTableDao();
int totalStudent = setUpTableDao.getTotalStudent(); int totalStudent = setUpTableDao.getTotalStudent();
// 2. Firestoreから生徒番号のリストを取得 // 2. Firestoreから生徒番号のリストを取得

View File

@ -7,129 +7,129 @@ import java.util.List;
public class MyDataClass { public class MyDataClass {
String patronName; private String patronNameString;
int classId; private int classIdInt;
List<String> address; private List<String> addressList;
List<Timestamp> firstDay; private List<Timestamp> firstDayList;
int studentNumber; private int studentNumberInt;
String childName; private String childNameString;
List<Timestamp> thirdDay; private List<Timestamp> thirdDayList;
List<Timestamp> secondDay; private List<Timestamp> secondDayList;
double latitude; private double latitudeDouble;
private Long Timezone; private Long timezoneLong;
private String startDateString; private String startDateString;
private String endDateString; private String endDateString;
private String AssignedStartTime; private String assignedStartTimeString;
private int AssignedIndex; private int assignedIndexInt;
private boolean linking; private boolean linkingBoolean;
private String parentStartTimeString; private String parentStartTimeString;
private String parentEndTimeString; private String parentEndTimeString;
private int schedule; private int scheduleInt;
private String secondDayStartDateString; private String secondDayStartDateString;
private String secondDayEndDateString; private String secondDayEndDateString;
private Long secondDayTimezone; private Long secondDayTimezoneLong;
private String secondDayParentStartTimeString; private String secondDayParentStartTimeString;
private String secondDayParentEndTimeString; private String secondDayParentEndTimeString;
private LatLng latLng; private LatLng latLng;
public MyDataClass(String patronName, int classId, List<String> address, List<Timestamp> firstDay, int studentNumber, String childName, List<Timestamp> thirdDay, List<Timestamp> secondDay) { public MyDataClass(String patronName, int classId, List<String> address, List<Timestamp> firstDay, int studentNumber, String childName, List<Timestamp> thirdDay, List<Timestamp> secondDay) {
this.patronName = patronName; this.patronNameString = patronName;
this.classId = classId; this.classIdInt = classId;
this.address = address; this.addressList = address;
this.firstDay = firstDay; this.firstDayList = firstDay;
this.studentNumber = studentNumber; this.studentNumberInt = studentNumber;
this.childName = childName; this.childNameString = childName;
this.thirdDay = thirdDay; this.thirdDayList = thirdDay;
this.secondDay = secondDay; this.secondDayList = secondDay;
} }
@Override @Override
public String toString() { public String toString() {
return "MyDataClass{" + return "MyDataClass{" +
"patronName='" + patronName + '\'' + "patronName='" + patronNameString + '\'' +
", classId=" + classId + ", classId=" + classIdInt +
", address=" + address + ", address=" + addressList +
", firstDay=" + firstDay + ", firstDay=" + firstDayList +
", studentNumber=" + studentNumber + ", studentNumber=" + studentNumberInt +
", childName='" + childName + '\'' + ", childName='" + childNameString + '\'' +
", thirdDay=" + thirdDay + ", thirdDay=" + thirdDayList +
", secondDay=" + secondDay + ", secondDay=" + secondDayList +
'}'; '}';
} }
//getter //getter
public String getPatronName() { public String getPatronName() {
return patronName; return patronNameString;
} }
//setter //setter
public void setPatronName(String patronName) { public void setPatronName(String patronNameString) {
this.patronName = patronName; this.patronNameString = patronNameString;
} }
public int getClassId() { public int getClassId() {
return classId; return classIdInt;
} }
public void setClassId(int classId) { public void setClassId(int classId) {
this.classId = classId; this.classIdInt = classId;
} }
public List<String> getAddress() { public List<String> getAddress() {
return address; return addressList;
} }
public void setAddress(List<String> address) { public void setAddress(List<String> address) {
this.address = address; this.addressList = address;
} }
public List<Timestamp> getFirstDay() { public List<Timestamp> getFirstDay() {
return firstDay; return firstDayList;
} }
public void setFirstDay(List<Timestamp> firstDay) { public void setFirstDay(List<Timestamp> firstDay) {
this.firstDay = firstDay; this.firstDayList = firstDay;
} }
public int getStudentNumber() { public int getStudentNumber() {
return studentNumber; return studentNumberInt;
} }
public void setStudentNumber(int studentNumber) { public void setStudentNumber(int studentNumber) {
this.studentNumber = studentNumber; this.studentNumberInt = studentNumber;
} }
public String getChildName() { public String getChildName() {
return childName; return childNameString;
} }
public void setChildName(String childName) { public void setChildName(String childName) {
this.childName = childName; this.childNameString = childName;
} }
public List<Timestamp> getThirdDay() { public List<Timestamp> getThirdDay() {
return thirdDay; return thirdDayList;
} }
public void setThirdDay(List<Timestamp> thirdDay) { public void setThirdDay(List<Timestamp> thirdDay) {
this.thirdDay = thirdDay; this.thirdDayList = thirdDay;
} }
public List<Timestamp> getSecondDay() { public List<Timestamp> getSecondDay() {
return secondDay; return secondDayList;
} }
public void setSecondDay(List<Timestamp> secondDay) { public void setSecondDay(List<Timestamp> secondDay) {
this.secondDay = secondDay; this.secondDayList = secondDay;
} }
public double getLatitude() { public double getLatitude() {
return latitude; return latitudeDouble;
} }
public void setLatitude(double latitude) { public void setLatitude(double latitudeDouble) {
this.latitude = latitude; this.latitudeDouble = latitudeDouble;
} }
public void setEndDateString(String endDateString) { public void setEndDateString(String endDateString) {
@ -137,11 +137,11 @@ public class MyDataClass {
} }
public Long getTimezone() { public Long getTimezone() {
return Timezone; return timezoneLong;
} }
public void setTimezone(Long Timezone) { public void setTimezone(Long timezoneLong) {
this.Timezone = Timezone; this.timezoneLong = timezoneLong;
} }
public String getStartDateString() { public String getStartDateString() {
@ -153,29 +153,29 @@ public class MyDataClass {
} }
public void setAssignedStartTime(String AssignedStartTime) { public void setAssignedStartTime(String assignedStartTime) {
this.AssignedStartTime = AssignedStartTime; this.assignedStartTimeString = assignedStartTime;
} }
public String setAssignedEndTime(String s) { public String getAssignedEndTime() {
return AssignedStartTime; return assignedStartTimeString;
} }
public void setAssignedIndex(int AssignedIndex) { public void setAssignedIndex(int assignedIndexInt) {
this.AssignedIndex = AssignedIndex; this.assignedIndexInt = assignedIndexInt;
} }
public int getAssignedIndex() { public int getAssignedIndex() {
return AssignedIndex; return assignedIndexInt;
} }
public void setLinking(boolean linking) { public void setLinking(boolean linking) {
this.linking = linking; this.linkingBoolean = linking;
} }
public boolean getLinking() { public boolean getLinking() {
return linking; return linkingBoolean;
} }
public void setParentStartTimeString(String parentStartTimeString) { public void setParentStartTimeString(String parentStartTimeString) {
@ -194,12 +194,12 @@ public class MyDataClass {
return parentEndTimeString; return parentEndTimeString;
} }
public void setSchedule(int schedule) { public void setSchedule(int scheduleInt) {
this.schedule = schedule; this.scheduleInt = scheduleInt;
} }
public int getSchedule() { public int getSchedule() {
return schedule; return scheduleInt;
} }
public void setSecondDayStartDateString(String secondDayStartDateString) { public void setSecondDayStartDateString(String secondDayStartDateString) {
@ -211,11 +211,11 @@ public class MyDataClass {
} }
public void setSecondDayTimezone(Long secondDayTimezone) { public void setSecondDayTimezone(Long secondDayTimezone) {
this.secondDayTimezone = secondDayTimezone; this.secondDayTimezoneLong = secondDayTimezone;
} }
public Long getSecondDayTimezone() { public Long getSecondDayTimezone() {
return secondDayTimezone; return secondDayTimezoneLong;
} }

View File

@ -42,13 +42,13 @@ public class SetUpActivity extends FragmentActivity
String startBreakTime; String startBreakTime;
String endBreakTime; String endBreakTime;
int totalStudent; int totalStudent;
private TextView setTeacherName; private TextView textViewTeacherName;
private TextView setStartPoint; private TextView textViewStartPoint;
private TextView setStartTime; private TextView textViewStartTime;
private TextView setEndTime; private TextView textViewEndTime;
private TextView setStartBreakTime; private TextView textViewStartBreakTime;
private TextView setEndBreakTime; private TextView textViewEndBreakTime;
private TextView setTotalStudent; private TextView textViewTotalStudent;
private int isDateSelected; private int isDateSelected;
private int isStartTimeSelected; private int isStartTimeSelected;
@ -76,28 +76,28 @@ public class SetUpActivity extends FragmentActivity
int classId= getIntent().getIntExtra("classId", 100000); int classId= getIntent().getIntExtra("classId", 100000);
setTeacherName = findViewById(R.id.teacherName); //先生の名前 textViewTeacherName = findViewById(R.id.teacherName); //先生の名前
setStartPoint = findViewById(R.id.startPoint); //開始地点 textViewStartPoint = findViewById(R.id.startPoint); //開始地点
setFirstDay = findViewById(R.id.setFirstDayButton); //1日目の日付 setFirstDay = findViewById(R.id.setFirstDayButton); //1日目の日付
setSecondDay = findViewById(R.id.setSecondDayButton); //2日目の日付 setSecondDay = findViewById(R.id.setSecondDayButton); //2日目の日付
setThirdDay = findViewById(R.id.setThirdDayButton); //3日目の日付 setThirdDay = findViewById(R.id.setThirdDayButton); //3日目の日付
setStartTimeButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するボタン setStartTimeButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するボタン
setStartTime = findViewById(R.id.startTime); //開始時刻を出力するTextView textViewStartTime = findViewById(R.id.startTime); //開始時刻を出力するTextView
setEndTimeButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するボタン setEndTimeButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するボタン
setEndTime = findViewById(R.id.endTime); //終了時刻を出力するTextView textViewEndTime = findViewById(R.id.endTime); //終了時刻を出力するTextView
RadioButton setTenMinute = findViewById(R.id.tenMinute); //訪問間隔10分 RadioButton setTenMinute = findViewById(R.id.tenMinute); //訪問間隔10分
RadioButton setFifteenMinute = findViewById(R.id.fifteenMinute); //訪問間隔15分 RadioButton setFifteenMinute = findViewById(R.id.fifteenMinute); //訪問間隔15分
RadioButton setThirtyMinute = findViewById(R.id.thirtyMinute); //訪問間隔30分 RadioButton setThirtyMinute = findViewById(R.id.thirtyMinute); //訪問間隔30分
setStartBreakTime = findViewById(R.id.startBreakTime); //休憩開始時刻 textViewStartBreakTime = findViewById(R.id.startBreakTime); //休憩開始時刻
setStartBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG); textViewStartBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
setEndBreakTime = findViewById(R.id.endBreakTime); //休憩終了時刻 textViewEndBreakTime = findViewById(R.id.endBreakTime); //休憩終了時刻
setEndBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG); textViewEndBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
setTotalStudent = findViewById(R.id.totalStudent); //クラスの人数 textViewTotalStudent = findViewById(R.id.totalStudent); //クラスの人数
ImageView toMain = findViewById(R.id.toMain); ImageView toMain = findViewById(R.id.toMain);
Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン
@ -110,9 +110,9 @@ public class SetUpActivity extends FragmentActivity
setUp.setOnClickListener(view -> { setUp.setOnClickListener(view -> {
teacherName = setTeacherName.getText().toString(); //各変数に値を挿入 teacherName = textViewTeacherName.getText().toString(); //各変数に値を挿入
Log.d(TAG, "Teacher Name: " + teacherName); Log.d(TAG, "Teacher Name: " + teacherName);
startPoint = setStartPoint.getText().toString(); startPoint = textViewStartPoint.getText().toString();
Log.d(TAG, "Start Point: " + startPoint); Log.d(TAG, "Start Point: " + startPoint);
Log.d(TAG, "First Day:" + firstDay); Log.d(TAG, "First Day:" + firstDay);
Log.d(TAG, "Second Day:" + secondDay); Log.d(TAG, "Second Day:" + secondDay);
@ -131,7 +131,7 @@ public class SetUpActivity extends FragmentActivity
Log.d(TAG, "Interval Time" + intervalTime); Log.d(TAG, "Interval Time" + intervalTime);
Log.d(TAG, "Start Break Time" + startBreakTime); Log.d(TAG, "Start Break Time" + startBreakTime);
Log.d(TAG, "End Break Time" + endBreakTime); Log.d(TAG, "End Break Time" + endBreakTime);
totalStudent = Integer.parseInt(setTotalStudent.getText().toString()); //数値型に変更 totalStudent = Integer.parseInt(textViewTotalStudent.getText().toString()); //数値型に変更
Log.d(TAG, "Total Student" + totalStudent); Log.d(TAG, "Total Student" + totalStudent);
Log.d(TAG, "onClick: できてるよ"); Log.d(TAG, "onClick: できてるよ");
@ -211,12 +211,12 @@ public class SetUpActivity extends FragmentActivity
showTimePickerDialog(); showTimePickerDialog();
}); });
setStartBreakTime.setOnClickListener(v -> { textViewStartBreakTime.setOnClickListener(v -> {
isStartTimeSelected = 3; isStartTimeSelected = 3;
showTimePickerDialog(); showTimePickerDialog();
}); });
setEndBreakTime.setOnClickListener(v -> { textViewEndBreakTime.setOnClickListener(v -> {
isStartTimeSelected = 4; isStartTimeSelected = 4;
showTimePickerDialog(); showTimePickerDialog();
}); });
@ -224,14 +224,14 @@ public class SetUpActivity extends FragmentActivity
//リセットボタンの処理 //リセットボタンの処理
reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去 reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去
setTeacherName.setText(""); textViewTeacherName.setText("");
setStartPoint.setText(""); textViewStartPoint.setText("");
setTenMinute.setChecked(false); setTenMinute.setChecked(false);
setFifteenMinute.setChecked(false); setFifteenMinute.setChecked(false);
setThirtyMinute.setChecked(false); setThirtyMinute.setChecked(false);
setStartBreakTime.setText(""); textViewStartBreakTime.setText("");
setEndBreakTime.setText(""); textViewEndBreakTime.setText("");
setTotalStudent.setText(""); textViewTotalStudent.setText("");
ExecutorService executor = Executors.newSingleThreadExecutor(); ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(() -> { executor.execute(() -> {
@ -280,25 +280,25 @@ public class SetUpActivity extends FragmentActivity
stringHourOfDay = String.format("%02d", hourOfDay); stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute); stringMinute = String.format("%02d", minute);
startTime = stringHourOfDay + stringMinute; startTime = stringHourOfDay + stringMinute;
setStartTime.setText(str); textViewStartTime.setText(str);
} else if (isStartTimeSelected == 2) { } else if (isStartTimeSelected == 2) {
stringHourOfDay = String.format("%02d", hourOfDay); stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute); stringMinute = String.format("%02d", minute);
endTime = stringHourOfDay + stringMinute; endTime = stringHourOfDay + stringMinute;
setEndTime.setText(str); textViewEndTime.setText(str);
} else if (isStartTimeSelected == 3) { } else if (isStartTimeSelected == 3) {
stringHourOfDay = String.format("%02d", hourOfDay); stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute); stringMinute = String.format("%02d", minute);
startBreakTime =stringHourOfDay + stringMinute; startBreakTime =stringHourOfDay + stringMinute;
setStartBreakTime.setText(" " + str + " "); textViewStartBreakTime.setText(" " + str + " ");
} else if (isStartTimeSelected == 4) { } else if (isStartTimeSelected == 4) {
stringHourOfDay = String.format("%02d", hourOfDay); stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute); stringMinute = String.format("%02d", minute);
endBreakTime = stringHourOfDay + stringMinute; endBreakTime = stringHourOfDay + stringMinute;
setEndBreakTime.setText(" " + str + " "); textViewEndBreakTime.setText(" " + str + " ");
} }
} }