datePicker #40
|
@ -98,7 +98,7 @@ public class CreateRoot {
|
|||
notSecondDuplicatesBoolean = secondCreateSchedule(myDataList, intervalArrayInt);
|
||||
}
|
||||
});
|
||||
if(notSecondDuplicatesBoolean){
|
||||
if (notSecondDuplicatesBoolean) {
|
||||
sortSchedule(myDataList);
|
||||
geocodeAddress(myDataList, context);
|
||||
outPutLogSchedule(myDataList);
|
||||
|
@ -114,12 +114,12 @@ public class CreateRoot {
|
|||
// 希望時間帯の終了時刻から開始時刻を引いて希望時間帯の長さ(timezone)に入れる
|
||||
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();
|
||||
data.setTimezone(timezoneLong);
|
||||
|
@ -158,11 +158,11 @@ public class CreateRoot {
|
|||
data = myDataList.get(i);
|
||||
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();
|
||||
data.setTimezone(secondDayTimezoneLong);
|
||||
|
@ -264,17 +264,18 @@ public class CreateRoot {
|
|||
if (intervalMinutesInt % 100 >= 60) {
|
||||
intervalMinutesInt += 40; // 下2桁が60以上の場合は繰り上げる
|
||||
}
|
||||
//教師の休憩時間を除く処理
|
||||
if (intervalMinutesInt < startBreakTimeMinutesInt || intervalMinutesInt >= endBreakTimeMinutesInt) {
|
||||
intervalList.add(intervalMinutesInt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//[3]は家庭訪問の〇日目
|
||||
int[][][] intervalArrayInt = new int[3][intervalList.size()][2];
|
||||
for (int i = 0; i < intervalList.size(); i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
intervalArrayInt[j][i][0] = intervalList.get(i);
|
||||
intervalArrayInt[j][i][1] = 0;//割り当てされていないことを表す
|
||||
intervalArrayInt[j][i][0] = intervalList.get(i);//家庭訪問のスケジュール区切りの時間を要素に入れる
|
||||
intervalArrayInt[j][i][1] = 0;//家庭訪問のスケジュールにまだ保護者が割り当てられていないことを表す
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,6 +294,8 @@ public class CreateRoot {
|
|||
for (int i = 0; i < myDataList.size(); i++) {
|
||||
for (int j = 0; j < intervalArrayInt[0].length - 1; j++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
//家庭訪問の●日目が保護者の第一希望日かを判定する
|
||||
//まだスケジュールを割り当てていない保護者かを判定する
|
||||
if (testdata[x].equals(myDataList.get(i).getStartDateString()) && myDataList.get(i).getSchedule() == 0) {
|
||||
checkSchedule(myDataList, intervalArrayInt, i, j, x, myDataList.get(i).getStartDateString());
|
||||
break;
|
||||
|
@ -303,7 +306,7 @@ public class CreateRoot {
|
|||
}
|
||||
|
||||
for (int i = 0; i < myDataList.size(); i++) {
|
||||
if (myDataList.get(i).getSchedule() == 0) {
|
||||
if (myDataList.get(i).getSchedule() == 0) {//重複により割り当てがされていない保護者がいないかの確認
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -314,6 +317,8 @@ public class CreateRoot {
|
|||
for (int i = 0; i < myDataList.size(); i++) {
|
||||
for (int j = 0; j < intervalArrayInt[0].length - 1; j++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
//家庭訪問の●日目が保護者の第一希望日かを判定する
|
||||
//まだスケジュールを割り当てていない保護者かを判定する
|
||||
if (testdata[x].equals(myDataList.get(i).getSecondDayStartDateString()) && myDataList.get(i).getSchedule() == 0) {
|
||||
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++) {
|
||||
if (myDataList.get(i).getSchedule() == 0) {
|
||||
if (myDataList.get(i).getSchedule() == 0) {//重複により割り当てがされていない保護者がいないかの確認
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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) {
|
||||
intervalArrayInt[x][j][1] += 1;//割り当て済みを表す
|
||||
myDataList.get(i).setSchedule(Integer.parseInt(desiredDateString.substring(4, 8) + intervalArrayInt[x][j][0]));
|
||||
intervalArrayInt[x][j][1] += 1;//その時間が割り当て済みでありこと
|
||||
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) {
|
||||
Comparator<MyDataClass> comparator = Comparator.comparing(MyDataClass::getSchedule);
|
||||
//スケジュールを元にmyDataListをソートする
|
||||
myDataList.sort(comparator);
|
||||
}
|
||||
|
||||
|
@ -347,11 +353,13 @@ public class CreateRoot {
|
|||
try {
|
||||
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
|
||||
for (int i = 0; i < myDataList.size(); i++) {
|
||||
List<Address> addresses = geocoder.getFromLocationName(myDataList.get(i).getAddress().toString(), 1);
|
||||
if (addresses != null && !addresses.isEmpty()) {
|
||||
Address addressResult = addresses.get(0);
|
||||
List<Address> addressesList = geocoder.getFromLocationName(myDataList.get(i).getAddress().toString(), 1);
|
||||
if (addressesList != null && !addressesList.isEmpty()) {
|
||||
Address addressResult = addressesList.get(0);
|
||||
//保護者の住所を緯度経度に変換する
|
||||
double latitudeDouble = addressResult.getLatitude();
|
||||
double longitudeDouble = addressResult.getLongitude();
|
||||
//保護者の住所の緯度経度をmyDataListに追加する
|
||||
myDataList.get(i).setLatLng(new LatLng(latitudeDouble, longitudeDouble));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,12 +87,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
Log.d("MainActivity","geocodeAddress");
|
||||
|
||||
|
||||
//TODO:classIdの初期値を取得
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable")
|
||||
.build();
|
||||
AppDatabase db = getDatabaseInstance();
|
||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||
classId = setUpTableDao.getClassId();
|
||||
firestoreReception.getDocumentsByClassId(classId);
|
||||
|
@ -159,7 +157,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
}
|
||||
}
|
||||
|
||||
//UUIDを表示するかのダイアログ
|
||||
//IDに関する処理
|
||||
private void showUUIDYesNoDialog() {
|
||||
firestoreReception_classIdDatabase = new FirestoreReception_classIdDatabase();
|
||||
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);
|
||||
builder.setTitle("クラスID");
|
||||
builder.setMessage("あなたのクラスIDを表示しますか?");
|
||||
builder.setMessage("あなたのクラスIDを表示/もしくは新規で作成しますか?");
|
||||
|
||||
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton("作成", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
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
|
||||
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();
|
||||
|
||||
}
|
||||
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() {
|
||||
//非同期処理の開始
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(2);
|
||||
|
||||
// タスク1: ローカルDBから生徒数を取得してtotalStudentと比較
|
||||
executor.execute(() -> {
|
||||
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||
|
||||
Log.d("MainActivity", "db" + setUpTableDao.getAll());
|
||||
|
||||
AppDatabase db = getDatabaseInstance(); SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||
int totalStudent = setUpTableDao.getTotalStudent();
|
||||
int myDataListSize = firestoreReception.getMyDataListSize();
|
||||
|
||||
//総生徒数と提出済みになっている生徒の数が一致するかの確認
|
||||
runOnUiThread(() -> {
|
||||
if (totalStudent != myDataListSize) {
|
||||
showRouteCreationDialog(latch);
|
||||
//未提出者がいることの警告ダイアログ
|
||||
showRouteCreationDialog();
|
||||
} 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(() -> {
|
||||
List<MyDataClass> myDataList = null;
|
||||
while (myDataList == null) {
|
||||
myDataList = firestoreReception.getMyDataList();
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
Log.d("MainActivity", "myDataList" + myDataList.size());
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Log.d("MainActivity", "myDataList" + myDataList.size());
|
||||
|
||||
//final宣言することによって、スレッドセーフになる(ラムダ式内で使えるようにする)
|
||||
final List<MyDataClass> finalMyDataList = myDataList;
|
||||
CreateRoot createRoot = new CreateRoot(MainActivity.this);
|
||||
Boolean notDuplicates = createRoot.receiveData(myDataList,getApplicationContext());
|
||||
latch.countDown();
|
||||
Boolean notDuplicates = createRoot.receiveData(finalMyDataList, getApplicationContext());
|
||||
|
||||
if (notDuplicates) {
|
||||
Log.d("MainActivity", "スケジュール作成成功");
|
||||
} else {
|
||||
showErrorDialog(latch, myDataList);
|
||||
}
|
||||
});
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
latch.await(); // Both tasks must call countDown() before this returns
|
||||
runOnUiThread(() -> {
|
||||
runOnUiThread(() -> {
|
||||
if (notDuplicates) {
|
||||
Log.d("MainActivity", "スケジュール作成成功");
|
||||
Intent toRoot = new Intent(MainActivity.this, Maps.class);
|
||||
startActivity(toRoot);
|
||||
});
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
//保護者の重複による警告ダイアログ
|
||||
showErrorDialog(finalMyDataList);
|
||||
}
|
||||
});
|
||||
|
||||
executor.shutdown();
|
||||
// createRouteの最後にexecutorをシャットダウン
|
||||
executor.shutdown();
|
||||
});
|
||||
}
|
||||
|
||||
//ルート作成のダイアログ
|
||||
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) {
|
||||
private void showErrorDialog(List<MyDataClass> myDataList) {
|
||||
List<Integer> studentNumbers = new ArrayList<>();
|
||||
for (int i = 0; i < myDataList.size(); i++) {
|
||||
if (myDataList.get(i).getSchedule() == 0) {
|
||||
studentNumbers.add(myDataList.get(i).getStudentNumber());
|
||||
for (MyDataClass data : myDataList) {
|
||||
if (data.getSchedule() == 0) {
|
||||
studentNumbers.add(data.getStudentNumber());
|
||||
}
|
||||
}
|
||||
StringBuilder message = new StringBuilder("保護者の重複が重大でルート作成ができません。調整してください。\n出席番号: ");
|
||||
|
@ -290,15 +310,19 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
new AlertDialog.Builder(MainActivity.this)
|
||||
.setTitle("警告")
|
||||
.setMessage(message.toString())
|
||||
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
.setPositiveButton("OK", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
private AppDatabase getDatabaseInstance() {
|
||||
return Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//提出状況の取得
|
||||
private ArrayList<SubmissionStudent> getSubmissionStudents() {
|
||||
ArrayList<SubmissionStudent> submissionStudents = new ArrayList<>();
|
||||
|
@ -309,7 +333,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
|
||||
executor.execute(() -> {
|
||||
// 1. Roomデータベースから全生徒数を取得
|
||||
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
||||
AppDatabase db = getDatabaseInstance();
|
||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||
int totalStudent = setUpTableDao.getTotalStudent();
|
||||
// 2. Firestoreから生徒番号のリストを取得
|
||||
|
|
|
@ -7,129 +7,129 @@ import java.util.List;
|
|||
|
||||
public class MyDataClass {
|
||||
|
||||
String patronName;
|
||||
int classId;
|
||||
List<String> address;
|
||||
List<Timestamp> firstDay;
|
||||
int studentNumber;
|
||||
String childName;
|
||||
List<Timestamp> thirdDay;
|
||||
List<Timestamp> secondDay;
|
||||
double latitude;
|
||||
private Long Timezone;
|
||||
private String patronNameString;
|
||||
private int classIdInt;
|
||||
private List<String> addressList;
|
||||
private List<Timestamp> firstDayList;
|
||||
private int studentNumberInt;
|
||||
private String childNameString;
|
||||
private List<Timestamp> thirdDayList;
|
||||
private List<Timestamp> secondDayList;
|
||||
private double latitudeDouble;
|
||||
private Long timezoneLong;
|
||||
private String startDateString;
|
||||
private String endDateString;
|
||||
private String AssignedStartTime;
|
||||
private int AssignedIndex;
|
||||
private boolean linking;
|
||||
private String assignedStartTimeString;
|
||||
private int assignedIndexInt;
|
||||
private boolean linkingBoolean;
|
||||
private String parentStartTimeString;
|
||||
private String parentEndTimeString;
|
||||
private int schedule;
|
||||
private int scheduleInt;
|
||||
private String secondDayStartDateString;
|
||||
private String secondDayEndDateString;
|
||||
private Long secondDayTimezone;
|
||||
private Long secondDayTimezoneLong;
|
||||
private String secondDayParentStartTimeString;
|
||||
private String secondDayParentEndTimeString;
|
||||
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) {
|
||||
this.patronName = patronName;
|
||||
this.classId = classId;
|
||||
this.address = address;
|
||||
this.firstDay = firstDay;
|
||||
this.studentNumber = studentNumber;
|
||||
this.childName = childName;
|
||||
this.thirdDay = thirdDay;
|
||||
this.secondDay = secondDay;
|
||||
this.patronNameString = patronName;
|
||||
this.classIdInt = classId;
|
||||
this.addressList = address;
|
||||
this.firstDayList = firstDay;
|
||||
this.studentNumberInt = studentNumber;
|
||||
this.childNameString = childName;
|
||||
this.thirdDayList = thirdDay;
|
||||
this.secondDayList = secondDay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MyDataClass{" +
|
||||
"patronName='" + patronName + '\'' +
|
||||
", classId=" + classId +
|
||||
", address=" + address +
|
||||
", firstDay=" + firstDay +
|
||||
", studentNumber=" + studentNumber +
|
||||
", childName='" + childName + '\'' +
|
||||
", thirdDay=" + thirdDay +
|
||||
", secondDay=" + secondDay +
|
||||
"patronName='" + patronNameString + '\'' +
|
||||
", classId=" + classIdInt +
|
||||
", address=" + addressList +
|
||||
", firstDay=" + firstDayList +
|
||||
", studentNumber=" + studentNumberInt +
|
||||
", childName='" + childNameString + '\'' +
|
||||
", thirdDay=" + thirdDayList +
|
||||
", secondDay=" + secondDayList +
|
||||
'}';
|
||||
}
|
||||
|
||||
//getter
|
||||
public String getPatronName() {
|
||||
return patronName;
|
||||
return patronNameString;
|
||||
}
|
||||
|
||||
//setter
|
||||
public void setPatronName(String patronName) {
|
||||
this.patronName = patronName;
|
||||
public void setPatronName(String patronNameString) {
|
||||
this.patronNameString = patronNameString;
|
||||
}
|
||||
|
||||
public int getClassId() {
|
||||
return classId;
|
||||
return classIdInt;
|
||||
}
|
||||
|
||||
public void setClassId(int classId) {
|
||||
this.classId = classId;
|
||||
this.classIdInt = classId;
|
||||
}
|
||||
|
||||
public List<String> getAddress() {
|
||||
return address;
|
||||
return addressList;
|
||||
}
|
||||
|
||||
public void setAddress(List<String> address) {
|
||||
this.address = address;
|
||||
this.addressList = address;
|
||||
}
|
||||
|
||||
public List<Timestamp> getFirstDay() {
|
||||
return firstDay;
|
||||
return firstDayList;
|
||||
}
|
||||
|
||||
public void setFirstDay(List<Timestamp> firstDay) {
|
||||
this.firstDay = firstDay;
|
||||
this.firstDayList = firstDay;
|
||||
}
|
||||
|
||||
public int getStudentNumber() {
|
||||
return studentNumber;
|
||||
return studentNumberInt;
|
||||
}
|
||||
|
||||
public void setStudentNumber(int studentNumber) {
|
||||
this.studentNumber = studentNumber;
|
||||
this.studentNumberInt = studentNumber;
|
||||
}
|
||||
|
||||
public String getChildName() {
|
||||
return childName;
|
||||
return childNameString;
|
||||
}
|
||||
|
||||
public void setChildName(String childName) {
|
||||
this.childName = childName;
|
||||
this.childNameString = childName;
|
||||
}
|
||||
|
||||
public List<Timestamp> getThirdDay() {
|
||||
return thirdDay;
|
||||
return thirdDayList;
|
||||
}
|
||||
|
||||
public void setThirdDay(List<Timestamp> thirdDay) {
|
||||
this.thirdDay = thirdDay;
|
||||
this.thirdDayList = thirdDay;
|
||||
}
|
||||
|
||||
public List<Timestamp> getSecondDay() {
|
||||
return secondDay;
|
||||
return secondDayList;
|
||||
}
|
||||
|
||||
public void setSecondDay(List<Timestamp> secondDay) {
|
||||
this.secondDay = secondDay;
|
||||
this.secondDayList = secondDay;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
return latitudeDouble;
|
||||
}
|
||||
|
||||
public void setLatitude(double latitude) {
|
||||
this.latitude = latitude;
|
||||
public void setLatitude(double latitudeDouble) {
|
||||
this.latitudeDouble = latitudeDouble;
|
||||
}
|
||||
|
||||
public void setEndDateString(String endDateString) {
|
||||
|
@ -137,11 +137,11 @@ public class MyDataClass {
|
|||
}
|
||||
|
||||
public Long getTimezone() {
|
||||
return Timezone;
|
||||
return timezoneLong;
|
||||
}
|
||||
|
||||
public void setTimezone(Long Timezone) {
|
||||
this.Timezone = Timezone;
|
||||
public void setTimezone(Long timezoneLong) {
|
||||
this.timezoneLong = timezoneLong;
|
||||
}
|
||||
|
||||
public String getStartDateString() {
|
||||
|
@ -153,29 +153,29 @@ public class MyDataClass {
|
|||
}
|
||||
|
||||
|
||||
public void setAssignedStartTime(String AssignedStartTime) {
|
||||
this.AssignedStartTime = AssignedStartTime;
|
||||
public void setAssignedStartTime(String assignedStartTime) {
|
||||
this.assignedStartTimeString = assignedStartTime;
|
||||
|
||||
}
|
||||
|
||||
public String setAssignedEndTime(String s) {
|
||||
return AssignedStartTime;
|
||||
public String getAssignedEndTime() {
|
||||
return assignedStartTimeString;
|
||||
}
|
||||
|
||||
public void setAssignedIndex(int AssignedIndex) {
|
||||
this.AssignedIndex = AssignedIndex;
|
||||
public void setAssignedIndex(int assignedIndexInt) {
|
||||
this.assignedIndexInt = assignedIndexInt;
|
||||
}
|
||||
|
||||
public int getAssignedIndex() {
|
||||
return AssignedIndex;
|
||||
return assignedIndexInt;
|
||||
}
|
||||
|
||||
public void setLinking(boolean linking) {
|
||||
this.linking = linking;
|
||||
this.linkingBoolean = linking;
|
||||
}
|
||||
|
||||
public boolean getLinking() {
|
||||
return linking;
|
||||
return linkingBoolean;
|
||||
}
|
||||
|
||||
public void setParentStartTimeString(String parentStartTimeString) {
|
||||
|
@ -194,12 +194,12 @@ public class MyDataClass {
|
|||
return parentEndTimeString;
|
||||
}
|
||||
|
||||
public void setSchedule(int schedule) {
|
||||
this.schedule = schedule;
|
||||
public void setSchedule(int scheduleInt) {
|
||||
this.scheduleInt = scheduleInt;
|
||||
}
|
||||
|
||||
public int getSchedule() {
|
||||
return schedule;
|
||||
return scheduleInt;
|
||||
}
|
||||
|
||||
public void setSecondDayStartDateString(String secondDayStartDateString) {
|
||||
|
@ -211,11 +211,11 @@ public class MyDataClass {
|
|||
}
|
||||
|
||||
public void setSecondDayTimezone(Long secondDayTimezone) {
|
||||
this.secondDayTimezone = secondDayTimezone;
|
||||
this.secondDayTimezoneLong = secondDayTimezone;
|
||||
}
|
||||
|
||||
public Long getSecondDayTimezone() {
|
||||
return secondDayTimezone;
|
||||
return secondDayTimezoneLong;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,13 +42,13 @@ public class SetUpActivity extends FragmentActivity
|
|||
String startBreakTime;
|
||||
String endBreakTime;
|
||||
int totalStudent;
|
||||
private TextView setTeacherName;
|
||||
private TextView setStartPoint;
|
||||
private TextView setStartTime;
|
||||
private TextView setEndTime;
|
||||
private TextView setStartBreakTime;
|
||||
private TextView setEndBreakTime;
|
||||
private TextView setTotalStudent;
|
||||
private TextView textViewTeacherName;
|
||||
private TextView textViewStartPoint;
|
||||
private TextView textViewStartTime;
|
||||
private TextView textViewEndTime;
|
||||
private TextView textViewStartBreakTime;
|
||||
private TextView textViewEndBreakTime;
|
||||
private TextView textViewTotalStudent;
|
||||
private int isDateSelected;
|
||||
private int isStartTimeSelected;
|
||||
|
||||
|
@ -76,28 +76,28 @@ public class SetUpActivity extends FragmentActivity
|
|||
|
||||
int classId= getIntent().getIntExtra("classId", 100000);
|
||||
|
||||
setTeacherName = findViewById(R.id.teacherName); //先生の名前
|
||||
setStartPoint = findViewById(R.id.startPoint); //開始地点
|
||||
textViewTeacherName = findViewById(R.id.teacherName); //先生の名前
|
||||
textViewStartPoint = findViewById(R.id.startPoint); //開始地点
|
||||
|
||||
setFirstDay = findViewById(R.id.setFirstDayButton); //1日目の日付
|
||||
setSecondDay = findViewById(R.id.setSecondDayButton); //2日目の日付
|
||||
setThirdDay = findViewById(R.id.setThirdDayButton); //3日目の日付
|
||||
|
||||
setStartTimeButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するボタン
|
||||
setStartTime = findViewById(R.id.startTime); //開始時刻を出力するTextView
|
||||
textViewStartTime = findViewById(R.id.startTime); //開始時刻を出力するTextView
|
||||
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 setFifteenMinute = findViewById(R.id.fifteenMinute); //訪問間隔(15分)
|
||||
RadioButton setThirtyMinute = findViewById(R.id.thirtyMinute); //訪問間隔(30分)
|
||||
|
||||
setStartBreakTime = findViewById(R.id.startBreakTime); //休憩開始時刻
|
||||
setStartBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
setEndBreakTime = findViewById(R.id.endBreakTime); //休憩終了時刻
|
||||
setEndBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
textViewStartBreakTime = findViewById(R.id.startBreakTime); //休憩開始時刻
|
||||
textViewStartBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
textViewEndBreakTime = findViewById(R.id.endBreakTime); //休憩終了時刻
|
||||
textViewEndBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
|
||||
setTotalStudent = findViewById(R.id.totalStudent); //クラスの人数
|
||||
textViewTotalStudent = findViewById(R.id.totalStudent); //クラスの人数
|
||||
|
||||
ImageView toMain = findViewById(R.id.toMain);
|
||||
Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン
|
||||
|
@ -110,9 +110,9 @@ public class SetUpActivity extends FragmentActivity
|
|||
|
||||
setUp.setOnClickListener(view -> {
|
||||
|
||||
teacherName = setTeacherName.getText().toString(); //各変数に値を挿入
|
||||
teacherName = textViewTeacherName.getText().toString(); //各変数に値を挿入
|
||||
Log.d(TAG, "Teacher Name: " + teacherName);
|
||||
startPoint = setStartPoint.getText().toString();
|
||||
startPoint = textViewStartPoint.getText().toString();
|
||||
Log.d(TAG, "Start Point: " + startPoint);
|
||||
Log.d(TAG, "First Day:" + firstDay);
|
||||
Log.d(TAG, "Second Day:" + secondDay);
|
||||
|
@ -131,7 +131,7 @@ public class SetUpActivity extends FragmentActivity
|
|||
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()); //数値型に変更
|
||||
totalStudent = Integer.parseInt(textViewTotalStudent.getText().toString()); //数値型に変更
|
||||
Log.d(TAG, "Total Student" + totalStudent);
|
||||
Log.d(TAG, "onClick: できてるよ");
|
||||
|
||||
|
@ -211,12 +211,12 @@ public class SetUpActivity extends FragmentActivity
|
|||
showTimePickerDialog();
|
||||
});
|
||||
|
||||
setStartBreakTime.setOnClickListener(v -> {
|
||||
textViewStartBreakTime.setOnClickListener(v -> {
|
||||
isStartTimeSelected = 3;
|
||||
showTimePickerDialog();
|
||||
});
|
||||
|
||||
setEndBreakTime.setOnClickListener(v -> {
|
||||
textViewEndBreakTime.setOnClickListener(v -> {
|
||||
isStartTimeSelected = 4;
|
||||
showTimePickerDialog();
|
||||
});
|
||||
|
@ -224,14 +224,14 @@ public class SetUpActivity extends FragmentActivity
|
|||
//リセットボタンの処理
|
||||
|
||||
reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去
|
||||
setTeacherName.setText("");
|
||||
setStartPoint.setText("");
|
||||
textViewTeacherName.setText("");
|
||||
textViewStartPoint.setText("");
|
||||
setTenMinute.setChecked(false);
|
||||
setFifteenMinute.setChecked(false);
|
||||
setThirtyMinute.setChecked(false);
|
||||
setStartBreakTime.setText("");
|
||||
setEndBreakTime.setText("");
|
||||
setTotalStudent.setText("");
|
||||
textViewStartBreakTime.setText("");
|
||||
textViewEndBreakTime.setText("");
|
||||
textViewTotalStudent.setText("");
|
||||
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
executor.execute(() -> {
|
||||
|
@ -280,25 +280,25 @@ public class SetUpActivity extends FragmentActivity
|
|||
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||
stringMinute = String.format("%02d", minute);
|
||||
startTime = stringHourOfDay + stringMinute;
|
||||
setStartTime.setText(str);
|
||||
textViewStartTime.setText(str);
|
||||
|
||||
} else if (isStartTimeSelected == 2) {
|
||||
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||
stringMinute = String.format("%02d", minute);
|
||||
endTime = stringHourOfDay + stringMinute;
|
||||
setEndTime.setText(str);
|
||||
textViewEndTime.setText(str);
|
||||
|
||||
} else if (isStartTimeSelected == 3) {
|
||||
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||
stringMinute = String.format("%02d", minute);
|
||||
startBreakTime =stringHourOfDay + stringMinute;
|
||||
setStartBreakTime.setText(" " + str + " ");
|
||||
textViewStartBreakTime.setText(" " + str + " ");
|
||||
|
||||
} else if (isStartTimeSelected == 4) {
|
||||
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||
stringMinute = String.format("%02d", minute);
|
||||
endBreakTime = stringHourOfDay + stringMinute;
|
||||
setEndBreakTime.setText(" " + str + " ");
|
||||
textViewEndBreakTime.setText(" " + str + " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user