firstDayのTimeStampの0番目と1番目から家庭訪問の希望時間帯の長さtimezoneをdataに追加する処理を実装

This commit is contained in:
it232115 2024-06-19 15:34:13 +09:00
parent eec3846eb4
commit 22ed9e3a31
2 changed files with 18 additions and 1 deletions

View File

@ -2,6 +2,8 @@ package com.example.oplogy;
import android.util.Log; import android.util.Log;
import com.google.firebase.Timestamp;
import java.util.List; import java.util.List;
public class CreateRoot { public class CreateRoot {
@ -13,6 +15,14 @@ public class CreateRoot {
} }
Log.d("CreateRoot", "myDataList[0]: " + myDataList.get(0).toString()); Log.d("CreateRoot", "myDataList[0]: " + myDataList.get(0).toString());
for (MyDataClass data : myDataList) {
Log.d("CreateRoot", "data: " + data.toString());
Timestamp startTime = data.getFirstDay().get(0);
Timestamp endTime = data.getFirstDay().get(1);
Long timezone = endTime.getSeconds() - startTime.getSeconds();
data.setTimezone(timezone);
Log.d("CreateRoot", "timezone: " + timezone);
}
} }
} }

View File

@ -14,6 +14,7 @@ public class MyDataClass {
List<Timestamp> thirdDay; List<Timestamp> thirdDay;
List<Timestamp> secondDay; List<Timestamp> secondDay;
double latitude; double latitude;
private Long Timezone;
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.patronName = patronName;
@ -52,6 +53,8 @@ public class MyDataClass {
public List<Timestamp> getFirstDay() { public List<Timestamp> getFirstDay() {
return firstDay; return firstDay;
} }
public int getStudentNumber() { public int getStudentNumber() {
return studentNumber; return studentNumber;
} }
@ -95,4 +98,8 @@ public class MyDataClass {
public void setLatitude(double latitude) { public void setLatitude(double latitude) {
this.latitude = latitude; this.latitude = latitude;
} }
public void setTimezone(Long Timezone) {
this.Timezone=Timezone;
}
} }