・コード整形 #41
|
@ -1,4 +1,5 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import androidx.room.TypeConverter;
|
import androidx.room.TypeConverter;
|
||||||
|
|
||||||
import com.google.firebase.Timestamp;
|
import com.google.firebase.Timestamp;
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.util.concurrent.Executors;
|
||||||
//保護者の希望とSetUpActivityによって設定された情報をもとにスケジュールとルートを作成する
|
//保護者の希望とSetUpActivityによって設定された情報をもとにスケジュールとルートを作成する
|
||||||
public class CreateSchedule {
|
public class CreateSchedule {
|
||||||
MyDataClass data;//Firestoreから受け取ったdataを入れる変数
|
MyDataClass data;//Firestoreから受け取ったdataを入れる変数
|
||||||
|
|
||||||
|
String startPointString;//家庭訪問の開始地点
|
||||||
String startTimeHomeVisitString;//家庭訪問の開始時間
|
String startTimeHomeVisitString;//家庭訪問の開始時間
|
||||||
String endTimeHomeVisitString;//家庭訪問の終了時間
|
String endTimeHomeVisitString;//家庭訪問の終了時間
|
||||||
String intervalTimeString;//家庭訪問の一家庭当たりの時間
|
String intervalTimeString;//家庭訪問の一家庭当たりの時間
|
||||||
|
@ -42,22 +44,23 @@ public class CreateSchedule {
|
||||||
|
|
||||||
boolean notSecondDuplicatesBoolean = true;//スケジュールの重複の有無(第一希望日のみで通った場合も考えて初期はtrue)
|
boolean notSecondDuplicatesBoolean = true;//スケジュールの重複の有無(第一希望日のみで通った場合も考えて初期はtrue)
|
||||||
|
|
||||||
String[] testdate;
|
String[] date;
|
||||||
|
|
||||||
|
|
||||||
public CreateSchedule(AppCompatActivity activity) {
|
public CreateSchedule(AppCompatActivity activity) {
|
||||||
this.db = Room.databaseBuilder(activity.getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
this.db = Room.databaseBuilder(activity.getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
||||||
SharedPreferences sharedPreferences= activity.getSharedPreferences("visitingDate",Context.MODE_PRIVATE);
|
SharedPreferences sharedPreferences = activity.getSharedPreferences("visitingDate", Context.MODE_PRIVATE);
|
||||||
|
|
||||||
String firstDay=sharedPreferences.getString("day1",null);
|
String firstDay = sharedPreferences.getString("day1", null);
|
||||||
String secondDay=sharedPreferences.getString("day2",null);
|
String secondDay = sharedPreferences.getString("day2", null);
|
||||||
String thirdDay=sharedPreferences.getString("day3",null);
|
String thirdDay = sharedPreferences.getString("day3", null);
|
||||||
|
|
||||||
testdate=new String[]{firstDay,secondDay,thirdDay};
|
date = new String[]{firstDay, secondDay, thirdDay};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//MainActivityからデータを受け取る
|
//MainActivityからデータを受け取る
|
||||||
public Boolean receiveData(List<MyDataClass> myDataList, Context context) {
|
public String receiveData(List<MyDataClass> myDataList, Context context) {
|
||||||
|
|
||||||
//myDataListの要素data第一希望日と第二希望日に以下を追加する
|
//myDataListの要素data第一希望日と第二希望日に以下を追加する
|
||||||
//・保護者の希望時間帯の長さ
|
//・保護者の希望時間帯の長さ
|
||||||
|
@ -107,14 +110,18 @@ public class CreateSchedule {
|
||||||
notSecondDuplicatesBoolean = secondCreateSchedule(myDataList, intervalArrayInt);
|
notSecondDuplicatesBoolean = secondCreateSchedule(myDataList, intervalArrayInt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//重複がなければ開始地点の緯度経度を返す
|
||||||
if (notSecondDuplicatesBoolean) {
|
if (notSecondDuplicatesBoolean) {
|
||||||
|
//スケジュールを基準にソートする
|
||||||
sortSchedule(myDataList);
|
sortSchedule(myDataList);
|
||||||
geocodeAddress(myDataList, context);
|
String startPointLatLngString = geocodeAddress(myDataList, context);
|
||||||
|
Log.d("CreateSchedule", "startPointLatLngString" + startPointLatLngString);
|
||||||
outPutLogSchedule(myDataList);
|
outPutLogSchedule(myDataList);
|
||||||
return notSecondDuplicatesBoolean;
|
return startPointLatLngString;
|
||||||
}
|
}
|
||||||
|
//重複があるときは""を返す
|
||||||
Log.d("CreateSchedule", "重複によるエラー");
|
Log.d("CreateSchedule", "重複によるエラー");
|
||||||
return !notSecondDuplicatesBoolean;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,6 +241,7 @@ public class CreateSchedule {
|
||||||
// setUpActivityによって入力され、Roomに保存された値を取り出す処理
|
// setUpActivityによって入力され、Roomに保存された値を取り出す処理
|
||||||
//Roomの操作の定義
|
//Roomの操作の定義
|
||||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||||
|
startPointString = setUpTableDao.getStartPoint();
|
||||||
startTimeHomeVisitString = setUpTableDao.getStartTime();
|
startTimeHomeVisitString = setUpTableDao.getStartTime();
|
||||||
endTimeHomeVisitString = setUpTableDao.getEndTime();
|
endTimeHomeVisitString = setUpTableDao.getEndTime();
|
||||||
intervalTimeString = setUpTableDao.getIntervalTime();
|
intervalTimeString = setUpTableDao.getIntervalTime();
|
||||||
|
@ -305,7 +313,7 @@ public class CreateSchedule {
|
||||||
for (int x = 0; x < 3; x++) {
|
for (int x = 0; x < 3; x++) {
|
||||||
//家庭訪問の●日目が保護者の第一希望日かを判定する
|
//家庭訪問の●日目が保護者の第一希望日かを判定する
|
||||||
//まだスケジュールを割り当てていない保護者かを判定する
|
//まだスケジュールを割り当てていない保護者かを判定する
|
||||||
if (testdate[x].equals(myDataList.get(i).getStartDateString()) && myDataList.get(i).getSchedule() == 0) {
|
if (date[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;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +336,7 @@ public class CreateSchedule {
|
||||||
for (int x = 0; x < 3; x++) {
|
for (int x = 0; x < 3; x++) {
|
||||||
//家庭訪問の●日目が保護者の第一希望日かを判定する
|
//家庭訪問の●日目が保護者の第一希望日かを判定する
|
||||||
//まだスケジュールを割り当てていない保護者かを判定する
|
//まだスケジュールを割り当てていない保護者かを判定する
|
||||||
if (testdate[x].equals(myDataList.get(i).getSecondDayStartDateString()) && myDataList.get(i).getSchedule() == 0) {
|
if (date[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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,7 +366,7 @@ public class CreateSchedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void geocodeAddress(List<MyDataClass> myDataList, Context context) {
|
private String geocodeAddress(List<MyDataClass> myDataList, Context context) {
|
||||||
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++) {
|
||||||
|
@ -372,9 +380,14 @@ public class CreateSchedule {
|
||||||
myDataList.get(i).setLatLngString(String.valueOf(new LatLng(latitudeDouble, longitudeDouble)));
|
myDataList.get(i).setLatLngString(String.valueOf(new LatLng(latitudeDouble, longitudeDouble)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//SetUpで設定した家庭訪問の開始地点を緯度経度に変換
|
||||||
|
String startPointLatLngString = String.valueOf(geocoder.getFromLocationName(startPointString, 1));
|
||||||
|
Log.d("CreateSchedule", "startPointLatLngString" + startPointLatLngString);
|
||||||
|
return startPointLatLngString;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e("CreateSchedule", "緯度経度の取得に失敗: " + e);
|
Log.e("CreateSchedule", "緯度経度の取得に失敗: " + e);
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void outPutLogSchedule(List<MyDataClass> myDataList) {
|
private void outPutLogSchedule(List<MyDataClass> myDataList) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class CreateUUID {
|
||||||
InsertClassIdforFirebase insertClassIdforFirebase = new InsertClassIdforFirebase();
|
InsertClassIdforFirebase insertClassIdforFirebase = new InsertClassIdforFirebase();
|
||||||
insertClassIdforFirebase.insertClassId(uuid);
|
insertClassIdforFirebase.insertClassId(uuid);
|
||||||
//テスト用
|
//テスト用
|
||||||
uuid=100;
|
uuid = 100;
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import android.widget.DatePicker;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class DatePick extends DialogFragment implements
|
public class DatePick extends DialogFragment implements
|
||||||
DatePickerDialog.OnDateSetListener {
|
DatePickerDialog.OnDateSetListener {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
public class DialogFragment extends AppCompatActivity {
|
public class DialogFragment extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,8 +4,6 @@ import android.util.Log;
|
||||||
|
|
||||||
import com.google.android.gms.tasks.OnCompleteListener;
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
import com.google.android.gms.tasks.Task;
|
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.FirebaseFirestore;
|
||||||
import com.google.firebase.firestore.QueryDocumentSnapshot;
|
import com.google.firebase.firestore.QueryDocumentSnapshot;
|
||||||
import com.google.firebase.firestore.QuerySnapshot;
|
import com.google.firebase.firestore.QuerySnapshot;
|
||||||
|
@ -14,10 +12,10 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
public class FirestoreReception_classIdDatabase {
|
public class FirestoreReception_classIdDatabase {
|
||||||
private FirebaseFirestore db;
|
private FirebaseFirestore db;
|
||||||
private List<Integer> classIdList= new ArrayList<>();
|
private List<Integer> classIdList = new ArrayList<>();
|
||||||
|
|
||||||
public FirestoreReception_classIdDatabase() {
|
public FirestoreReception_classIdDatabase() {
|
||||||
db = FirebaseFirestore.getInstance();
|
db = FirebaseFirestore.getInstance();
|
||||||
|
|
|
@ -55,8 +55,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
|
|
||||||
//取得するためのクラスID
|
//取得するためのクラスID
|
||||||
private int classId;
|
private int classId;
|
||||||
private String address;
|
private final AppDatabase appDatabase = null;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -319,13 +318,14 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
//final宣言することによって、スレッドセーフになる(ラムダ式内で使えるようにする)
|
//final宣言することによって、スレッドセーフになる(ラムダ式内で使えるようにする)
|
||||||
final List<MyDataClass> finalMyDataList = myDataList;
|
final List<MyDataClass> finalMyDataList = myDataList;
|
||||||
CreateSchedule createSchedule = new CreateSchedule(MainActivity.this);
|
CreateSchedule createSchedule = new CreateSchedule(MainActivity.this);
|
||||||
Boolean notDuplicates = createSchedule.receiveData(myDataList, getApplicationContext());
|
String startPointLatLngString = createSchedule.receiveData(myDataList, getApplicationContext());
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
if (notDuplicates) {
|
if ( !startPointLatLngString.equals("")) {
|
||||||
Log.d("MainActivity", "スケジュール作成成功");
|
Log.d("MainActivity", "スケジュール作成成功");
|
||||||
saveMyDataList(finalMyDataList);
|
saveMyDataList(finalMyDataList);
|
||||||
Intent toRoot = new Intent(MainActivity.this, Maps.class);
|
Intent toRoot = new Intent(MainActivity.this, Maps.class);
|
||||||
|
toRoot.putExtra("startPointLatLngString", startPointLatLngString);
|
||||||
startActivity(toRoot);
|
startActivity(toRoot);
|
||||||
} else {
|
} else {
|
||||||
//保護者の重複による警告ダイアログ
|
//保護者の重複による警告ダイアログ
|
||||||
|
|
|
@ -26,7 +26,8 @@ public class Maps extends FragmentActivity implements View.OnClickListener {
|
||||||
private WebView webView;
|
private WebView webView;
|
||||||
ImageView backMain;
|
ImageView backMain;
|
||||||
private MapsBinding binding;
|
private MapsBinding binding;
|
||||||
private ArrayList<Parcelable> myDataList;;
|
private ArrayList<Parcelable> myDataList;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -41,9 +42,19 @@ public class Maps extends FragmentActivity implements View.OnClickListener {
|
||||||
WebSettings webSettings = webView.getSettings();
|
WebSettings webSettings = webView.getSettings();
|
||||||
webSettings.setJavaScriptEnabled(true);
|
webSettings.setJavaScriptEnabled(true);
|
||||||
webView.setWebViewClient(new WebViewClient());
|
webView.setWebViewClient(new WebViewClient());
|
||||||
List<MyDataClass> myDataList=getMyDataList();
|
|
||||||
|
// startPointLatLngStringの取得
|
||||||
|
String startPointLatLngString = getIntent().getStringExtra("startPointLatLngString");
|
||||||
|
//MyDataListの取得
|
||||||
|
List<MyDataClass> myDataList = getMyDataList();
|
||||||
|
|
||||||
String latlngString = "";
|
String latlngString = "";
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
for (int i = -1; i < myDataList.size(); i++) {
|
||||||
|
if (i < 0) {
|
||||||
|
//家庭訪問の開始地点の緯度経度
|
||||||
|
latlngString += startPointLatLngString + "/";
|
||||||
|
} else {
|
||||||
|
//各家庭の緯度経度
|
||||||
String latlng = myDataList.get(i).getLatLngString();
|
String latlng = myDataList.get(i).getLatLngString();
|
||||||
int startIndex = latlng.indexOf("(") + 1;
|
int startIndex = latlng.indexOf("(") + 1;
|
||||||
int endIndex = latlng.indexOf(")");
|
int endIndex = latlng.indexOf(")");
|
||||||
|
@ -53,7 +64,9 @@ public class Maps extends FragmentActivity implements View.OnClickListener {
|
||||||
latlngString += "/";
|
latlngString += "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d("Maps","latlngString"+latlngString);
|
}
|
||||||
|
Log.d("Maps", "startPointLatLngString" + startPointLatLngString);
|
||||||
|
Log.d("Maps", "latlngString" + latlngString);
|
||||||
loadMapInWebView(latlngString);
|
loadMapInWebView(latlngString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,13 +80,14 @@ public class Maps extends FragmentActivity implements View.OnClickListener {
|
||||||
|
|
||||||
// JSON形式のデータをMyDataListに変換
|
// JSON形式のデータをMyDataListに変換
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Type type = new TypeToken<List<MyDataClass>>() {}.getType();
|
Type type = new TypeToken<List<MyDataClass>>() {
|
||||||
|
}.getType();
|
||||||
List<MyDataClass> myDataList = gson.fromJson(json, type);
|
List<MyDataClass> myDataList = gson.fromJson(json, type);
|
||||||
|
|
||||||
return myDataList;
|
return myDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebViewの処理です(Mapの中の処理をやっています)
|
// WebViewの処理です(Mapの中の処理をやっています)
|
||||||
private void loadMapInWebView(String locations) {
|
private void loadMapInWebView(String locations) {
|
||||||
// 区切ることで、追加の地点を入れて、最終地点にピンを打ってある状態です
|
// 区切ることで、追加の地点を入れて、最終地点にピンを打ってある状態です
|
||||||
String[] locArray = locations.split("/");
|
String[] locArray = locations.split("/");
|
||||||
|
|
|
@ -239,7 +239,7 @@ public class MyDataClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLatLngString(String latLng) {
|
public void setLatLngString(String latLng) {
|
||||||
this.latLngString=latLng;
|
this.latLngString = latLng;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLatLngString() {
|
public String getLatLngString() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import androidx.room.Entity;
|
import androidx.room.Entity;
|
||||||
import androidx.room.PrimaryKey;
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ public class SetUpTable {
|
||||||
|
|
||||||
//コンストラクタ
|
//コンストラクタ
|
||||||
public SetUpTable(String teacherName, String startPoint, String startTime, String endTime,
|
public SetUpTable(String teacherName, String startPoint, String startTime, String endTime,
|
||||||
String intervalTime, String startBreakTime, String endBreakTime, int totalStudent,int classId) {
|
String intervalTime, String startBreakTime, String endBreakTime, int totalStudent, int classId) {
|
||||||
this.teacherName = teacherName;
|
this.teacherName = teacherName;
|
||||||
this.startPoint = startPoint;
|
this.startPoint = startPoint;
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
|
@ -32,41 +33,53 @@ public class SetUpTable {
|
||||||
this.totalStudent = totalStudent;
|
this.totalStudent = totalStudent;
|
||||||
this.classId = classId;
|
this.classId = classId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//getter
|
//getter
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTeacherName() {
|
public String getTeacherName() {
|
||||||
return teacherName;
|
return teacherName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStartPoint() {
|
public String getStartPoint() {
|
||||||
return startPoint;
|
return startPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStartTime() {
|
public String getStartTime() {
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEndTime() {
|
public String getEndTime() {
|
||||||
return endTime;
|
return endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTotalStudent() {
|
public int getTotalStudent() {
|
||||||
return totalStudent;
|
return totalStudent;
|
||||||
}
|
}
|
||||||
|
|
||||||
//setter
|
//setter
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTeacherName(String teacherName) {
|
public void setTeacherName(String teacherName) {
|
||||||
this.teacherName = teacherName;
|
this.teacherName = teacherName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartPoint(String startPoint) {
|
public void setStartPoint(String startPoint) {
|
||||||
this.startPoint = startPoint;
|
this.startPoint = startPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartTime(String startTime) {
|
public void setStartTime(String startTime) {
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndTime(String endTime) {
|
public void setEndTime(String endTime) {
|
||||||
this.endTime = endTime;
|
this.endTime = endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTotalStudent(int totalStudent) {
|
public void setTotalStudent(int totalStudent) {
|
||||||
this.totalStudent = totalStudent;
|
this.totalStudent = totalStudent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import androidx.room.Dao;
|
import androidx.room.Dao;
|
||||||
import androidx.room.Insert;
|
import androidx.room.Insert;
|
||||||
import androidx.room.Query;
|
import androidx.room.Query;
|
||||||
|
@ -10,6 +11,7 @@ import java.util.List;
|
||||||
public interface SetUpTableDao {
|
public interface SetUpTableDao {
|
||||||
@Insert
|
@Insert
|
||||||
void insertAll(SetUpTable... setUpTables);
|
void insertAll(SetUpTable... setUpTables);
|
||||||
|
|
||||||
//更新処理
|
//更新処理
|
||||||
@Update
|
@Update
|
||||||
void update(SetUpTable setUpTable);
|
void update(SetUpTable setUpTable);
|
||||||
|
@ -18,6 +20,7 @@ public interface SetUpTableDao {
|
||||||
//削除処理
|
//削除処理
|
||||||
@Query("DELETE FROM SetUpTable")
|
@Query("DELETE FROM SetUpTable")
|
||||||
void deleteAll();
|
void deleteAll();
|
||||||
|
|
||||||
//全件取得
|
//全件取得
|
||||||
@Query("SELECT * FROM SetUpTable")
|
@Query("SELECT * FROM SetUpTable")
|
||||||
List<SetUpTable> getAll();
|
List<SetUpTable> getAll();
|
||||||
|
@ -27,19 +30,30 @@ public interface SetUpTableDao {
|
||||||
|
|
||||||
@Query("SELECT totalStudent FROM SetUpTable")
|
@Query("SELECT totalStudent FROM SetUpTable")
|
||||||
int getTotalStudent();
|
int getTotalStudent();
|
||||||
|
|
||||||
//開始時間と終了時間の取得
|
//開始時間と終了時間の取得
|
||||||
@Query("SELECT startTime FROM SetUpTable")
|
@Query("SELECT startTime FROM SetUpTable")
|
||||||
String getStartTime();
|
String getStartTime();
|
||||||
|
|
||||||
@Query("SELECT endTime FROM SetUpTable")
|
@Query("SELECT endTime FROM SetUpTable")
|
||||||
String getEndTime();
|
String getEndTime();
|
||||||
|
|
||||||
//教師名の取得
|
//教師名の取得
|
||||||
@Query("SELECT intervalTime FROM SetUpTable")
|
@Query("SELECT intervalTime FROM SetUpTable")
|
||||||
String getIntervalTime();
|
String getIntervalTime();
|
||||||
|
|
||||||
@Query("SELECT StartBreakTime FROM SetUpTable")
|
@Query("SELECT StartBreakTime FROM SetUpTable")
|
||||||
String getStartBreakTime();
|
String getStartBreakTime();
|
||||||
|
|
||||||
@Query("SELECT EndBreakTime FROM SetUpTable")
|
@Query("SELECT EndBreakTime FROM SetUpTable")
|
||||||
String getEndBreakTime();
|
String getEndBreakTime();
|
||||||
|
|
||||||
//クラスIDの取得
|
//クラスIDの取得
|
||||||
@Query("SELECT classId FROM SetUpTable")
|
@Query("SELECT classId FROM SetUpTable")
|
||||||
int getClassId();
|
int getClassId();
|
||||||
|
|
||||||
|
@Query("SELECT startPoint FROM setuptable")
|
||||||
|
String getStartPoint();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
package com.example.oplogy;
|
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.os.Bundle;
|
||||||
import android.widget.ImageView;
|
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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -32,7 +30,7 @@ public class SubmissionActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
// インテントから提出状況の生徒の数を取得
|
// インテントから提出状況の生徒の数を取得
|
||||||
studentNumbers=getIntent().getIntegerArrayListExtra("submissionStudents");
|
studentNumbers = getIntent().getIntegerArrayListExtra("submissionStudents");
|
||||||
|
|
||||||
recyclerView = findViewById(R.id.recyclerView);
|
recyclerView = findViewById(R.id.recyclerView);
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
@ -42,6 +40,7 @@ public class SubmissionActivity extends AppCompatActivity {
|
||||||
// 生徒のリストを取得
|
// 生徒のリストを取得
|
||||||
fetchStudents();
|
fetchStudents();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchStudents() {
|
private void fetchStudents() {
|
||||||
// インテントから生徒のリストを取得
|
// インテントから生徒のリストを取得
|
||||||
ArrayList<SubmissionStudent> submissionStudents = getIntent().getParcelableArrayListExtra("submissionStudents");
|
ArrayList<SubmissionStudent> submissionStudents = getIntent().getParcelableArrayListExtra("submissionStudents");
|
||||||
|
|
|
@ -5,7 +5,9 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.StudentViewHolder> {
|
public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.StudentViewHolder> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import androidx.fragment.app.DialogFragment;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
public class TimePick extends DialogFragment implements
|
public class TimePick extends DialogFragment implements
|
||||||
TimePickerDialog.OnTimeSetListener{
|
TimePickerDialog.OnTimeSetListener {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user