Compare commits
No commits in common. "master" and "SpreadSheet" have entirely different histories.
master
...
SpreadShee
|
@ -5,6 +5,7 @@
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="GRADLE" />
|
<option name="testRunner" value="GRADLE" />
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="jbr-17" />
|
<option name="gradleJvm" value="jbr-17" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
|
@ -13,7 +14,6 @@
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveExternalAnnotations" value="false" />
|
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -52,11 +52,3 @@ dependencies {
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
//Map用の依存関係の追加
|
|
||||||
dependencies {
|
|
||||||
implementation 'com.google.android.gms:play-services-maps:18.0.0'
|
|
||||||
implementation 'com.google.android.gms:play-services-location:18.0.0'
|
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
|
||||||
implementation 'com.google.code.gson:gson:2.8.9' // Gsonライブラリの追加
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.ACCESS_FINE_LOCATION"
|
|
||||||
tools:ignore="CoarseFineLocation" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -18,9 +15,6 @@
|
||||||
android:theme="@style/Theme.Oplogy"
|
android:theme="@style/Theme.Oplogy"
|
||||||
tools:ignore="ExtraText"
|
tools:ignore="ExtraText"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
|
||||||
android:name=".SettingView"
|
|
||||||
android:exported="false" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".SetUpActivity"
|
android:name=".SetUpActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
@ -43,9 +37,15 @@
|
||||||
android:name=".Maps"
|
android:name=".Maps"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/title_activity_maps" />
|
android:label="@string/title_activity_maps" />
|
||||||
|
<activity
|
||||||
|
android:name=".TutorialActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".SubmissionActivity"
|
android:name=".SubmissionActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".RootSearchActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".CreateUUID"
|
android:name=".CreateUUID"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
Before Width: | Height: | Size: 367 KiB |
|
@ -1,9 +1,9 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import androidx.room.Database;
|
import androidx.room.Database;
|
||||||
import androidx.room.RoomDatabase;
|
import androidx.room.RoomDatabase;
|
||||||
|
import androidx.room.TypeConverters;
|
||||||
|
|
||||||
@Database(entities = {SetUpTable.class}, version = 2, exportSchema = false)
|
@Database(entities = {SetUpTable.class}, version = 1)
|
||||||
public abstract class AppDatabase extends RoomDatabase {
|
public abstract class AppDatabase extends RoomDatabase {
|
||||||
// データベースにアクセスするためのメソッドを提供する
|
// データベースにアクセスするためのメソッドを提供する
|
||||||
public abstract SetUpTableDao setUpTableDao();
|
public abstract SetUpTableDao setUpTableDao();
|
||||||
|
|
|
@ -16,11 +16,11 @@ public class Converters {
|
||||||
// タイムスタンプを文字列(yyyy-mm-dd,日時)に変換
|
// タイムスタンプを文字列(yyyy-mm-dd,日時)に変換
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
public static List<String> fromTimestampList(List<Timestamp> timestamps) {
|
public static List<String> fromTimestampList(List<Timestamp> timestamps) {
|
||||||
List<String> stringsList = new ArrayList<>();
|
List<String> strings = new ArrayList<>();
|
||||||
for (Timestamp timestamp : timestamps) {
|
for (Timestamp timestamp : timestamps) {
|
||||||
stringsList.add(format.format(timestamp.toDate()));
|
strings.add(format.format(timestamp.toDate()));
|
||||||
}
|
}
|
||||||
return stringsList;
|
return strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
|
|
18
app/src/main/java/com/example/oplogy/CreateRoot.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package com.example.oplogy;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CreateRoot {
|
||||||
|
public void receiveData(List<MyDataClass> myDataList) {
|
||||||
|
|
||||||
|
// デバッグ用ログ
|
||||||
|
for(MyDataClass data : myDataList){
|
||||||
|
Log.d("CreateRoot", "data: "+ data.toString());
|
||||||
|
}
|
||||||
|
Log.d("CreateRoot", "myDataList[0]: " + myDataList.get(0).toString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,420 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.location.Address;
|
|
||||||
import android.location.Geocoder;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.room.Room;
|
|
||||||
|
|
||||||
import com.google.android.gms.maps.model.LatLng;
|
|
||||||
import com.google.firebase.Timestamp;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.TimeZone;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
//保護者の希望とSetUpActivityによって設定された情報をもとにスケジュールとルートを作成する
|
|
||||||
public class CreateSchedule {
|
|
||||||
MyDataClass data;//Firestoreから受け取ったdataを入れる変数
|
|
||||||
|
|
||||||
String startPointString;//家庭訪問の開始地点
|
|
||||||
String startTimeHomeVisitString;//家庭訪問の開始時間
|
|
||||||
String endTimeHomeVisitString;//家庭訪問の終了時間
|
|
||||||
String intervalTimeString;//家庭訪問の一家庭当たりの時間
|
|
||||||
String startBreakTimeString;//家庭訪問の休憩の開始時間
|
|
||||||
String endBreakTimeString;//家庭訪問の休憩の終了時間
|
|
||||||
|
|
||||||
|
|
||||||
int intervalInt;//家庭訪問の一家庭当たりの時間と移動時間の合計
|
|
||||||
int startBreakTimeMinutesInt;//家庭訪問の開始時間から休憩時間までの時間
|
|
||||||
int endBreakTimeMinutesInt;//家庭訪問の休憩終了時間から終了時間までの時間
|
|
||||||
|
|
||||||
private final AppDatabase db;
|
|
||||||
private int arraySizeInt;
|
|
||||||
|
|
||||||
private boolean notSecondDuplicatesBoolean;//スケジュールの重複の有無(第一希望日のみで通った場合も考えて初期はtrue)
|
|
||||||
|
|
||||||
String[] homeVisitDaysString;
|
|
||||||
|
|
||||||
|
|
||||||
public CreateSchedule(AppCompatActivity activity) {
|
|
||||||
this.db = Room.databaseBuilder(activity.getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
|
||||||
this.notSecondDuplicatesBoolean = true; // 初期値をtrueに設定する
|
|
||||||
SharedPreferences sharedPreferences = activity.getSharedPreferences("visitingDate", Context.MODE_PRIVATE);
|
|
||||||
|
|
||||||
String firstDay = sharedPreferences.getString("day1", null);
|
|
||||||
String secondDay = sharedPreferences.getString("day2", null);
|
|
||||||
String thirdDay = sharedPreferences.getString("day3", null);
|
|
||||||
|
|
||||||
Log.d("createSchedule","day1"+firstDay+"day2"+secondDay+"thirdday"+thirdDay);
|
|
||||||
homeVisitDaysString = new String[]{firstDay, secondDay, thirdDay};
|
|
||||||
}
|
|
||||||
|
|
||||||
//MainActivityからデータを受け取る
|
|
||||||
public String receiveData(List<MyDataClass> myDataList, Context context) {
|
|
||||||
|
|
||||||
//myDataListの要素data第一希望日と第二希望日に以下を追加する
|
|
||||||
//・保護者の希望時間帯の長さ
|
|
||||||
//・家庭訪問の日付
|
|
||||||
//・保護者の希望時間帯の開始と終了時間
|
|
||||||
setData(myDataList);
|
|
||||||
//希望時間帯の長さ順に並び替える前のログ
|
|
||||||
outPutLogSort(myDataList);
|
|
||||||
//保護者の希望時間帯が短い順にmyDataListのDataを並び替える
|
|
||||||
timeZoneSort(myDataList);
|
|
||||||
//希望時間帯の長さ順に並び替えたあとのログ
|
|
||||||
outPutLogSort(myDataList);
|
|
||||||
|
|
||||||
|
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
|
||||||
executor.execute(() -> {
|
|
||||||
//Roomから以下の情報を取得
|
|
||||||
//・家庭訪問全体の開始時間
|
|
||||||
//・家庭訪問全体の終了時間
|
|
||||||
//・一家庭あたりの家庭訪問の時間
|
|
||||||
//・家庭訪問の休憩開始時間
|
|
||||||
//・家庭訪問の休憩終了時間
|
|
||||||
getRoomData();
|
|
||||||
|
|
||||||
//Roomから取得した情報のログ
|
|
||||||
outPutLogRoomData();
|
|
||||||
|
|
||||||
//以下の情報を計算
|
|
||||||
//・家庭訪問の合計時間
|
|
||||||
//・家庭訪問の開始時間から休憩時間までの分数
|
|
||||||
//・家庭訪問の休憩終了時間から終了時間までの分数
|
|
||||||
timeCalculation(endTimeHomeVisitString, startBreakTimeString, endBreakTimeString);
|
|
||||||
|
|
||||||
//家庭訪問全体のスケジュールの開始時間を要素とした配列の作成(例:1200,1220,1240のように各家庭への到着時間となる区切り)とログ表示
|
|
||||||
int[][][] intervalArrayInt = homeVisitSchedule();
|
|
||||||
outPutLogIntervalArray(intervalArrayInt);
|
|
||||||
|
|
||||||
//スケジュール作成
|
|
||||||
boolean notDuplicatesBoolean = createSchedule(myDataList, intervalArrayInt);
|
|
||||||
|
|
||||||
//スケジュールの重複の確認
|
|
||||||
if (notDuplicatesBoolean) {
|
|
||||||
//スケジュールを基準にソートする
|
|
||||||
sortSchedule(myDataList);
|
|
||||||
}else{
|
|
||||||
//第二希望日で同じ処理を行う
|
|
||||||
Log.d("CreateSchedule", "第二希望");
|
|
||||||
secondSetData(myDataList);
|
|
||||||
secondTimeZoneSort(myDataList);
|
|
||||||
notSecondDuplicatesBoolean = secondCreateSchedule(myDataList, intervalArrayInt);
|
|
||||||
//スケジュールを基準にソートする
|
|
||||||
sortSchedule(myDataList);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 重複がなければ開始地点の緯度経度を返す
|
|
||||||
if (notSecondDuplicatesBoolean) {
|
|
||||||
// 保護者の住所を緯度経度に変換する
|
|
||||||
String startPointLatLngString = geocodeAddress(myDataList, context);
|
|
||||||
Log.d("CreateSchedule", "startPointLatLngString" + startPointLatLngString);
|
|
||||||
outPutLogSchedule(myDataList);
|
|
||||||
return startPointLatLngString;
|
|
||||||
} else {
|
|
||||||
// 重複があるときは""を返す
|
|
||||||
Log.d("CreateSchedule", "重複によるエラー");
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void setData(List<MyDataClass> myDataList) {
|
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
|
||||||
// 希望時間帯の終了時刻から開始時刻を引いて希望時間帯の長さ(timezone)に入れる
|
|
||||||
data = myDataList.get(i);
|
|
||||||
//保護者の第一希望日
|
|
||||||
List<Timestamp> firstDayList = data.getFirstDay();
|
|
||||||
|
|
||||||
//保護者の第一希望日の開始時間
|
|
||||||
Timestamp parentStartTimestamp = firstDayList.get(0);
|
|
||||||
//保護者の第一希望日の終了時間
|
|
||||||
Timestamp parentEndTimestamp = firstDayList.get(1);
|
|
||||||
//保護者の第一希望日の希望時間帯の長さ
|
|
||||||
Long timezoneLong = parentEndTimestamp.getSeconds() - parentStartTimestamp.getSeconds();
|
|
||||||
data.setTimezone(timezoneLong);
|
|
||||||
|
|
||||||
// TimeStampを日付に変換
|
|
||||||
Date startDate = new Date(parentStartTimestamp.getSeconds() * 1000);
|
|
||||||
Date endDate = new Date(parentEndTimestamp.getSeconds() * 1000);
|
|
||||||
SimpleDateFormat sdfDateData = new SimpleDateFormat("yyyyMMdd");
|
|
||||||
sdfDateData.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
|
|
||||||
//第一希望日の日付
|
|
||||||
String startDateString = sdfDateData.format(startDate);
|
|
||||||
String endDateString = sdfDateData.format(endDate);
|
|
||||||
|
|
||||||
|
|
||||||
SimpleDateFormat sdfMinutes = new SimpleDateFormat("HHmm");
|
|
||||||
sdfMinutes.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
|
|
||||||
//保護者の希望開始時間を時間表記にしたもの
|
|
||||||
String parentStartTimeString = sdfMinutes.format(parentStartTimestamp.toDate());
|
|
||||||
//保護者の希望終了時間を時間表記にしたもの
|
|
||||||
String parentEndTimeString = sdfMinutes.format(parentEndTimestamp.toDate());
|
|
||||||
|
|
||||||
|
|
||||||
// myDataList の中の data に追加する処理
|
|
||||||
myDataList.get(i).setTimezone(timezoneLong);
|
|
||||||
myDataList.get(i).setStartDateString(startDateString);
|
|
||||||
myDataList.get(i).setEndDateString(endDateString);
|
|
||||||
myDataList.get(i).setParentStartTimeString(parentStartTimeString);
|
|
||||||
myDataList.get(i).setParentEndTimeString(parentEndTimeString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//setDataと処理は同じ(第二希望は任意なのでその点だけ確認)
|
|
||||||
private void secondSetData(List<MyDataClass> myDataList) {
|
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
|
||||||
// 希望時間帯の終了時刻から開始時刻を引いて希望時間帯の長さ(timezone)に入れる
|
|
||||||
data = myDataList.get(i);
|
|
||||||
if (myDataList.get(i).getSecondDay() != null) {
|
|
||||||
//保護者の第二希望日
|
|
||||||
List<Timestamp> secondDayList = data.getSecondDay();
|
|
||||||
//保護者の第二希望日の開始時間
|
|
||||||
Timestamp parentStartTimestamp = secondDayList.get(0);
|
|
||||||
//保護者の第二希望日の終了時間
|
|
||||||
Timestamp parentEndTimestamp = secondDayList.get(1);
|
|
||||||
//保護者の第二希望日の希望時間帯の長さ
|
|
||||||
Long secondDayTimezoneLong = parentEndTimestamp.getSeconds() - parentStartTimestamp.getSeconds();
|
|
||||||
data.setTimezone(secondDayTimezoneLong);
|
|
||||||
|
|
||||||
// TimeStampを日付に変換
|
|
||||||
Date startDate = new Date(parentStartTimestamp.getSeconds() * 1000);
|
|
||||||
Date endDate = new Date(parentEndTimestamp.getSeconds() * 1000);
|
|
||||||
SimpleDateFormat sdfDateData = new SimpleDateFormat("yyyyMMdd");
|
|
||||||
sdfDateData.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
|
|
||||||
//第二希望日の日付
|
|
||||||
String secondDayStartDateString = sdfDateData.format(startDate);
|
|
||||||
String secondDaySndDateString = sdfDateData.format(endDate);
|
|
||||||
|
|
||||||
|
|
||||||
SimpleDateFormat sdfMinutes = new SimpleDateFormat("HHmm");
|
|
||||||
sdfMinutes.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
|
|
||||||
//保護者の希望開始時間を時間表記にしたもの
|
|
||||||
String secondDayParentStartTimeString = sdfMinutes.format(parentStartTimestamp.toDate());
|
|
||||||
//保護者の希望終了時間を時間表記にしたもの
|
|
||||||
String secondDayParentEndTimeString = sdfMinutes.format(parentEndTimestamp.toDate());
|
|
||||||
|
|
||||||
|
|
||||||
// myDataList の中の data に追加する処理
|
|
||||||
myDataList.get(i).setSecondDayTimezone(secondDayTimezoneLong);
|
|
||||||
myDataList.get(i).setSecondDayStartDateString(secondDayStartDateString);
|
|
||||||
myDataList.get(i).setSecondDayEndDateString(secondDaySndDateString);
|
|
||||||
myDataList.get(i).setSecondDayParentStartTimeString(secondDayParentStartTimeString);
|
|
||||||
myDataList.get(i).setSecondDayParentEndTimeString(secondDayParentEndTimeString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void timeZoneSort(List<MyDataClass> myDataList) {
|
|
||||||
// timezoneを比較するComparator→timezoneが短い順に並べる
|
|
||||||
Comparator<MyDataClass> comparator = Comparator.comparing(MyDataClass::getTimezone);
|
|
||||||
// myDataListをtimezoneの値でソート
|
|
||||||
myDataList.sort(comparator);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void secondTimeZoneSort(List<MyDataClass> myDataList) {
|
|
||||||
// timezoneを比較するComparator→timezoneが短い順に並べる
|
|
||||||
Comparator<MyDataClass> comparator = Comparator.comparing(MyDataClass::getSecondDayTimezone);
|
|
||||||
// myDataListをtimezoneの値でソート
|
|
||||||
myDataList.sort(comparator);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void outPutLogSort(List<MyDataClass> myDataList) {
|
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
|
||||||
Log.d("CreateSchedule", "(index: " + i + ") data: " + myDataList.get(i).getPatronName());
|
|
||||||
Log.d("CreateSchedule", "(index: " + i + ") data: " + myDataList.get(i).getClass());
|
|
||||||
Log.d("CreateSchedule", "(index: " + i + ") timezone: " + myDataList.get(i).getTimezone());
|
|
||||||
Log.d("CreateSchedule", "(index: " + i + ") startDate: " + myDataList.get(i).getStartDateString());
|
|
||||||
Log.d("CreateSchedule:outPutLogBeforeSort", "parentStartTimeString: " + myDataList.get(i).getParentStartTimeString());
|
|
||||||
Log.d("CreateSchedule:outPutLogBeforeSort", "parentEndTimeString: " + myDataList.get(i).getParentEndTimeString());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getRoomData() {
|
|
||||||
// setUpActivityによって入力され、Roomに保存された値を取り出す処理
|
|
||||||
//Roomの操作の定義
|
|
||||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
|
||||||
startPointString = setUpTableDao.getStartPoint();
|
|
||||||
startTimeHomeVisitString = setUpTableDao.getStartTime();
|
|
||||||
endTimeHomeVisitString = setUpTableDao.getEndTime();
|
|
||||||
intervalTimeString = setUpTableDao.getIntervalTime();
|
|
||||||
startBreakTimeString = setUpTableDao.getStartBreakTime();
|
|
||||||
endBreakTimeString = setUpTableDao.getEndBreakTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Roomからのデータ取得に関するログ
|
|
||||||
void outPutLogRoomData() {
|
|
||||||
Log.d("CreateSchedule:outPutLogRoomData", "開始時間" + startTimeHomeVisitString);
|
|
||||||
Log.d("CreateSchedule:outPutLogRoomData", "終了時刻" + endTimeHomeVisitString);
|
|
||||||
Log.d("CreateSchedule:outPutLogRoomData", "一家庭当たりの所要時間" + intervalTimeString);
|
|
||||||
Log.d("CreateSchedule:outPutLogRoomData", "休憩開始時刻" + startBreakTimeString);
|
|
||||||
Log.d("CreateSchedule:outPutLogRoomData", "休憩終了時刻" + endBreakTimeString);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void timeCalculation(String endTimeHomeVisitString, String startBreakTime, String endBreakTime) {
|
|
||||||
//家庭訪問の合計時間を計算するため、家庭訪問の終了時間から開始時間を引いた数を求めている。但し、(0,2)によって先に1時間単位の差を求めた後に、(2,4)によって分単位の差を求めている
|
|
||||||
int totalTimeInt = ((Integer.parseInt(endTimeHomeVisitString.substring(0, 2)) - (Integer.parseInt(startTimeHomeVisitString.substring(0, 2)))) * 60 + ((Integer.parseInt(endTimeHomeVisitString.substring(2, 4)))) - (Integer.parseInt(startTimeHomeVisitString.substring(2, 4))));
|
|
||||||
//家庭訪問の休憩開始時間から家庭訪問の開始時間を引くことで家庭訪問の開始から休憩時間までの分数を計算
|
|
||||||
startBreakTimeMinutesInt = ((Integer.parseInt(startBreakTime.substring(0, 2))) - (Integer.parseInt(startTimeHomeVisitString.substring(0, 2)))) * 60 + ((Integer.parseInt(startBreakTime.substring(2, 4))) - (Integer.parseInt(startTimeHomeVisitString.substring(2, 4))));
|
|
||||||
//家庭訪問の休憩終了時間から家庭訪問の終了時間を引くことで休憩の終わりから家庭訪問の終了時間までの分数を計算
|
|
||||||
endBreakTimeMinutesInt = ((Integer.parseInt(endBreakTime.substring(0, 2))) - (Integer.parseInt(startTimeHomeVisitString.substring(0, 2)))) * 60 + ((Integer.parseInt(endBreakTime.substring(2, 4))) - (Integer.parseInt(startTimeHomeVisitString.substring(2, 4))));
|
|
||||||
intervalInt = Integer.parseInt(intervalTimeString) + 10;//移動時間込みの1家庭当たりの所要時間
|
|
||||||
arraySizeInt = totalTimeInt / intervalInt;//家庭訪問の合計時間から移動時間込みの1家庭当たりの所要時間を割ることで配列の数を求めている
|
|
||||||
}
|
|
||||||
|
|
||||||
private int[][][] homeVisitSchedule() {
|
|
||||||
//家庭訪問の開始時間からの経過分数を入れる配列
|
|
||||||
List<Integer> intervalList = new ArrayList<>();
|
|
||||||
startBreakTimeMinutesInt = (((Integer.parseInt(startTimeHomeVisitString.substring(0, 2))) + (startBreakTimeMinutesInt + (Integer.parseInt(startTimeHomeVisitString.substring(0, 2)))) / 60) % 24) * 100 + (startBreakTimeMinutesInt + (Integer.parseInt(startTimeHomeVisitString.substring(2, 4)))) % 60;
|
|
||||||
endBreakTimeMinutesInt = (((Integer.parseInt(startTimeHomeVisitString.substring(0, 2))) + (endBreakTimeMinutesInt + (Integer.parseInt(startTimeHomeVisitString.substring(0, 2)))) / 60) % 24) * 100 + (endBreakTimeMinutesInt + (Integer.parseInt(startTimeHomeVisitString.substring(2, 4)))) % 60;
|
|
||||||
|
|
||||||
//休憩時間を除いた家庭訪問の開始時間からの経過分数+家庭訪問の開始時間=家庭訪問のスケジュール区切りをintervalArrayに入れる処理
|
|
||||||
for (int i = 0; i < arraySizeInt; i++) {
|
|
||||||
int intervalMinutesInt = (((Integer.parseInt(startTimeHomeVisitString.substring(0, 2))) + (intervalInt * i) / 60) % 24) * 100 + (intervalInt * i) % 60;
|
|
||||||
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;//家庭訪問のスケジュールにまだ保護者が割り当てられていないことを表す
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return intervalArrayInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void outPutLogIntervalArray(int[][][] intervalArrayInt) {
|
|
||||||
for (int i = 0; i < intervalArrayInt[0].length; i++) {
|
|
||||||
Log.d("CreateSchedule", "inteintervalArray:(intex:" + i + ") :" + intervalArrayInt[0][i][0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Boolean createSchedule(List<MyDataClass> myDataList, int[][][] intervalArrayInt) {
|
|
||||||
|
|
||||||
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 (homeVisitDaysString[x].equals(myDataList.get(i).getStartDateString()) && myDataList.get(i).getSchedule() == 0) {
|
|
||||||
checkSchedule(myDataList, intervalArrayInt, i, j, x, myDataList.get(i).getStartDateString(),homeVisitDaysString);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
|
||||||
if (myDataList.get(i).getSchedule() == 0) {//重複により割り当てがされていない保護者がいないかの確認
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean secondCreateSchedule(List<MyDataClass> myDataList, int[][][] intervalArrayInt) {
|
|
||||||
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 (homeVisitDaysString[x].equals(myDataList.get(i).getSecondDayStartDateString()) && myDataList.get(i).getSchedule() == 0) {
|
|
||||||
checkSchedule(myDataList, intervalArrayInt, i, j, x, myDataList.get(i).getSecondDayStartDateString(),homeVisitDaysString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
|
||||||
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, String[] homeVisitDaysString) {
|
|
||||||
//保護者の希望時間の開始と終了の間にまだ保護者の割り当てがされていないスケジュールの空き時間があるかの判定
|
|
||||||
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).setScheduleDay(homeVisitDaysString[x]);
|
|
||||||
Log.d("CreateSchedule","getScheduleDay"+myDataList.get(i).getScheduleDay());
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private String geocodeAddress(List<MyDataClass> myDataList, Context context) {
|
|
||||||
try {
|
|
||||||
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
|
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
|
||||||
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).setLatLngString(String.valueOf(new LatLng(latitudeDouble, longitudeDouble)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//SetUpで設定した家庭訪問の開始地点を緯度経度に変換
|
|
||||||
String startPointLatLngString = String.valueOf(geocoder.getFromLocationName(startPointString, 1));
|
|
||||||
String[] startPointLatLngArray = startPointLatLngString.split(",");
|
|
||||||
if (startPointLatLngArray.length >= 3) {
|
|
||||||
//[Address[addressLines=[0:"日本、〒510-8102 三重県三重郡朝日町小向852−1"],feature=852−1,admin=三重県,sub-admin=三重郡,locality=朝日町,thoroughfare=null,postalCode=510-8102,countryCode=JP,countryName=日本,hasLatitude=true,latitude=35.0351632,hasLongitude=true,longitude=136.66538770000003,phone=null,url=null,extras=null]]
|
|
||||||
//というようになっているので配列の後ろから6番目が緯度、4番目が経度
|
|
||||||
//不要なlatitude=とlongitude=を取り除く
|
|
||||||
String latitude = startPointLatLngArray[startPointLatLngArray.length - 6].trim().replace("latitude=", "");
|
|
||||||
String longitude = startPointLatLngArray[startPointLatLngArray.length - 4].trim().replace("longitude=", "");
|
|
||||||
Log.d("CreateSchedule", "Latitude: " + latitude + ", Longitude: " + longitude);
|
|
||||||
// 文字列を結合して形式を整える
|
|
||||||
startPointLatLngString = latitude + "," + longitude;
|
|
||||||
Log.d("CreateSchedule", "startPointLatLngString: " + startPointLatLngString);
|
|
||||||
return startPointLatLngString;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e("CreateSchedule", "緯度経度の取得に失敗: " + e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void outPutLogSchedule(List<MyDataClass> myDataList) {
|
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
|
||||||
Log.d("CreateSchedule:outPutLogSchedule", "(index: " + i + ") data: " + myDataList.get(i));
|
|
||||||
Log.d("CreateSchedule:outPutLogSchedule", "(index: " + i + ") Schedule: " + myDataList.get(i).getSchedule());
|
|
||||||
Log.d("CreateSchedule", "(index: " + i + ") LatLng" + myDataList.get(i).getLatLngString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +1,12 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CreateUUID {
|
public class CreateUUID {
|
||||||
|
|
||||||
public static int generateUUID(List<Integer> classIdList) {
|
public static String generateUUID() {
|
||||||
while (true) {
|
// UUIDを生成する処理
|
||||||
int uuidInt = (int) (Math.random() * 1000000);
|
UUID uuid = UUID.randomUUID();
|
||||||
boolean isDuplicate = false;
|
return uuid.toString();
|
||||||
for (int classIdInt : classIdList) {
|
|
||||||
if (classIdInt == uuidInt) {
|
|
||||||
//重複があればフラグを立て、ループを抜ける
|
|
||||||
isDuplicate = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//重複がなければ生成したUUIDを返す
|
|
||||||
if (!isDuplicate) {
|
|
||||||
//firestoreに挿入処理
|
|
||||||
InsertClassIdforFirebase insertClassIdforFirebase = new InsertClassIdforFirebase();
|
|
||||||
insertClassIdforFirebase.insertClassId(uuidInt);
|
|
||||||
return uuidInt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,35 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
|
|
||||||
import android.app.DatePickerDialog;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.widget.DatePicker;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
public class DatePick extends DialogFragment implements
|
|
||||||
DatePickerDialog.OnDateSetListener {
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstantState) {
|
|
||||||
|
|
||||||
//デフォルトのタイムゾーンおよびロケールを使用してカレンダを取得
|
|
||||||
final Calendar c = Calendar.getInstance();
|
|
||||||
int yearInt = c.get(Calendar.YEAR);
|
|
||||||
int monthInt = c.get(Calendar.MONTH);
|
|
||||||
int dayInt = c.get(Calendar.DAY_OF_MONTH);
|
|
||||||
|
|
||||||
return new DatePickerDialog(requireActivity(), (DatePickerDialog.OnDateSetListener) getActivity(), yearInt, monthInt, dayInt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDateSet(DatePicker datePicker, int yearInt, int monthInt, int dayInt) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -11,25 +11,26 @@ import com.google.firebase.firestore.QueryDocumentSnapshot;
|
||||||
import com.google.firebase.firestore.QuerySnapshot;
|
import com.google.firebase.firestore.QuerySnapshot;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class FirestoreReception {
|
public class FirestoreReception {
|
||||||
|
|
||||||
//firestoreから受け取ったデータを束ねるためのマップ
|
|
||||||
public List<MyDataClass> myDataList = new ArrayList<>();
|
|
||||||
private FirebaseFirestore db;
|
private FirebaseFirestore db;
|
||||||
|
|
||||||
public FirestoreReception() {
|
public FirestoreReception() {
|
||||||
db = FirebaseFirestore.getInstance();
|
db = FirebaseFirestore.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//firestoreから受け取ったデータを束ねるためのマップ
|
||||||
|
public List<MyDataClass>myDataList = new ArrayList<>();
|
||||||
|
|
||||||
//ClassIdを引数にデータの作成を行う
|
//ClassIdを引数にデータの作成を行う
|
||||||
public void getDocumentsByClassId(int classId) {
|
public void getDocumentsByClassId(int classId, MainActivity context) {
|
||||||
myDataList.clear();
|
CollectionReference collectionRef = db.collection("QuestionnaireForms");
|
||||||
CollectionReference collectionRef = db.collection("QuestionForm");
|
|
||||||
|
|
||||||
|
|
||||||
|
// classIdが引数のものを取得する
|
||||||
collectionRef.whereEqualTo("classId", classId).get()
|
collectionRef.whereEqualTo("classId", classId).get()
|
||||||
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
|
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,6 +40,9 @@ public class FirestoreReception {
|
||||||
for (QueryDocumentSnapshot document : task.getResult()) {
|
for (QueryDocumentSnapshot document : task.getResult()) {
|
||||||
Map<String, Object> data = document.getData();
|
Map<String, Object> data = document.getData();
|
||||||
|
|
||||||
|
//CreateRootクラスのインスタンスを生成、dataを渡す
|
||||||
|
// GeoCoder geoCoder = new GeoCoder();
|
||||||
|
// geoCoder.processData(data, context);
|
||||||
|
|
||||||
// ドキュメントのデータをMyDataClassのインスタンスにマッピング
|
// ドキュメントのデータをMyDataClassのインスタンスにマッピング
|
||||||
MyDataClass myData = new MyDataClass(
|
MyDataClass myData = new MyDataClass(
|
||||||
|
@ -57,25 +61,16 @@ public class FirestoreReception {
|
||||||
|
|
||||||
|
|
||||||
//取得したデータをログ表示
|
//取得したデータをログ表示
|
||||||
for (MyDataClass data : myDataList) {
|
for(MyDataClass data :myDataList){
|
||||||
Log.i("FirestoreReceptiond", "data: " + data.toString());
|
Log.i("FirestoreReceptiond", "data: " + data.toString());
|
||||||
}
|
}
|
||||||
|
CreateRoot createRoot=new CreateRoot();
|
||||||
|
createRoot.receiveData(myDataList);
|
||||||
} else {
|
} else {
|
||||||
Log.w("FirestoreReceptiond", "Error getting documents.", task.getException());
|
Log.w("FirestoreReceptiond", "Error getting documents.", task.getException());
|
||||||
}
|
}
|
||||||
Log.i("FirestoreReceptiond", "data: " + myDataList.size());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Dataのリストのサイズを返す
|
|
||||||
public int getMyDataListSize() {
|
|
||||||
return myDataList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Dataのリストを返す
|
|
||||||
public List<MyDataClass> getMyDataList() {
|
|
||||||
return myDataList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.google.android.gms.tasks.OnCompleteListener;
|
|
||||||
import com.google.android.gms.tasks.Task;
|
|
||||||
import com.google.firebase.firestore.FirebaseFirestore;
|
|
||||||
import com.google.firebase.firestore.QueryDocumentSnapshot;
|
|
||||||
import com.google.firebase.firestore.QuerySnapshot;
|
|
||||||
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
public class FirestoreReception_classIdDatabase {
|
|
||||||
private FirebaseFirestore db;
|
|
||||||
private List<Integer> classIdList= new ArrayList<>();
|
|
||||||
|
|
||||||
public FirestoreReception_classIdDatabase() {
|
|
||||||
db = FirebaseFirestore.getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<Integer> getAllDocumentsFromClassIdDatabase() {
|
|
||||||
db.collection("classId_Database")
|
|
||||||
.get()
|
|
||||||
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
|
|
||||||
@Override
|
|
||||||
public void onComplete(@NonNull Task<QuerySnapshot> task) {
|
|
||||||
if (task.isSuccessful()) {
|
|
||||||
for (QueryDocumentSnapshot document : task.getResult()) {
|
|
||||||
Log.d("結果", document.getId() + " => " + document.getData());
|
|
||||||
//データをListに追加
|
|
||||||
classIdList.add(((Long) document.get("classId")).intValue());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.d("結果", "Error getting documents: ", task.getException());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return classIdList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Integer> getClassIdList() {
|
|
||||||
return classIdList;
|
|
||||||
}
|
|
||||||
}
|
|
59
app/src/main/java/com/example/oplogy/GeoCoder.java
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
package com.example.oplogy;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.location.Address;
|
||||||
|
import android.location.Geocoder;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
|
import com.google.firebase.Timestamp;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class GeoCoder {
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public void processData(Map<String, Object> data, Context context) {
|
||||||
|
try {
|
||||||
|
this.context = context;
|
||||||
|
|
||||||
|
//家庭訪問先の住所
|
||||||
|
List<String> address = (List<String>) data.get("address");
|
||||||
|
//家庭訪問の第一希望日(配列0が希望時間帯のはじめ、配列1がおわり)
|
||||||
|
List<Timestamp> firstDay = (List<Timestamp>) data.get("firstDay");
|
||||||
|
//出席番号
|
||||||
|
Long studentNumber = (Long) data.get("studentNumber");
|
||||||
|
// 住所を緯度経度に変換
|
||||||
|
LatLng latLng = geocodeAddress(address.get(0));
|
||||||
|
|
||||||
|
//デバッグ用ログ
|
||||||
|
Log.d("FirestoreReception", "address: " + address.get(0));
|
||||||
|
Log.d("FirestoreReception", "firstDay: " + firstDay.get(0));
|
||||||
|
Log.d("FirestoreReception", "firstDay: " + firstDay.get(1));
|
||||||
|
Log.d("FirestoreReception", "studentNumber: " + studentNumber);
|
||||||
|
Log.d("FirestoreReception", "latLng: "+latLng );
|
||||||
|
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
Log.e("NullPointerException", "getの中身がnull" + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private LatLng geocodeAddress(String address) {
|
||||||
|
try {
|
||||||
|
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
|
||||||
|
List<Address> addresses = geocoder.getFromLocationName(address, 1);
|
||||||
|
if (addresses != null && !addresses.isEmpty()) {
|
||||||
|
Address addressResult = addresses.get(0);
|
||||||
|
double latitude = addressResult.getLatitude();
|
||||||
|
double longitude = addressResult.getLongitude();
|
||||||
|
return new LatLng(latitude, longitude);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e("GeocodingException", "Error geocoding address: " + address, e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
|
|
||||||
import com.google.firebase.firestore.FirebaseFirestore;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class InsertClassIdforFirebase {
|
|
||||||
public void insertClassId(int classId) {
|
|
||||||
FirebaseFirestore db = FirebaseFirestore.getInstance();
|
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>();
|
|
||||||
data.put("classId", classId); // classId is inserted as a number
|
|
||||||
|
|
||||||
db.collection("classId_Database").add(data)
|
|
||||||
.addOnSuccessListener(documentReference -> System.out.println("DocumentSnapshot added with ID: " + documentReference.getId()))
|
|
||||||
.addOnFailureListener(e -> System.err.println("Error adding document: " + e));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,7 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -12,382 +11,117 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.room.Room;
|
|
||||||
|
|
||||||
import com.google.firebase.firestore.FirebaseFirestore;
|
import com.google.firebase.firestore.FirebaseFirestore;
|
||||||
import com.google.gson.Gson;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
|
||||||
|
|
||||||
|
|
||||||
// ダイアログの宣言
|
|
||||||
private AlertDialog alertDialog;
|
|
||||||
// ID作成のTextViewとImageView
|
// ID作成のTextViewとImageView
|
||||||
|
private TextView creatUUID;
|
||||||
|
private ImageView imageUuid;
|
||||||
|
|
||||||
|
|
||||||
|
// セットアップのTextViewとImageView
|
||||||
|
private TextView setUp;
|
||||||
|
private ImageView imageSetup;
|
||||||
|
|
||||||
|
// セットアップのTextViewとImageView
|
||||||
private TextView root;
|
private TextView root;
|
||||||
private ImageView imageRoot;
|
private ImageView imageRoot;
|
||||||
// 提出状況のTextViewとImageView
|
// 提出状況のTextViewとImageView
|
||||||
private TextView submission;
|
private TextView submission;
|
||||||
private ImageView imageSubmission;
|
private ImageView imageSubmission;
|
||||||
private TextView SettingView;
|
|
||||||
private ImageView imageSettingView;
|
|
||||||
|
|
||||||
//firestoreの受信関連
|
//firestoreの受信関連
|
||||||
private FirebaseFirestore db;
|
private FirebaseFirestore db;
|
||||||
private FirestoreReception firestoreReception;
|
private FirestoreReception firestoreReception;
|
||||||
|
|
||||||
//取得するためのクラスID
|
|
||||||
private int classId;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
// ID作成用のインテント
|
||||||
|
creatUUID = findViewById(R.id.creatUUID);
|
||||||
|
creatUUID.setOnClickListener(this);
|
||||||
|
imageUuid = findViewById(R.id.imageUuid);
|
||||||
|
|
||||||
|
|
||||||
|
// セットアップ用のインテント
|
||||||
|
setUp = findViewById(R.id.setUp);
|
||||||
|
setUp.setOnClickListener(this);
|
||||||
|
imageSetup = findViewById(R.id.imageSetup);
|
||||||
|
|
||||||
// ルート作成用のインテント
|
// ルート作成用のインテント
|
||||||
root = findViewById(R.id.root);
|
root = findViewById(R.id.root);
|
||||||
root.setOnClickListener(this);
|
root.setOnClickListener(this);
|
||||||
imageRoot = findViewById(R.id.imageRoot);
|
imageRoot = findViewById(R.id.imageRoot);
|
||||||
imageRoot.setOnClickListener(this);
|
|
||||||
|
|
||||||
// 提出状況のインテント
|
// 提出状況のインテント
|
||||||
submission = findViewById(R.id.submission);
|
submission = findViewById(R.id.submission);
|
||||||
submission.setOnClickListener(this);
|
submission.setOnClickListener(this);
|
||||||
imageSubmission = findViewById(R.id.imageSubmission);
|
imageSubmission = findViewById(R.id.imageSubmission);
|
||||||
imageSubmission.setOnClickListener(this);
|
|
||||||
|
|
||||||
// 設定用のインテント
|
|
||||||
SettingView = findViewById(R.id.setting);
|
|
||||||
SettingView.setOnClickListener(this);
|
|
||||||
imageSettingView = findViewById(R.id.imageSetting);
|
|
||||||
imageSettingView.setOnClickListener(this);
|
|
||||||
|
|
||||||
// firestoreの受信関連
|
// firestoreの受信関連
|
||||||
db = FirebaseFirestore.getInstance();
|
db = FirebaseFirestore.getInstance();
|
||||||
firestoreReception = new FirestoreReception();
|
firestoreReception = new FirestoreReception();
|
||||||
Log.d("MainActivity", "geocodeAddress");
|
|
||||||
|
firestoreReception.getDocumentsByClassId(100,MainActivity.this);
|
||||||
|
|
||||||
|
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
|
||||||
executor.execute(() -> {
|
|
||||||
try {
|
|
||||||
AppDatabase db = getDatabaseInstance();
|
|
||||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
|
||||||
classId = setUpTableDao.getClassId();
|
|
||||||
firestoreReception.getDocumentsByClassId(classId);
|
|
||||||
} catch (Exception e) {
|
|
||||||
//無視して続行
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// クリック処理
|
// クリック処理
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
// ルート作成のクリック処理
|
// ID作成のクリック処理
|
||||||
if (view == root) {
|
if(view == creatUUID){
|
||||||
imageRoot.setImageResource(R.drawable.pin);
|
imageUuid.setImageResource(R.drawable.ischecked_uuid);
|
||||||
checkSetupAndCreateRoute(this::fetchDataAndCreateRoute);
|
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
|
||||||
|
|
||||||
}
|
}
|
||||||
if (view == imageRoot) {
|
// セットアップのクリック処理
|
||||||
|
if(view == setUp){
|
||||||
|
imageSetup.setImageResource(R.drawable.ischecked_uuid);
|
||||||
|
Intent toSetup = new Intent(MainActivity.this,SetUpActivity.class);
|
||||||
|
startActivity(toSetup);
|
||||||
|
|
||||||
|
}
|
||||||
|
// ルート作成のクリック処理
|
||||||
|
if(view == root){
|
||||||
imageRoot.setImageResource(R.drawable.pin);
|
imageRoot.setImageResource(R.drawable.pin);
|
||||||
checkSetupAndCreateRoute(this::fetchDataAndCreateRoute);
|
Intent toRoot = new Intent(MainActivity.this,Maps.class);
|
||||||
|
startActivity(toRoot);
|
||||||
}
|
}
|
||||||
// 提出状況のクリック処理
|
// 提出状況のクリック処理
|
||||||
if (view == submission) {
|
if(view == submission){
|
||||||
checkSetupAndCreateRoute(() -> {
|
Intent toSubmission = new Intent(MainActivity.this,SubmissionActivity.class);
|
||||||
ArrayList<SubmissionStudent> submissionStudents = getSubmissionStudents();
|
|
||||||
Intent toSubmission = new Intent(MainActivity.this, SubmissionActivity.class);
|
|
||||||
toSubmission.putParcelableArrayListExtra("submissionStudents", submissionStudents);
|
|
||||||
startActivity(toSubmission);
|
startActivity(toSubmission);
|
||||||
});
|
|
||||||
}
|
|
||||||
if (view == imageSubmission) {
|
|
||||||
checkSetupAndCreateRoute(() -> {
|
|
||||||
ArrayList<SubmissionStudent> submissionStudents = getSubmissionStudents();
|
|
||||||
Intent toSubmission = new Intent(MainActivity.this, SubmissionActivity.class);
|
|
||||||
toSubmission.putParcelableArrayListExtra("submissionStudents", submissionStudents);
|
|
||||||
startActivity(toSubmission);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (view == SettingView) {
|
|
||||||
Intent toSettingView = new Intent(MainActivity.this, SettingView.class);
|
|
||||||
startActivity(toSettingView);
|
|
||||||
}
|
|
||||||
if (view == imageSettingView) {
|
|
||||||
Intent toSettingView = new Intent(MainActivity.this, SettingView.class);
|
|
||||||
startActivity(toSettingView);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void showUUIDYesNoDialog() {
|
||||||
|
//ダイアログの表示
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle("クラスID");
|
||||||
|
builder.setMessage("あなたのクラスIDを表示しますか?");
|
||||||
|
|
||||||
|
//YESのときは初回はUUIDを生成、表示
|
||||||
//ルート作成、提出状況の遷移を行う前のチェックを行う処理
|
//二回目以降は保存されたUUIDを表示
|
||||||
private void checkSetupAndCreateRoute(Runnable onSetupComplete) {
|
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||||
if (isClassIdSet()) {
|
|
||||||
isSetupExists(classId).thenAccept(setupExists -> {
|
|
||||||
if (setupExists) {
|
|
||||||
runOnUiThread(onSetupComplete);
|
|
||||||
} else {
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Toast.makeText(this, "先に設定画面で情報を入力してください", Toast.LENGTH_SHORT).show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).exceptionally(ex -> {
|
|
||||||
ex.printStackTrace();
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
Toast.makeText(this, "エラーが発生しました", Toast.LENGTH_LONG).show();
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Toast.makeText(this, "先に設定画面で情報を入力してください", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// クラスIDが設定されているかどうかを判定
|
|
||||||
private boolean isClassIdSet() {
|
|
||||||
// classIdが0より大きい場合、trueを返す
|
|
||||||
return classId > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// セットアップが存在するかどうかを判定
|
|
||||||
private CompletableFuture<Boolean> isSetupExists(int classId) {
|
|
||||||
final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
|
||||||
AppDatabase db = getDatabaseInstance();
|
|
||||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
|
||||||
//データベースの値を全取得
|
|
||||||
List<SetUpTable> checkData = setUpTableDao.getAll();
|
|
||||||
for (SetUpTable setUpTable : checkData) {
|
|
||||||
//SetUpTableのclassIdと引数のclassIdが一致する場合、trueを返す
|
|
||||||
if (setUpTable.classId == classId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
//処理完了時にexecutorServiceをシャットダウン
|
|
||||||
}, executorService).whenComplete((result, throwable) -> executorService.shutdown());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//ルート作成の非同期処理
|
|
||||||
private void fetchDataAndCreateRoute() {
|
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
|
||||||
|
|
||||||
executor.execute(() -> {
|
|
||||||
AppDatabase db = getDatabaseInstance();
|
|
||||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
|
||||||
int totalStudentInt = setUpTableDao.getTotalStudent();
|
|
||||||
int myDataListSizeInt = firestoreReception.getMyDataListSize();
|
|
||||||
|
|
||||||
//総生徒数と提出済みになっている生徒の数が一致するかの確認
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
if (totalStudentInt != myDataListSizeInt) {
|
|
||||||
//未提出者がいることの警告ダイアログ
|
|
||||||
showRouteCreationDialog();
|
|
||||||
} else {
|
|
||||||
//ルート作成
|
|
||||||
createRoute(executor);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// `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) {
|
|
||||||
// ProgressDialogを作成
|
|
||||||
ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
|
|
||||||
progressDialog.setMessage("Loading...");
|
|
||||||
progressDialog.setCancelable(false);
|
|
||||||
progressDialog.show();
|
|
||||||
|
|
||||||
executor.execute(() -> {
|
|
||||||
List<MyDataClass> myDataList = null;
|
|
||||||
while (myDataList == null) {
|
|
||||||
myDataList = firestoreReception.getMyDataList();
|
|
||||||
try {
|
|
||||||
Thread.sleep(3000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
runOnUiThread(progressDialog::dismiss); // 進行状況ダイアログを閉じる
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//final宣言することによって、スレッドセーフになる(ラムダ式内で使えるようにする)
|
|
||||||
final List<MyDataClass> finalMyDataList = myDataList;
|
|
||||||
CreateSchedule createSchedule = new CreateSchedule(MainActivity.this);
|
|
||||||
String startPointLatLngString = createSchedule.receiveData(myDataList, getApplicationContext());
|
|
||||||
Boolean notDuplicatesBoolean = null;
|
|
||||||
for (int i = 0; i < myDataList.size(); i++) {
|
|
||||||
if (myDataList.get(i).getSchedule() == 0) {
|
|
||||||
notDuplicatesBoolean = false;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
notDuplicatesBoolean = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Boolean finalNotDuplicatesBoolean = notDuplicatesBoolean;
|
|
||||||
Log.d("MainActivity", "重複判定" + String.valueOf(finalNotDuplicatesBoolean));
|
|
||||||
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
progressDialog.dismiss(); // 進行状況ダイアログを閉じる
|
|
||||||
if (finalNotDuplicatesBoolean) {
|
|
||||||
Log.d("MainActivity", "スケジュール作成成功");
|
|
||||||
saveMyDataList(finalMyDataList);
|
|
||||||
Intent toRoot = new Intent(MainActivity.this, Maps.class);
|
|
||||||
toRoot.putExtra("startPointLatLngString", startPointLatLngString);
|
|
||||||
startActivity(toRoot);
|
|
||||||
} else {
|
|
||||||
// 保護者の重複による警告ダイアログ
|
|
||||||
showErrorDialog(finalMyDataList);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// createRouteの最後にexecutorをシャットダウン
|
|
||||||
executor.shutdown();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 作成したルートを(Mapに渡せるように)保存するメソッド
|
|
||||||
private void saveMyDataList(List<MyDataClass> myDataList) {
|
|
||||||
// 共有プリファレンスのインスタンスを取得
|
|
||||||
SharedPreferences sharedPreferences = getSharedPreferences("MyDataList", MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
|
||||||
|
|
||||||
// MyDataListをJSON形式に変換
|
|
||||||
Gson gson = new Gson();
|
|
||||||
String jsonString = gson.toJson(myDataList);
|
|
||||||
|
|
||||||
// JSON形式のデータを共有プリファレンスに保存
|
|
||||||
editor.putString("myDataList", jsonString);
|
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保護者の重複による警告ダイアログ
|
|
||||||
private void showErrorDialog(List<MyDataClass> myDataList) {
|
|
||||||
List<Integer> studentNumbers = new ArrayList<>();
|
|
||||||
for (MyDataClass data : myDataList) {
|
|
||||||
if (data.getSchedule() == 0) {
|
|
||||||
studentNumbers.add(data.getStudentNumber());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder message = new StringBuilder("保護者の重複が重大でルート作成ができません。保護者に連絡して調整してください。\n\n");
|
|
||||||
for (int i = 0; i < studentNumbers.size(); i++) {
|
|
||||||
message.append("出席番号:" + studentNumbers.get(i));
|
|
||||||
message.append("\n保護者名:" + myDataList.get(i).getPatronName());
|
|
||||||
message.append("\n第一希望 " + myDataList.get(i).getStartDateString().substring(4, 6) + "月");
|
|
||||||
message.append(myDataList.get(i).getStartDateString().substring(6, 8) + "日");
|
|
||||||
message.append(" " + myDataList.get(i).getParentStartTimeString().substring(0, 2));
|
|
||||||
message.append(":" + myDataList.get(i).getParentStartTimeString().substring(2, 4));
|
|
||||||
message.append("~" + myDataList.get(i).getParentEndTimeString().substring(0, 2));
|
|
||||||
message.append(":" + myDataList.get(i).getParentEndTimeString().substring(2, 4));
|
|
||||||
message.append("\n第二希望 " + myDataList.get(i).getSecondDayStartDateString().substring(4, 6) + "月");
|
|
||||||
message.append(myDataList.get(i).getSecondDayStartDateString().substring(6, 8) + "日");
|
|
||||||
message.append(" " + myDataList.get(i).getSecondDayParentStartTimeString().substring(0, 2));
|
|
||||||
message.append(":" + myDataList.get(i).getSecondDayParentStartTimeString().substring(2, 4));
|
|
||||||
message.append("~" + myDataList.get(i).getSecondDayParentEndTimeString().substring(0, 2));
|
|
||||||
message.append(":" + myDataList.get(i).getSecondDayParentEndTimeString().substring(2, 4) + "\n\n");
|
|
||||||
}
|
|
||||||
new AlertDialog.Builder(MainActivity.this)
|
|
||||||
.setTitle("警告")
|
|
||||||
.setMessage(message.toString())
|
|
||||||
.setPositiveButton("OK", (dialog, which) -> {
|
|
||||||
dialog.dismiss();
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// データベースのインスタンスを取得するメソッド
|
|
||||||
private AppDatabase getDatabaseInstance() {
|
|
||||||
return Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//提出状況の取得
|
|
||||||
public ArrayList<SubmissionStudent> getSubmissionStudents() {
|
|
||||||
ArrayList<SubmissionStudent> submissionStudents = new ArrayList<>();
|
|
||||||
List<MyDataClass> myDataList = firestoreReception.getMyDataList();
|
|
||||||
|
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
|
||||||
|
|
||||||
executor.execute(() -> {
|
|
||||||
try {
|
|
||||||
// 1. Roomデータベースから全生徒数を取得
|
|
||||||
AppDatabase db = getDatabaseInstance();
|
|
||||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
|
||||||
int totalStudentInt = setUpTableDao.getTotalStudent();
|
|
||||||
|
|
||||||
// 2. Firestoreから生徒番号のリストを取得
|
|
||||||
ArrayList<Integer> firestoreStudentNumbersList = new ArrayList<>();
|
|
||||||
for (MyDataClass myData : myDataList) {
|
|
||||||
int studentNumberInt = myData.getStudentNumber();
|
|
||||||
firestoreStudentNumbersList.add(studentNumberInt);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. SubmissionStudentオブジェクトのリストを作成
|
|
||||||
for (int i = 1; i <= totalStudentInt; i++) {
|
|
||||||
boolean submitted = firestoreStudentNumbersList.contains(i);
|
|
||||||
submissionStudents.add(new SubmissionStudent(i, submitted));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace(); // ログにエラーメッセージを出力
|
|
||||||
} finally {
|
|
||||||
// 4. データベース操作が完了したことを通知
|
|
||||||
latch.countDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
latch.await(); // 非同期処理が完了するまで待機
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
executor.shutdown(); // ExecutorServiceをシャットダウン
|
|
||||||
}
|
|
||||||
|
|
||||||
return submissionStudents;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
super.onDestroy();
|
String classId = CreateUUID.generateUUID();//classIDにuuidが入ってる
|
||||||
if (alertDialog != null && alertDialog.isShowing()) {
|
Toast.makeText(MainActivity.this, "クラスID: " + classId, Toast.LENGTH_SHORT).show();//テスト用
|
||||||
alertDialog.dismiss();
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Log.d("DialogNO","DialogでNoが選ばれました");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,504 +1,50 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ShapeDrawable;
|
|
||||||
import android.graphics.drawable.shapes.OvalShape;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.example.oplogy.databinding.MapsBinding;
|
|
||||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||||
import com.google.android.gms.maps.GoogleMap;
|
import com.google.android.gms.maps.GoogleMap;
|
||||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
import com.google.android.gms.maps.OnMapReadyCallback;
|
||||||
import com.google.android.gms.maps.SupportMapFragment;
|
import com.google.android.gms.maps.SupportMapFragment;
|
||||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
||||||
import com.google.android.gms.maps.model.LatLng;
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
import com.google.android.gms.maps.model.Marker;
|
|
||||||
import com.google.android.gms.maps.model.MarkerOptions;
|
import com.google.android.gms.maps.model.MarkerOptions;
|
||||||
import com.google.android.gms.maps.model.PolylineOptions;
|
import com.example.oplogy.databinding.MapsBinding;
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonPrimitive;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
public class Maps extends FragmentActivity implements OnMapReadyCallback {
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class Maps extends FragmentActivity implements OnMapReadyCallback, View.OnClickListener, GoogleMap.OnMarkerClickListener {
|
|
||||||
|
|
||||||
//GoogleMapAPiで使用可能な色
|
|
||||||
private static final int[] COLORS = new int[]{Color.parseColor("#007FFF"), // HUE_AZURE
|
|
||||||
Color.parseColor("#0000FF"), // HUE_BLUE
|
|
||||||
Color.parseColor("#00FFFF"), // HUE_CYAN
|
|
||||||
Color.parseColor("#00FF00"), // HUE_GREEN
|
|
||||||
Color.parseColor("#FF00FF"), // HUE_MAGENTA
|
|
||||||
Color.parseColor("#FFA500"), // HUE_ORANGE
|
|
||||||
Color.parseColor("#FF0000"), // HUE_RED
|
|
||||||
Color.parseColor("#FF007F"), // HUE_ROSE
|
|
||||||
Color.parseColor("#8A2BE2"), // HUE_VIOLET
|
|
||||||
Color.parseColor("#FFFF00") // HUE_YELLOW
|
|
||||||
};
|
|
||||||
private final List<LatLng> latLngList = new ArrayList<>();
|
|
||||||
private final List<String> nameList = new ArrayList<>();
|
|
||||||
private final List<Integer> colorList = new ArrayList<>();
|
|
||||||
private final Map<String, Runnable> dateMap = new HashMap<>();
|
|
||||||
ImageView backMain;
|
|
||||||
private GoogleMap mMap;
|
private GoogleMap mMap;
|
||||||
private LinearLayout locationsName;
|
private MapsBinding binding;
|
||||||
private int colorIndex = 0;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
// バインディングの設定
|
|
||||||
com.example.oplogy.databinding.MapsBinding binding = MapsBinding.inflate(getLayoutInflater());
|
binding = MapsBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
// マップフラグメントの設定
|
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
|
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||||
|
.findFragmentById(R.id.map);
|
||||||
mapFragment.getMapAsync(this);
|
mapFragment.getMapAsync(this);
|
||||||
|
|
||||||
// 各UI要素の設定
|
|
||||||
backMain = findViewById(R.id.BackMain);
|
|
||||||
backMain.setOnClickListener(this);
|
|
||||||
|
|
||||||
locationsName = findViewById(R.id.locationsName);
|
|
||||||
|
|
||||||
// スピナーの設定
|
|
||||||
String dateDataString = formatDate(getSharedPreferencesData(0)) + "/" + formatDate(getSharedPreferencesData(1)) + "/" + formatDate(getSharedPreferencesData(2));
|
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item);
|
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
||||||
String[] dates = dateDataString.split("/");
|
|
||||||
for (String date : dates) {
|
|
||||||
adapter.add(date);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 各日付に対応するRunnableを設定する
|
/**
|
||||||
for (int i = 0; i < 3; i++) {
|
* Manipulates the map once available.
|
||||||
int finalI = i;
|
* This callback is triggered when the map is ready to be used.
|
||||||
String dayString = getSharedPreferencesData(i);
|
* This is where we can add markers or lines, add listeners or move the camera. In this case,
|
||||||
String formattedDayString = formatDate(dayString);
|
* we just add a marker near Sydney, Australia.
|
||||||
dateMap.put(formattedDayString, () -> loadMapAndNames(createlocationData(finalI), getscrollViewlData(finalI)));
|
* If Google Play services is not installed on the device, the user will be prompted to install
|
||||||
}
|
* it inside the SupportMapFragment. This method will only be triggered once the user has
|
||||||
|
* installed Google Play services and returned to the app.
|
||||||
Spinner dateSpinner = findViewById(R.id.date);
|
*/
|
||||||
dateSpinner.setAdapter(adapter);
|
|
||||||
|
|
||||||
// スピナーのアイテム選択リスナーを設定
|
|
||||||
dateSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
String selectedItemString = (String) parent.getItemAtPosition(position);
|
|
||||||
Runnable mapLoader = dateMap.get(selectedItemString);
|
|
||||||
if (mapLoader != null) {
|
|
||||||
mapLoader.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//ルート表示を押して最初に表示されるルート(3日間の家庭訪問における1日目)の設定
|
|
||||||
@Override
|
@Override
|
||||||
public void onMapReady(GoogleMap googleMap) {
|
public void onMapReady(GoogleMap googleMap) {
|
||||||
//Google mapの定義
|
|
||||||
mMap = googleMap;
|
mMap = googleMap;
|
||||||
mMap.setOnMarkerClickListener(this);
|
|
||||||
//家庭訪問1日目のスケジュール順に緯度経度の情報をString型の変数に格納
|
|
||||||
//35.1711355,136.88552149999998/35.1696089,136.884084/35.1732838,136.88832890000003/...
|
|
||||||
String locationDataString = createlocationData(0);
|
|
||||||
//家庭訪問1日目のスケジュール順に住所や出席番号、家庭訪問の開始時間の情報をString型の変数に格納
|
|
||||||
//開始地点/出席番号2番:鈴木次郎<〒453-0015 愛知県名古屋市中村区椿町6−9 地下1階~5階> 06月04日12時00分/...
|
|
||||||
String scrollViewlDataString = getscrollViewlData(0);
|
|
||||||
loadMapAndNames(locationDataString, scrollViewlDataString);
|
|
||||||
}
|
|
||||||
|
|
||||||
//家庭訪問の〇日目が何月何日かを返すメソッド
|
// Add a marker in Sydney and move the camera
|
||||||
private String getSharedPreferencesData(int i) {
|
LatLng sydney = new LatLng(-34, 151);
|
||||||
SharedPreferences sharedPreferences = getSharedPreferences("visitingDate", MODE_PRIVATE);
|
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
|
||||||
// SetUpで設定した8桁の数字表記の家庭訪問日を日付表記に変更
|
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
|
||||||
String dayString;
|
|
||||||
if (i == 0) {
|
|
||||||
dayString = sharedPreferences.getString("day1", null);
|
|
||||||
} else if (i == 1) {
|
|
||||||
dayString = sharedPreferences.getString("day2", null);
|
|
||||||
} else {
|
|
||||||
dayString = sharedPreferences.getString("day3", null);
|
|
||||||
}
|
|
||||||
return dayString;
|
|
||||||
}
|
|
||||||
|
|
||||||
//家庭訪問の日付を8桁の整数表記から○月〇日(20240707→07月07日)表記に変更する
|
|
||||||
private String formatDate(String date) {
|
|
||||||
if (date == null || date.length() != 8) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
String monthString = date.substring(4, 6);
|
|
||||||
String dayString = date.substring(6, 8);
|
|
||||||
return monthString + "月" + dayString + "日";
|
|
||||||
}
|
|
||||||
|
|
||||||
//家庭訪問1日目のスケジュール順に緯度経度の情報をString型の変数に格納
|
|
||||||
private String createlocationData(int i) {
|
|
||||||
//家庭訪問の開始地点の緯度経度
|
|
||||||
String startPointLatLngString = getIntent().getStringExtra("startPointLatLngString");
|
|
||||||
List<MyDataClass> myDataList = getMyDataList();
|
|
||||||
//家庭訪問の緯度経度情報をまとめる変数
|
|
||||||
StringBuilder latlngString = new StringBuilder();
|
|
||||||
for (int y = -1; y < myDataList.size(); y++) {
|
|
||||||
if (y < 0) {
|
|
||||||
//家庭訪問の開始地点を追加
|
|
||||||
latlngString.append(startPointLatLngString);
|
|
||||||
} else if (myDataList.get(y).getScheduleDay().equals(getSharedPreferencesData(i))) {
|
|
||||||
if (latlngString.length() > 0) {
|
|
||||||
//区切りのスラッシュ
|
|
||||||
latlngString.append("/");
|
|
||||||
}
|
|
||||||
//mydataListから取り出した家庭訪問の各家庭の住所の緯度経度を追加
|
|
||||||
//この時点ではlongitude latitudeのような不要な文字があるのでformatLatLngメソッドで緯度経度だけのデータにする
|
|
||||||
latlngString.append(formatLatLng(myDataList.get(y)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//各家庭の緯度経度をまとめたものを返す
|
|
||||||
return latlngString.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
//緯度と経度は(35.1711355,136.88552149999998)のように()の中に入っているのでそこだけを取り出す
|
|
||||||
private String formatLatLng(MyDataClass myData) {
|
|
||||||
String latlngString = myData.getLatLngString();
|
|
||||||
int startIndex = latlngString.indexOf("(") + 1;
|
|
||||||
int endIndex = latlngString.indexOf(")");
|
|
||||||
return latlngString.substring(startIndex, endIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
//ScrollViewにて表示するdataの作成メソッド
|
|
||||||
private String getscrollViewlData(int i) {
|
|
||||||
List<MyDataClass> myDataList = getMyDataList();
|
|
||||||
String homeVisitDataString = "";
|
|
||||||
for (int y = -1; y < myDataList.size(); y++) {
|
|
||||||
if (y < 0) {
|
|
||||||
//家庭訪問の開始地点
|
|
||||||
homeVisitDataString += "開始地点/";
|
|
||||||
} else if (myDataList.get(y).getScheduleDay().equals(getSharedPreferencesData(i)) && y + 1 < myDataList.size()) {
|
|
||||||
//出席番号:生徒の名前 <住所> 家庭訪問の開始時間+/
|
|
||||||
homeVisitDataString += "出席番号" + String.valueOf(myDataList.get(y).getStudentNumber()) + "番:" + myDataList.get(y).getChildName() + "<" + myDataList.get(y).getAddress().get(0) + "> " + formatSchedule(String.valueOf(myDataList.get(y).getSchedule())) + "/";
|
|
||||||
} else if (myDataList.get(y).getScheduleDay().equals(getSharedPreferencesData(i))) {
|
|
||||||
homeVisitDataString += "出席番号" + String.valueOf(myDataList.get(y).getStudentNumber()) + "番:" + myDataList.get(y).getChildName() + " <" + myDataList.get(y).getAddress().get(0) + "> " + formatSchedule(String.valueOf(myDataList.get(y).getSchedule()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return homeVisitDataString;
|
|
||||||
}
|
|
||||||
|
|
||||||
//家庭訪問のscheduleを7桁の整数から○月〇日●時〇分(6041200→06月12日05時20分)に変換
|
|
||||||
private String formatSchedule(String schedule) {
|
|
||||||
Log.d("Maps", "schedule: " + schedule);
|
|
||||||
if (schedule.length() != 7) {
|
|
||||||
schedule = "0" + schedule;
|
|
||||||
String monthString = schedule.substring(0, 2);
|
|
||||||
String dayString = schedule.substring(2, 4);
|
|
||||||
String hourString = "0" + schedule.substring(4, 5);
|
|
||||||
String minuteString = schedule.substring(5, 7);
|
|
||||||
return monthString + "月" + dayString + "日" + hourString + "時" + minuteString + "分";
|
|
||||||
} else {
|
|
||||||
String monthString = "0" + schedule.substring(0, 1);
|
|
||||||
String dayString = schedule.substring(1, 3);
|
|
||||||
String hourString = schedule.substring(3, 5);
|
|
||||||
String minuteString = schedule.substring(5, 7);
|
|
||||||
return monthString + "月" + dayString + "日" + hourString + "時" + minuteString + "分";
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 共有プリファレンスからMyDataListを取得するメソッド
|
|
||||||
private List<MyDataClass> getMyDataList() {
|
|
||||||
// 共有プリファレンスのインスタンスを取得
|
|
||||||
SharedPreferences sharedPreferences = getSharedPreferences("MyDataList", MODE_PRIVATE);
|
|
||||||
|
|
||||||
// 共有プリファレンスからJSON形式のデータを取得
|
|
||||||
String jsonString = sharedPreferences.getString("myDataList", "");
|
|
||||||
|
|
||||||
// JSON形式のデータをMyDataListに変換
|
|
||||||
Gson gson = new Gson();
|
|
||||||
Type type = new TypeToken<List<MyDataClass>>() {
|
|
||||||
}.getType();
|
|
||||||
List<MyDataClass> myDataList = gson.fromJson(jsonString, type);
|
|
||||||
|
|
||||||
return myDataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//mapやgetscrollViewlに値を渡すハブの役割のメソッド
|
|
||||||
private void loadMapAndNames(String locationData, String nameData) {
|
|
||||||
try {
|
|
||||||
//mapに関するすべてのデータをリセット
|
|
||||||
latLngList.clear();
|
|
||||||
nameList.clear();
|
|
||||||
colorList.clear();
|
|
||||||
locationsName.removeAllViews();
|
|
||||||
mMap.clear();
|
|
||||||
|
|
||||||
// locationDataをスラッシュで分割して緯度経度リストを取得
|
|
||||||
String[] locArrayString = locationData.split("/");
|
|
||||||
// nameDataをスラッシュで分割して名前リストを取得
|
|
||||||
String[] nameArrayString = nameData.split("/");
|
|
||||||
|
|
||||||
for (int i = 0; i < locArrayString.length; i++) {
|
|
||||||
// 緯度経度をカンマで分割してLatLngオブジェクトを作成
|
|
||||||
String[] latLngString = locArrayString[i].split(",");
|
|
||||||
if (latLngString.length == 2) {
|
|
||||||
double latitudeDouble = Double.parseDouble(latLngString[0]);
|
|
||||||
double longitudeDouble = Double.parseDouble(latLngString[1]);
|
|
||||||
LatLng position = new LatLng(latitudeDouble, longitudeDouble);
|
|
||||||
latLngList.add(position);
|
|
||||||
|
|
||||||
// 名前リストから対応する名前を取得
|
|
||||||
String nameString = nameArrayString.length > i ? nameArrayString[i] : "Unknown";
|
|
||||||
nameList.add(nameString);
|
|
||||||
|
|
||||||
// 色リストから次の色を取得
|
|
||||||
int colorInt = getNextColor();
|
|
||||||
colorList.add(colorInt);
|
|
||||||
|
|
||||||
// 地図にピンを追加
|
|
||||||
addPinToMap(nameString, position, colorInt);
|
|
||||||
// スクロールビューに場所を追加
|
|
||||||
addLocationToScrollView(nameString, colorInt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 最初の位置にカメラを移動し、ルートを描画
|
|
||||||
if (!latLngList.isEmpty()) {
|
|
||||||
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLngList.get(0), 17));
|
|
||||||
drawRoute(); // ルートを描画するメソッドを呼び出す
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("Maps", "エラーが発生しました。原因は以下", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ルートを描画するメソッド
|
|
||||||
// Google マップの Directions API を使用してルート情報を取得し、ポリラインで描画
|
|
||||||
private void drawRoute() {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
StringBuilder urlBuilder = new StringBuilder("https://maps.googleapis.com/maps/api/directions/json?");
|
|
||||||
urlBuilder.append("origin=").append(latLngList.get(0).latitude).append(",").append(latLngList.get(0).longitude);
|
|
||||||
urlBuilder.append("&destination=").append(latLngList.get(latLngList.size() - 1).latitude).append(",").append(latLngList.get(latLngList.size() - 1).longitude);
|
|
||||||
if (latLngList.size() > 2) {
|
|
||||||
urlBuilder.append("&waypoints=");
|
|
||||||
for (int i = 1; i < latLngList.size() - 1; i++) {
|
|
||||||
urlBuilder.append("via:").append(latLngList.get(i).latitude).append(",").append(latLngList.get(i).longitude);
|
|
||||||
if (i < latLngList.size() - 2) {
|
|
||||||
urlBuilder.append("|");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
urlBuilder.append("&mode=driving");
|
|
||||||
//APiキーの設定
|
|
||||||
urlBuilder.append("&key=").append("AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw");
|
|
||||||
|
|
||||||
String urlString = urlBuilder.toString();
|
|
||||||
Log.d("Maps", "Directions API URL: " + urlString);
|
|
||||||
|
|
||||||
// Directions APIにリクエストを送信してレスポンスを取得
|
|
||||||
URL url = new URL(urlString);
|
|
||||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
||||||
conn.setRequestMethod("GET");
|
|
||||||
InputStreamReader isr = new InputStreamReader(conn.getInputStream());
|
|
||||||
BufferedReader br = new BufferedReader(isr);
|
|
||||||
StringBuilder jsonResults = new StringBuilder();
|
|
||||||
String lineString;
|
|
||||||
while ((lineString = br.readLine()) != null) {
|
|
||||||
jsonResults.append(lineString);
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
|
|
||||||
Log.d("Maps", "API response: " + jsonResults.toString());
|
|
||||||
// レスポンスからルート情報を取得してポリラインで描画
|
|
||||||
JsonObject jsonObject = new Gson().fromJson(jsonResults.toString(), JsonObject.class);
|
|
||||||
JsonArray routes = jsonObject.getAsJsonArray("routes");
|
|
||||||
if (routes.size() > 0) {
|
|
||||||
JsonObject route = routes.get(0).getAsJsonObject();
|
|
||||||
JsonObject polyline = route.getAsJsonObject("overview_polyline");
|
|
||||||
String encodedString = polyline.get("points").getAsString();
|
|
||||||
List<LatLng> points = decodePoly(encodedString);
|
|
||||||
|
|
||||||
Log.d("Maps", "Polyline points: " + points);
|
|
||||||
|
|
||||||
runOnUiThread(() -> mMap.addPolyline(new PolylineOptions().addAll(points).width(5).color(Color.BLUE)));
|
|
||||||
} else {
|
|
||||||
// ルートが見つからなかった場合のエラーメッセージを表示
|
|
||||||
JsonPrimitive errorMessage = jsonObject.getAsJsonPrimitive("error_message");
|
|
||||||
if (errorMessage != null) {
|
|
||||||
Log.e("Maps", "エラーが発生しました。原因は以下: " + errorMessage.getAsString());
|
|
||||||
} else {
|
|
||||||
Log.e("Maps", "原因不明のエラー");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("Maps", "ルートの描画に失敗しました", e);
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
// エンコードされた文字列から座標情報をデコードするためのメソッド
|
|
||||||
private List<LatLng> decodePoly(String encoded) {
|
|
||||||
List<LatLng> poly = new ArrayList<>(); // 座標情報を格納するリスト
|
|
||||||
int index = 0, len = encoded.length();// 文字列のインデックスと長さ
|
|
||||||
int latInt = 0, lng = 0; // 緯度と経度の初期値
|
|
||||||
|
|
||||||
// 文字列の長さに達するまで繰り返す
|
|
||||||
while (index < len) {
|
|
||||||
int b, shift = 0, result = 0;
|
|
||||||
// バイト値を取得し、ビットシフトとOR演算を行って座標値を復元する
|
|
||||||
do {
|
|
||||||
b = encoded.charAt(index++) - 63;
|
|
||||||
result |= (b & 0x1f) << shift;
|
|
||||||
shift += 5;
|
|
||||||
} while (b >= 0x20);
|
|
||||||
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
|
||||||
latInt += dlat;
|
|
||||||
|
|
||||||
shift = 0;
|
|
||||||
result = 0;
|
|
||||||
// バイト値を取得し、ビットシフトとOR演算を行って座標値を復元する
|
|
||||||
do {
|
|
||||||
b = encoded.charAt(index++) - 63;
|
|
||||||
result |= (b & 0x1f) << shift;
|
|
||||||
shift += 5;
|
|
||||||
} while (b >= 0x20);
|
|
||||||
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
|
|
||||||
lng += dlng;
|
|
||||||
// LatLngオブジェクトを作成してリストに追加する
|
|
||||||
LatLng p = new LatLng((((double) latInt / 1E5)), (((double) lng / 1E5)));
|
|
||||||
poly.add(p);
|
|
||||||
}
|
|
||||||
// 座標情報のリストを返す
|
|
||||||
return poly;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Colorクラスを使用して、与えられた色から色相値を計算するメソッド
|
|
||||||
private float getHueFromColor(int color) {
|
|
||||||
float[] hsv = new float[3];
|
|
||||||
Color.colorToHSV(color, hsv);//整数の色値をHSV(色相、彩度、明度)の形式に変換し、色相値を取得します。
|
|
||||||
return hsv[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
//mapにピンを追加するメソッド
|
|
||||||
private void addPinToMap(String locationName, LatLng position, int color) {
|
|
||||||
// マーカーオプションを作成し、位置、タイトル、色を設定する
|
|
||||||
Marker marker = mMap.addMarker(new MarkerOptions().position(position).title(locationName).icon(BitmapDescriptorFactory.defaultMarker(getHueFromColor(color))));
|
|
||||||
if (marker != null) {
|
|
||||||
marker.setTag(locationName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// スクロールビューに位置情報を追加するメソッド
|
|
||||||
// スクロールビューに位置情報を追加するメソッド
|
|
||||||
// スクロールビューに位置情報を追加するメソッド
|
|
||||||
private void addLocationToScrollView(String locationName, int color) {
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
try {
|
|
||||||
// テキストビューの作成
|
|
||||||
TextView textView = new TextView(this);
|
|
||||||
textView.setText(locationName);
|
|
||||||
textView.setTextSize(20);
|
|
||||||
textView.setPadding(16, 16, 16, 16);
|
|
||||||
textView.setTextColor(Color.BLACK); // 文字色を黒に設定
|
|
||||||
textView.setBackgroundColor(Color.WHITE); // 背景色を白に設定
|
|
||||||
|
|
||||||
// 円を作成
|
|
||||||
ShapeDrawable circle = new ShapeDrawable(new OvalShape());
|
|
||||||
circle.setIntrinsicWidth(30);
|
|
||||||
circle.setIntrinsicHeight(30);
|
|
||||||
circle.getPaint().setColor(color);
|
|
||||||
|
|
||||||
// 左側に円を表示するためにDrawableを設定
|
|
||||||
textView.setCompoundDrawablesWithIntrinsicBounds(circle, null, null, null);
|
|
||||||
textView.setCompoundDrawablePadding(16);
|
|
||||||
|
|
||||||
// テキストビューにクリックリスナーを追加
|
|
||||||
textView.setOnClickListener(v -> {
|
|
||||||
for (int j = 0; j < nameList.size(); j++) {
|
|
||||||
if (nameList.get(j).equals(locationName)) {
|
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLngList.get(j), 17));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ボーダーラインの作成
|
|
||||||
View border = new View(this);
|
|
||||||
border.setLayoutParams(new LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT, // 横幅は親と同じ
|
|
||||||
2 // 高さは2dp
|
|
||||||
));
|
|
||||||
border.setBackgroundColor(Color.GRAY); // ボーダーラインの色を設定
|
|
||||||
|
|
||||||
// レイアウトの作成
|
|
||||||
LinearLayout layout = new LinearLayout(this);
|
|
||||||
layout.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
layout.addView(textView);
|
|
||||||
layout.addView(border);
|
|
||||||
|
|
||||||
// スクロールビューにレイアウトを追加
|
|
||||||
locationsName.addView(layout);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("Maps", "エラーが発生しました。原因は以下", e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private int getNextColor() {
|
|
||||||
int color = COLORS[colorIndex];
|
|
||||||
colorIndex = (colorIndex + 1) % COLORS.length;
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
if (view.getId() == R.id.BackMain) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
//マーカーがクリックされた際の処理を行うメソッド
|
|
||||||
public boolean onMarkerClick(Marker marker) {
|
|
||||||
// マーカーから場所の名前を取得します。
|
|
||||||
String locationName = (String) marker.getTag();
|
|
||||||
// 場所の名前がnullではない場合に処理を実行します。
|
|
||||||
if (locationName != null) {
|
|
||||||
// マーカーのタイトルとして場所の名前を設定します。
|
|
||||||
marker.setTitle(locationName);
|
|
||||||
// マーカーの情報ウィンドウを表示します。
|
|
||||||
marker.showInfoWindow();
|
|
||||||
}
|
|
||||||
// デフォルトの動作も実行するためにfalseを返します。
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,255 +5,94 @@ import com.google.firebase.Timestamp;
|
||||||
import java.util.List;
|
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 timezoneLong;
|
|
||||||
private String startDateString;
|
|
||||||
private String endDateString;
|
|
||||||
private String assignedStartTimeString;
|
|
||||||
private int assignedIndexInt;
|
|
||||||
private boolean linkingBoolean;
|
|
||||||
private String parentStartTimeString;
|
|
||||||
private String parentEndTimeString;
|
|
||||||
private int scheduleInt;
|
|
||||||
private String secondDayStartDateString;
|
|
||||||
private String secondDayEndDateString;
|
|
||||||
private Long secondDayTimezoneLong;
|
|
||||||
private String secondDayParentStartTimeString;
|
|
||||||
private String secondDayParentEndTimeString;
|
|
||||||
private String latLngString;
|
|
||||||
|
|
||||||
private String ScheduleDayString;
|
|
||||||
|
|
||||||
|
|
||||||
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.patronNameString = patronName;
|
this.patronName = patronName;
|
||||||
this.classIdInt = classId;
|
this.classId = classId;
|
||||||
this.addressList = address;
|
this.address = address;
|
||||||
this.firstDayList = firstDay;
|
this.firstDay = firstDay;
|
||||||
this.studentNumberInt = studentNumber;
|
this.studentNumber = studentNumber;
|
||||||
this.childNameString = childName;
|
this.childName = childName;
|
||||||
this.thirdDayList = thirdDay;
|
this.thirdDay = thirdDay;
|
||||||
this.secondDayList = secondDay;
|
this.secondDay = secondDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "MyDataClass{" +
|
return "MyDataClass{" +
|
||||||
"patronName='" + patronNameString + '\'' +
|
"patronName='" + patronName + '\'' +
|
||||||
", classId=" + classIdInt +
|
", classId=" + classId +
|
||||||
", address=" + addressList +
|
", address=" + address +
|
||||||
", firstDay=" + firstDayList +
|
", firstDay=" + firstDay +
|
||||||
", studentNumber=" + studentNumberInt +
|
", studentNumber=" + studentNumber +
|
||||||
", childName='" + childNameString + '\'' +
|
", childName='" + childName + '\'' +
|
||||||
", thirdDay=" + thirdDayList +
|
", thirdDay=" + thirdDay +
|
||||||
", secondDay=" + secondDayList +
|
", secondDay=" + secondDay +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
//getter
|
//getter
|
||||||
public String getPatronName() {
|
public String getPatronName() {
|
||||||
return patronNameString;
|
return patronName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//setter
|
|
||||||
public void setPatronName(String patronNameString) {
|
|
||||||
this.patronNameString = patronNameString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getClassId() {
|
public int getClassId() {
|
||||||
return classIdInt;
|
return classId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClassId(int classId) {
|
|
||||||
this.classIdInt = classId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAddress() {
|
public List<String> getAddress() {
|
||||||
return addressList;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddress(List<String> address) {
|
|
||||||
this.addressList = address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Timestamp> getFirstDay() {
|
public List<Timestamp> getFirstDay() {
|
||||||
return firstDayList;
|
return firstDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFirstDay(List<Timestamp> firstDay) {
|
|
||||||
this.firstDayList = firstDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStudentNumber() {
|
public int getStudentNumber() {
|
||||||
return studentNumberInt;
|
return studentNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStudentNumber(int studentNumber) {
|
|
||||||
this.studentNumberInt = studentNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getChildName() {
|
public String getChildName() {
|
||||||
return childNameString;
|
return childName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildName(String childName) {
|
|
||||||
this.childNameString = childName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Timestamp> getThirdDay() {
|
public List<Timestamp> getThirdDay() {
|
||||||
return thirdDayList;
|
return thirdDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setThirdDay(List<Timestamp> thirdDay) {
|
|
||||||
this.thirdDayList = thirdDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Timestamp> getSecondDay() {
|
public List<Timestamp> getSecondDay() {
|
||||||
return secondDayList;
|
return secondDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSecondDay(List<Timestamp> secondDay) {
|
|
||||||
this.secondDayList = secondDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getLatitude() {
|
public double getLatitude() {
|
||||||
return latitudeDouble;
|
return latitude;
|
||||||
}
|
}
|
||||||
|
//setter
|
||||||
public void setLatitude(double latitudeDouble) {
|
public void setPatronName(String patronName) {
|
||||||
this.latitudeDouble = latitudeDouble;
|
this.patronName = patronName;
|
||||||
}
|
}
|
||||||
|
public void setClassId(int classId) {
|
||||||
public void setEndDateString(String endDateString) {
|
this.classId = classId;
|
||||||
this.endDateString = endDateString;
|
|
||||||
}
|
}
|
||||||
|
public void setAddress(List<String> address) {
|
||||||
public Long getTimezone() {
|
this.address = address;
|
||||||
return timezoneLong;
|
|
||||||
}
|
}
|
||||||
|
public void setFirstDay(List<Timestamp> firstDay) {
|
||||||
public void setTimezone(Long timezoneLong) {
|
this.firstDay = firstDay;
|
||||||
this.timezoneLong = timezoneLong;
|
|
||||||
}
|
}
|
||||||
|
public void setStudentNumber(int studentNumber) {
|
||||||
public String getStartDateString() {
|
this.studentNumber = studentNumber;
|
||||||
return startDateString;
|
|
||||||
}
|
}
|
||||||
|
public void setChildName(String childName) {
|
||||||
public void setStartDateString(String startDateString) {
|
this.childName = childName;
|
||||||
this.startDateString = startDateString;
|
|
||||||
}
|
}
|
||||||
|
public void setThirdDay(List<Timestamp> thirdDay) {
|
||||||
|
this.thirdDay = thirdDay;
|
||||||
public void setAssignedStartTime(String assignedStartTime) {
|
|
||||||
this.assignedStartTimeString = assignedStartTime;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void setSecondDay(List<Timestamp> secondDay) {
|
||||||
public String getAssignedEndTime() {
|
this.secondDay = secondDay;
|
||||||
return assignedStartTimeString;
|
|
||||||
}
|
}
|
||||||
|
public void setLatitude(double latitude) {
|
||||||
public void setAssignedIndex(int assignedIndexInt) {
|
this.latitude = latitude;
|
||||||
this.assignedIndexInt = assignedIndexInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAssignedIndex() {
|
|
||||||
return assignedIndexInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLinking(boolean linking) {
|
|
||||||
this.linkingBoolean = linking;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getLinking() {
|
|
||||||
return linkingBoolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentStartTimeString(String parentStartTimeString) {
|
|
||||||
this.parentStartTimeString = parentStartTimeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentEndTimeString(String parentEndTimeString) {
|
|
||||||
this.parentEndTimeString = parentEndTimeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentStartTimeString() {
|
|
||||||
return parentStartTimeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentEndTimeString() {
|
|
||||||
return parentEndTimeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSchedule(int scheduleInt) {
|
|
||||||
this.scheduleInt = scheduleInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSchedule() {
|
|
||||||
return scheduleInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecondDayStartDateString(String secondDayStartDateString) {
|
|
||||||
this.secondDayStartDateString = secondDayStartDateString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecondDayEndDateString(String secondDayEndDateString) {
|
|
||||||
this.secondDayEndDateString = secondDayEndDateString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecondDayTimezone(Long secondDayTimezone) {
|
|
||||||
this.secondDayTimezoneLong = secondDayTimezone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSecondDayTimezone() {
|
|
||||||
return secondDayTimezoneLong;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setSecondDayParentStartTimeString(String secondDayParentStartTimeString) {
|
|
||||||
this.secondDayParentStartTimeString = secondDayParentStartTimeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecondDayParentEndTimeString(String secondDayParentEndTimeString) {
|
|
||||||
this.secondDayParentEndTimeString = secondDayParentEndTimeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSecondDayParentStartTimeString() {
|
|
||||||
return secondDayParentStartTimeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSecondDayParentEndTimeString() {
|
|
||||||
return secondDayParentEndTimeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSecondDayStartDateString() {
|
|
||||||
return secondDayStartDateString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLatLngString(String latLng) {
|
|
||||||
this.latLngString = latLng;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLatLngString() {
|
|
||||||
return latLngString;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setScheduleDay(String ScheduleDayString) {
|
|
||||||
this.ScheduleDayString = ScheduleDayString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getScheduleDay() {
|
|
||||||
return ScheduleDayString;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
14
app/src/main/java/com/example/oplogy/RootSearchActivity.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package com.example.oplogy;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class RootSearchActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.root_search);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,54 +3,34 @@ package com.example.oplogy;
|
||||||
import static android.content.ContentValues.TAG;
|
import static android.content.ContentValues.TAG;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.DatePickerDialog;
|
|
||||||
import android.app.TimePickerDialog;
|
import android.app.TimePickerDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.DatePicker;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.TimePicker;
|
import android.widget.TimePicker;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.room.Room;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
|
|
||||||
public class SetUpActivity extends FragmentActivity
|
public class SetUpActivity extends FragmentActivity
|
||||||
implements TimePickerDialog.OnTimeSetListener, DatePickerDialog.OnDateSetListener {
|
implements TimePickerDialog.OnTimeSetListener {
|
||||||
|
|
||||||
String teacherNameString;
|
String teacherName;
|
||||||
String startPointString;
|
String startPoint;
|
||||||
String firstDayString;
|
String startTime;
|
||||||
String secondDayString;
|
String endTime;
|
||||||
String thirdDayString;
|
String intervalTime;
|
||||||
String startTimeString;
|
String startBreakTime;
|
||||||
String endTimeString;
|
String endBreakTime;
|
||||||
String intervalTimeString;
|
int totalStudent;
|
||||||
String startBreakTimeString;
|
|
||||||
String endBreakTimeString;
|
|
||||||
int totalStudentString;
|
|
||||||
String stringYearString;
|
|
||||||
String stringMonthString;
|
|
||||||
String stringDayOfMonthString;
|
|
||||||
String stringHourOfDayString;
|
|
||||||
String stringMinuteString;
|
|
||||||
Button setFirstDay;
|
|
||||||
Button setSecondDay;
|
|
||||||
Button setThirdDay;
|
|
||||||
Button setStartTimeButton;
|
|
||||||
Button setEndTimeButton;
|
|
||||||
private TextView setTeacherName;
|
private TextView setTeacherName;
|
||||||
private TextView setStartPoint;
|
private TextView setStartPoint;
|
||||||
private TextView setStartTime;
|
private TextView setStartTime;
|
||||||
|
@ -58,28 +38,28 @@ public class SetUpActivity extends FragmentActivity
|
||||||
private TextView setStartBreakTime;
|
private TextView setStartBreakTime;
|
||||||
private TextView setEndBreakTime;
|
private TextView setEndBreakTime;
|
||||||
private TextView setTotalStudent;
|
private TextView setTotalStudent;
|
||||||
private int isDateSelectedInt;
|
private int isStartTimeSelected;
|
||||||
private int isStartTimeSelectedInt;
|
|
||||||
|
|
||||||
|
String stringHourOfDay;
|
||||||
|
String stringMinute;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button startTimeSetButton;
|
||||||
|
Button endTimeSetButton;
|
||||||
@SuppressLint("MissingInflatedId")
|
@SuppressLint("MissingInflatedId")
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_set_up);
|
setContentView(R.layout.activity_set_up);
|
||||||
|
|
||||||
int classIdInt = getIntent().getIntExtra("classId", 100000);
|
|
||||||
|
|
||||||
setTeacherName = findViewById(R.id.teacherName); //先生の名前
|
setTeacherName = findViewById(R.id.teacherName); //先生の名前
|
||||||
setStartPoint = findViewById(R.id.startPoint); //開始地点
|
setStartPoint = findViewById(R.id.startPoint); //開始地点
|
||||||
|
|
||||||
setFirstDay = findViewById(R.id.setFirstDayButton); //1日目の日付
|
setStartTime = findViewById(R.id.startTime); //開始時刻
|
||||||
setSecondDay = findViewById(R.id.setSecondDayButton); //2日目の日付
|
setStartTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG); //下線を引く
|
||||||
setThirdDay = findViewById(R.id.setThirdDayButton); //3日目の日付
|
setEndTime = findViewById(R.id.endTime); //終了時刻
|
||||||
|
setEndTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||||
setStartTimeButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するボタン
|
|
||||||
setStartTime = findViewById(R.id.startTime); //開始時刻を出力するTextView
|
|
||||||
setEndTimeButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するボタン
|
|
||||||
setEndTime = 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分)
|
||||||
|
@ -92,229 +72,111 @@ public class SetUpActivity extends FragmentActivity
|
||||||
|
|
||||||
setTotalStudent = findViewById(R.id.totalStudent); //クラスの人数
|
setTotalStudent = findViewById(R.id.totalStudent); //クラスの人数
|
||||||
|
|
||||||
ImageView toMain = findViewById(R.id.toMain);
|
startTimeSetButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するためのボタン
|
||||||
|
endTimeSetButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するためのボタン
|
||||||
|
|
||||||
|
TextView backMain = findViewById(R.id.backMain);
|
||||||
Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン
|
Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン
|
||||||
Button reset = findViewById(R.id.resetButton);
|
Button reset = findViewById(R.id.resetButton);
|
||||||
|
|
||||||
toMain.setOnClickListener(view -> {
|
backMain.setOnClickListener(view -> {
|
||||||
Intent intent = new Intent(SetUpActivity.this, SettingView.class); //main画面へ戻る処理
|
Intent intent = new Intent(SetUpActivity.this,MainActivity.class); //main画面へ戻る処理
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
setUp.setOnClickListener(view -> {
|
setUp.setOnClickListener(view -> {
|
||||||
|
|
||||||
teacherNameString = setTeacherName.getText().toString(); //各変数に値を挿入
|
teacherName = setTeacherName.getText().toString(); //各変数に値を挿入
|
||||||
startPointString = setStartPoint.getText().toString();
|
Log.d(TAG, "Teacher Name: " + teacherName);
|
||||||
firstDayString = setFirstDay.getText().toString();
|
startPoint = setStartPoint.getText().toString();
|
||||||
secondDayString = setSecondDay.getText().toString();
|
Log.d(TAG, "Start Point: " + startPoint);
|
||||||
thirdDayString = setThirdDay.getText().toString();
|
Log.d(TAG, "Start Time" + startTime);
|
||||||
startTimeString = setStartTime.getText().toString();
|
Log.d(TAG, "End Time" + endTime);
|
||||||
endTimeString = setEndTime.getText().toString();
|
if (setTenMinute.isChecked()){ //ラジオボタンの状態を取得
|
||||||
startBreakTimeString = setStartBreakTime.getText().toString();
|
intervalTime = "10";
|
||||||
endBreakTimeString = setEndBreakTime.getText().toString();
|
|
||||||
|
|
||||||
try {
|
|
||||||
totalStudentString = Integer.parseInt(setTotalStudent.getText().toString());
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
Toast.makeText(SetUpActivity.this, "記入欄にすべて入力を済ませてから押してください", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log.d(TAG, "Teacher Name: " + teacherNameString);
|
|
||||||
Log.d(TAG, "Start Point: " + startPointString);
|
|
||||||
Log.d(TAG, "First Day:" + firstDayString);
|
|
||||||
Log.d(TAG, "Second Day:" + secondDayString);
|
|
||||||
Log.d(TAG, "Third Day:" + thirdDayString);
|
|
||||||
Log.d(TAG, "Start Time" + startTimeString);
|
|
||||||
Log.d(TAG, "End Time" + endTimeString);
|
|
||||||
if (setTenMinute.isChecked()) { //ラジオボタンの状態を取得
|
|
||||||
intervalTimeString = "10";
|
|
||||||
} else if (setFifteenMinute.isChecked()) {
|
} else if (setFifteenMinute.isChecked()) {
|
||||||
intervalTimeString = "15";
|
intervalTime = "15";
|
||||||
} else if (setThirtyMinute.isChecked()) {
|
} else if (setThirtyMinute.isChecked()) {
|
||||||
intervalTimeString = "30";
|
intervalTime = "30";
|
||||||
} else {
|
} else {
|
||||||
intervalTimeString = "0";
|
intervalTime = "0";
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Interval Time" + intervalTimeString);
|
Log.d(TAG, "Interval Time" + intervalTime);
|
||||||
Log.d(TAG, "Start Break Time" + startBreakTimeString);
|
Log.d(TAG, "Start Break Time" + startBreakTime);
|
||||||
Log.d(TAG, "End Break Time" + endBreakTimeString);
|
Log.d(TAG, "End Break Time" + endBreakTime);
|
||||||
Log.d(TAG, "Total Student" + totalStudentString);
|
totalStudent = Integer.parseInt(setTotalStudent.getText().toString()); //数値型に変更
|
||||||
|
Log.d(TAG, "Total Student" + totalStudent);
|
||||||
Log.d(TAG, "onClick: できてるよ");
|
Log.d(TAG, "onClick: できてるよ");
|
||||||
|
|
||||||
// データベースへの登録処理
|
});
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
startTimeSetButton.setOnClickListener(v -> {
|
||||||
|
isStartTimeSelected = 1; //ボタンの判別
|
||||||
executor.execute(() -> {
|
showTimePickerDialog(); //TimePeckerの表示
|
||||||
//roomのインスタンスを作成
|
|
||||||
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable")
|
|
||||||
.fallbackToDestructiveMigration()
|
|
||||||
.build();
|
|
||||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
|
||||||
// Roomの操作を行う
|
|
||||||
SetUpTable setUpTable = new SetUpTable(
|
|
||||||
teacherNameString,
|
|
||||||
startPointString,
|
|
||||||
startTimeString,
|
|
||||||
endTimeString,
|
|
||||||
intervalTimeString,
|
|
||||||
startBreakTimeString,
|
|
||||||
endBreakTimeString,
|
|
||||||
totalStudentString,
|
|
||||||
classIdInt
|
|
||||||
);
|
|
||||||
|
|
||||||
// 同じ名前のエントリが存在するかどうかを確認
|
|
||||||
SetUpTable existingSetUpTable = setUpTableDao.findByName(teacherNameString);
|
|
||||||
if (existingSetUpTable != null) {
|
|
||||||
// エントリが存在する場合は、そのエントリを更新
|
|
||||||
setUpTable.setId(existingSetUpTable.getId()); // 既存のIDを設定
|
|
||||||
setUpTableDao.update(setUpTable);
|
|
||||||
|
|
||||||
runOnUiThread(() -> Toast.makeText(SetUpActivity.this, "更新しました", Toast.LENGTH_SHORT).show());
|
|
||||||
} else {
|
|
||||||
// エントリが存在しない場合は、新しいエントリを挿入
|
|
||||||
setUpTableDao.insertAll(setUpTable);
|
|
||||||
runOnUiThread(() -> Toast.makeText(SetUpActivity.this, "登録しました", Toast.LENGTH_SHORT).show());
|
|
||||||
}
|
|
||||||
//家庭訪問日を保存する共有プリファレンス
|
|
||||||
SharedPreferences sharedPreferences = getSharedPreferences("visitingDate", MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
|
||||||
|
|
||||||
editor.putString("day1", firstDayString);
|
|
||||||
editor.putString("day2", secondDayString);
|
|
||||||
editor.putString("day3", thirdDayString);
|
|
||||||
|
|
||||||
editor.apply();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
endTimeSetButton.setOnClickListener(v -> {
|
||||||
|
isStartTimeSelected = 2;
|
||||||
setFirstDay.setOnClickListener(v -> {
|
|
||||||
isDateSelectedInt = 1;
|
|
||||||
showDatePickerDialog(); //DatePickerの表示
|
|
||||||
});
|
|
||||||
|
|
||||||
setSecondDay.setOnClickListener(v -> {
|
|
||||||
isDateSelectedInt = 2;
|
|
||||||
showDatePickerDialog();
|
|
||||||
});
|
|
||||||
|
|
||||||
setThirdDay.setOnClickListener(v -> {
|
|
||||||
isDateSelectedInt = 3;
|
|
||||||
showDatePickerDialog();
|
|
||||||
});
|
|
||||||
|
|
||||||
setStartTimeButton.setOnClickListener(v -> {
|
|
||||||
isStartTimeSelectedInt = 1; //ボタンの判別
|
|
||||||
showTimePickerDialog(); //TimePickerの表示
|
|
||||||
});
|
|
||||||
|
|
||||||
setEndTimeButton.setOnClickListener(v -> {
|
|
||||||
isStartTimeSelectedInt = 2;
|
|
||||||
showTimePickerDialog();
|
showTimePickerDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
setStartBreakTime.setOnClickListener(v -> {
|
setStartBreakTime.setOnClickListener(v -> {
|
||||||
isStartTimeSelectedInt = 3;
|
isStartTimeSelected = 3;
|
||||||
showTimePickerDialog();
|
showTimePickerDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
setEndBreakTime.setOnClickListener(v -> {
|
setEndBreakTime.setOnClickListener(v -> {
|
||||||
isStartTimeSelectedInt = 4;
|
isStartTimeSelected = 4;
|
||||||
showTimePickerDialog();
|
showTimePickerDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
//リセットボタンの処理
|
|
||||||
|
|
||||||
reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去
|
reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去
|
||||||
setTeacherName.setText("");
|
setTeacherName.setText("");
|
||||||
setStartPoint.setText("");
|
setStartPoint.setText("");
|
||||||
|
setStartTime.setText("");
|
||||||
|
setEndTime.setText("");
|
||||||
setTenMinute.setChecked(false);
|
setTenMinute.setChecked(false);
|
||||||
setFifteenMinute.setChecked(false);
|
setFifteenMinute.setChecked(false);
|
||||||
setThirtyMinute.setChecked(false);
|
setThirtyMinute.setChecked(false);
|
||||||
setStartBreakTime.setText("");
|
setStartBreakTime.setText("");
|
||||||
setEndBreakTime.setText("");
|
setEndBreakTime.setText("");
|
||||||
setTotalStudent.setText("");
|
setTotalStudent.setText("");
|
||||||
|
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
|
||||||
executor.execute(() -> {
|
|
||||||
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
|
||||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
|
||||||
setUpTableDao.deleteAll();
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) { //Dateを成形する
|
|
||||||
// DatePickerDialogで選択された日付を処理する
|
|
||||||
String str = String.format(Locale.JAPAN, "%02d/%02d", month + 1, dayOfMonth); // TextViewに表示する日付の形式を設定
|
|
||||||
|
|
||||||
if (isDateSelectedInt == 1) {
|
|
||||||
stringYearString = String.valueOf(year); //年
|
|
||||||
stringMonthString = String.format(Locale.JAPAN, "%02d", month + 1); //月
|
|
||||||
stringDayOfMonthString = String.format(Locale.JAPAN, "%02d", dayOfMonth); //日
|
|
||||||
firstDayString = stringYearString + stringMonthString + stringDayOfMonthString;
|
|
||||||
setFirstDay.setText(str);
|
|
||||||
} else if (isDateSelectedInt == 2) {
|
|
||||||
stringYearString = String.valueOf(year);
|
|
||||||
stringMonthString = String.format(Locale.JAPAN, "%02d", month + 1);
|
|
||||||
stringDayOfMonthString = String.format(Locale.JAPAN, "%02d", dayOfMonth);
|
|
||||||
secondDayString = stringYearString + stringMonthString + stringDayOfMonthString;
|
|
||||||
setSecondDay.setText(str);
|
|
||||||
|
|
||||||
|
|
||||||
} else if (isDateSelectedInt == 3) {
|
|
||||||
stringYearString = String.valueOf(year);
|
|
||||||
stringMonthString = String.format(Locale.JAPAN, "%02d", month + 1);
|
|
||||||
stringDayOfMonthString = String.format(Locale.JAPAN, "%02d", dayOfMonth);
|
|
||||||
thirdDayString = stringYearString + stringMonthString + stringDayOfMonthString;
|
|
||||||
setThirdDay.setText(str);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint({"DefaultLocale", "SetTextI18n"})
|
@SuppressLint({"DefaultLocale", "SetTextI18n"})
|
||||||
@Override
|
@Override
|
||||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||||
String str = String.format(Locale.JAPAN, "%02d:%02d", hourOfDay, minute); // Textviewに保存する形式を設定
|
String str = String.format(Locale.US, "%02d:%02d", hourOfDay, minute); // Textviewに保存する形式を設定
|
||||||
|
|
||||||
if (isStartTimeSelectedInt == 1) {
|
if (isStartTimeSelected == 1) { //押した場所を判定して、押したほうにだけ挿入する
|
||||||
stringHourOfDayString = String.format("%02d", hourOfDay);
|
stringHourOfDay = String.format("%02d", hourOfDay); //時を取得
|
||||||
stringMinuteString = String.format("%02d", minute);
|
stringMinute = String.format("%02d", minute); //分を取得
|
||||||
startTimeString = stringHourOfDayString + stringMinuteString;
|
startTime = stringHourOfDay + stringMinute; //時と分を結合し四桁の文字列に
|
||||||
setStartTime.setText(str);
|
setStartTime.setText(" " + str + " "); //画面に出力
|
||||||
|
|
||||||
} else if (isStartTimeSelectedInt == 2) {
|
} else if (isStartTimeSelected == 2) {
|
||||||
stringHourOfDayString = String.format("%02d", hourOfDay);
|
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||||
stringMinuteString = String.format("%02d", minute);
|
stringMinute = String.format("%02d", minute);
|
||||||
endTimeString = stringHourOfDayString + stringMinuteString;
|
endTime = stringHourOfDay + stringMinute;
|
||||||
setEndTime.setText(str);
|
setEndTime.setText(" " + str + " ");
|
||||||
|
|
||||||
} else if (isStartTimeSelectedInt == 3) {
|
} else if (isStartTimeSelected == 3) {
|
||||||
stringHourOfDayString = String.format("%02d", hourOfDay);
|
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||||
stringMinuteString = String.format("%02d", minute);
|
stringMinute = String.format("%02d", minute);
|
||||||
startBreakTimeString = stringHourOfDayString + stringMinuteString;
|
startBreakTime =stringHourOfDay + stringMinute;
|
||||||
setStartBreakTime.setText(" " + str + " ");
|
setStartBreakTime.setText(" " + str + " ");
|
||||||
|
|
||||||
} else if (isStartTimeSelectedInt == 4) {
|
} else if (isStartTimeSelected == 4) {
|
||||||
stringHourOfDayString = String.format("%02d", hourOfDay);
|
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||||
stringMinuteString = String.format("%02d", minute);
|
stringMinute = String.format("%02d", minute);
|
||||||
endBreakTimeString = stringHourOfDayString + stringMinuteString;
|
endBreakTime = stringHourOfDay + stringMinute;
|
||||||
setEndBreakTime.setText(" " + str + " ");
|
setEndBreakTime.setText(" " + str + " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDatePickerDialog() {
|
|
||||||
DialogFragment newFragment = new DatePick();
|
|
||||||
newFragment.show(getSupportFragmentManager(), "datePicker");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showTimePickerDialog() { // Dialogを表示する
|
private void showTimePickerDialog() { // Dialogを表示する
|
||||||
DialogFragment newFragment = new TimePick();
|
DialogFragment newFragment = new TimePick();
|
||||||
newFragment.show(getSupportFragmentManager(), "timePicker");
|
newFragment.show(getSupportFragmentManager(), "timePicker");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,28 +9,23 @@ public class SetUpTable {
|
||||||
public int id;
|
public int id;
|
||||||
public String teacherName;
|
public String teacherName;
|
||||||
public String startPoint;
|
public String startPoint;
|
||||||
|
public String endPoint;
|
||||||
public String startTime;
|
public String startTime;
|
||||||
public String endTime;
|
public String endTime;
|
||||||
public String intervalTime;
|
public String breakStartTime;
|
||||||
public String startBreakTime;
|
public String breakEndTime;
|
||||||
public String endBreakTime;
|
|
||||||
public int totalStudent;
|
public int totalStudent;
|
||||||
|
|
||||||
int classId;
|
|
||||||
|
|
||||||
|
|
||||||
//コンストラクタ
|
//コンストラクタ
|
||||||
public SetUpTable(String teacherName, String startPoint, String startTime, String endTime,
|
public SetUpTable(String teacherName, String startPoint, String endPoint, String startTime, String endTime, String breakStartTime,String breakEndTime, int totalStudent) {
|
||||||
String intervalTime, String startBreakTime, String endBreakTime, int totalStudent,int classId) {
|
|
||||||
this.teacherName = teacherName;
|
this.teacherName = teacherName;
|
||||||
this.startPoint = startPoint;
|
this.startPoint = startPoint;
|
||||||
|
this.endPoint = endPoint;
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
this.endTime = endTime;
|
this.endTime = endTime;
|
||||||
this.intervalTime = intervalTime;
|
this.breakStartTime = breakStartTime;
|
||||||
this.startBreakTime = startBreakTime;
|
this.breakEndTime = breakEndTime;
|
||||||
this.endBreakTime = endBreakTime;
|
|
||||||
this.totalStudent = totalStudent;
|
this.totalStudent = totalStudent;
|
||||||
this.classId = classId;
|
|
||||||
}
|
}
|
||||||
//getter
|
//getter
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
@ -42,12 +37,21 @@ public class SetUpTable {
|
||||||
public String getStartPoint() {
|
public String getStartPoint() {
|
||||||
return startPoint;
|
return startPoint;
|
||||||
}
|
}
|
||||||
|
public String getEndPoint() {
|
||||||
|
return endPoint;
|
||||||
|
}
|
||||||
public String getStartTime() {
|
public String getStartTime() {
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
public String getEndTime() {
|
public String getEndTime() {
|
||||||
return endTime;
|
return endTime;
|
||||||
}
|
}
|
||||||
|
public String getBreakStartTime() {
|
||||||
|
return breakStartTime;
|
||||||
|
}
|
||||||
|
public String getBreakEndTime() {
|
||||||
|
return breakEndTime;
|
||||||
|
}
|
||||||
public int getTotalStudent() {
|
public int getTotalStudent() {
|
||||||
return totalStudent;
|
return totalStudent;
|
||||||
}
|
}
|
||||||
|
@ -61,12 +65,21 @@ public class SetUpTable {
|
||||||
public void setStartPoint(String startPoint) {
|
public void setStartPoint(String startPoint) {
|
||||||
this.startPoint = startPoint;
|
this.startPoint = startPoint;
|
||||||
}
|
}
|
||||||
|
public void setEndPoint(String endPoint) {
|
||||||
|
this.endPoint = endPoint;
|
||||||
|
}
|
||||||
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 setBreakStartTime(String breakStartTime) {
|
||||||
|
this.breakStartTime = breakStartTime;
|
||||||
|
}
|
||||||
|
public void setBreakEndTime(String breakEndTime) {
|
||||||
|
this.breakEndTime = breakEndTime;
|
||||||
|
}
|
||||||
public void setTotalStudent(int totalStudent) {
|
public void setTotalStudent(int totalStudent) {
|
||||||
this.totalStudent = totalStudent;
|
this.totalStudent = totalStudent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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;
|
||||||
import androidx.room.Update;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -10,43 +9,4 @@ import java.util.List;
|
||||||
public interface SetUpTableDao {
|
public interface SetUpTableDao {
|
||||||
@Insert
|
@Insert
|
||||||
void insertAll(SetUpTable... setUpTables);
|
void insertAll(SetUpTable... setUpTables);
|
||||||
//更新処理
|
|
||||||
@Update
|
|
||||||
void update(SetUpTable setUpTable);
|
|
||||||
//名前が一致しているかの確認
|
|
||||||
|
|
||||||
//削除処理
|
|
||||||
@Query("DELETE FROM SetUpTable")
|
|
||||||
void deleteAll();
|
|
||||||
//全件取得
|
|
||||||
@Query("SELECT * FROM SetUpTable")
|
|
||||||
List<SetUpTable> getAll();
|
|
||||||
|
|
||||||
@Query("SELECT * FROM SetUpTable WHERE teacherName = :name LIMIT 1")
|
|
||||||
SetUpTable findByName(String name);
|
|
||||||
|
|
||||||
@Query("SELECT totalStudent FROM SetUpTable")
|
|
||||||
int getTotalStudent();
|
|
||||||
//開始時間と終了時間の取得
|
|
||||||
@Query("SELECT startTime FROM SetUpTable")
|
|
||||||
String getStartTime();
|
|
||||||
@Query("SELECT endTime FROM SetUpTable")
|
|
||||||
String getEndTime();
|
|
||||||
//教師名の取得
|
|
||||||
@Query("SELECT teacherName FROM SetUpTable")
|
|
||||||
String getTeacherName();
|
|
||||||
@Query("SELECT intervalTime FROM SetUpTable")
|
|
||||||
String getIntervalTime();
|
|
||||||
@Query("SELECT StartBreakTime FROM SetUpTable")
|
|
||||||
String getStartBreakTime();
|
|
||||||
@Query("SELECT EndBreakTime FROM SetUpTable")
|
|
||||||
String getEndBreakTime();
|
|
||||||
//クラスIDの取得
|
|
||||||
@Query("SELECT classId FROM SetUpTable")
|
|
||||||
int getClassId();
|
|
||||||
|
|
||||||
@Query("SELECT startPoint FROM setuptable")
|
|
||||||
String getStartPoint();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,190 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
|
|
||||||
import android.content.ClipData;
|
|
||||||
import android.content.ClipboardManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.room.Room;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
public class SettingView extends AppCompatActivity implements View.OnClickListener {
|
|
||||||
// formコピー用のURL
|
|
||||||
private static final String URL_TO_COPY = "https://docs.google.com/forms/d/e/1FAIpQLScKI_ca01nO7die7SqZyThiqa7NB7gcucMJtiV_-sc3eZX6KQ/viewform";
|
|
||||||
|
|
||||||
private View backButton;
|
|
||||||
private View creatUUID;
|
|
||||||
private View imageUuid;
|
|
||||||
private View setUp;
|
|
||||||
private View imageSetup;
|
|
||||||
private View formURL;
|
|
||||||
private View imageFormURL;
|
|
||||||
private AlertDialog alertDialog;
|
|
||||||
private int classId;
|
|
||||||
private FirestoreReception_classIdDatabase firestoreReception_classIdDatabase;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_setting_view);
|
|
||||||
|
|
||||||
// 戻るボタンの処理
|
|
||||||
backButton = findViewById(R.id.BackMain_fromSetting);
|
|
||||||
backButton.setOnClickListener(this);
|
|
||||||
|
|
||||||
// ID作成用のインテント
|
|
||||||
creatUUID = findViewById(R.id.creatUUID);
|
|
||||||
creatUUID.setOnClickListener(this);
|
|
||||||
imageUuid = findViewById(R.id.imageUuid);
|
|
||||||
imageUuid.setOnClickListener(this);
|
|
||||||
|
|
||||||
|
|
||||||
// セットアップ用のインテント
|
|
||||||
setUp = findViewById(R.id.setUp);
|
|
||||||
setUp.setOnClickListener(this);
|
|
||||||
imageSetup = findViewById(R.id.imageSetup);
|
|
||||||
imageSetup.setOnClickListener(this);
|
|
||||||
|
|
||||||
// formコピー用のインテント
|
|
||||||
formURL = findViewById(R.id.formURL);
|
|
||||||
formURL.setOnClickListener(this);
|
|
||||||
imageFormURL = findViewById(R.id.imageFormURL);
|
|
||||||
imageFormURL.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
if (view == backButton) {
|
|
||||||
Intent intent = new Intent(SettingView.this, MainActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
// ID作成のクリック処理
|
|
||||||
if (view == creatUUID) {
|
|
||||||
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
|
|
||||||
}
|
|
||||||
if (view == imageUuid) {
|
|
||||||
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
|
|
||||||
}
|
|
||||||
// セットアップのクリック処理
|
|
||||||
if (view == setUp) {
|
|
||||||
Intent toSetup = new Intent(SettingView.this, SetUpActivity.class);
|
|
||||||
toSetup.putExtra("classId", classId);
|
|
||||||
startActivity(toSetup);
|
|
||||||
}
|
|
||||||
if (view == imageSetup) {
|
|
||||||
Intent toSetup = new Intent(SettingView.this, SetUpActivity.class);
|
|
||||||
startActivity(toSetup);
|
|
||||||
}
|
|
||||||
|
|
||||||
// formコピー用のクリック処理
|
|
||||||
if (view == formURL) {
|
|
||||||
copyUrlToClipboard(URL_TO_COPY);
|
|
||||||
}
|
|
||||||
if (view == imageFormURL) {
|
|
||||||
copyUrlToClipboard(URL_TO_COPY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//ID作成、表示に関する処理
|
|
||||||
private void showUUIDYesNoDialog() {
|
|
||||||
firestoreReception_classIdDatabase = new FirestoreReception_classIdDatabase();
|
|
||||||
List<Integer> classIdList = firestoreReception_classIdDatabase.getAllDocumentsFromClassIdDatabase();
|
|
||||||
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
||||||
builder.setTitle("ID");
|
|
||||||
builder.setMessage("あなたのIDを表示/もしくは新規で作成しますか?");
|
|
||||||
|
|
||||||
//作成処理
|
|
||||||
builder.setPositiveButton("作成", new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
classId = CreateUUID.generateUUID(classIdList);
|
|
||||||
// 生成されたIDを表示するメソッド
|
|
||||||
showClassIdDialog("生成されたID", classId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//表示処理
|
|
||||||
builder.setNegativeButton("表示", new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
//roomを扱うため非同期処理
|
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
|
||||||
executor.execute(() -> {
|
|
||||||
// 現在のクラスIDを取得
|
|
||||||
int currentClassId = getCurrentClassIdFromRoom();
|
|
||||||
if (currentClassId == 0) {
|
|
||||||
currentClassId = classId;
|
|
||||||
}
|
|
||||||
final int showDialogClassId = currentClassId;
|
|
||||||
runOnUiThread(() -> {
|
|
||||||
// 現在のクラスIDを表示するダイアログ
|
|
||||||
showClassIdDialog("現在のID", showDialogClassId);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
executor.shutdown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
alertDialog = builder.create();
|
|
||||||
alertDialog.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Roomから現在のクラスIDを取得するメソッド
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
//クリップボードにURLをコピーする処理
|
|
||||||
private void copyUrlToClipboard(String url) {
|
|
||||||
try {
|
|
||||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
|
||||||
ClipData clip = ClipData.newPlainText("URL", url);
|
|
||||||
if (clipboard != null) {
|
|
||||||
clipboard.setPrimaryClip(clip);
|
|
||||||
Toast.makeText(this, "GoogleFormのURLをコピーしました", Toast.LENGTH_SHORT).show();
|
|
||||||
} else {
|
|
||||||
Toast.makeText(this, "エラー コピーできませんでした", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Toast.makeText(this, "Error copying URL: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// データベースのインスタンスを取得するメソッド
|
|
||||||
private AppDatabase getDatabaseInstance() {
|
|
||||||
return Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,55 +1,14 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import android.os.Bundle;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SubmissionActivity extends AppCompatActivity {
|
public class SubmissionActivity extends AppCompatActivity {
|
||||||
private final List<SubmissionStudent> studentsList = new ArrayList<>();
|
|
||||||
private RecyclerView recyclerView;
|
|
||||||
private SubmissionAdapter submissionAdapter;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.submission);
|
setContentView(R.layout.submission);
|
||||||
|
|
||||||
// 戻るボタンの処理
|
|
||||||
ImageView backButton = findViewById(R.id.BackMain_fromSubmission);
|
|
||||||
backButton.setOnClickListener(v -> finish());
|
|
||||||
|
|
||||||
// RecyclerViewとアダプターの初期化
|
|
||||||
recyclerView = findViewById(R.id.recyclerView);
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
|
||||||
submissionAdapter = new SubmissionAdapter(studentsList);
|
|
||||||
recyclerView.setAdapter(submissionAdapter);
|
|
||||||
|
|
||||||
// 生徒のリストを取得
|
|
||||||
fetchStudents();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fetchStudents() {
|
|
||||||
// インテントから生徒のリストを取得
|
|
||||||
ArrayList<SubmissionStudent> submissionStudentsList = getIntent().getParcelableArrayListExtra("submissionStudents");
|
|
||||||
|
|
||||||
if (submissionStudentsList != null) {
|
|
||||||
Log.d("SubmissionActivity", "Size of submissionStudentsList: " + submissionStudentsList.size());
|
|
||||||
|
|
||||||
studentsList.addAll(submissionStudentsList);
|
|
||||||
} else {
|
|
||||||
Log.e("SubmissionActivity", "submissionStudentsList is null");
|
|
||||||
Toast.makeText(this, "生徒のリストが取得できませんでした", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// データが変更されたことをアダプターに通知
|
|
||||||
submissionAdapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,72 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.StudentViewHolder> {
|
|
||||||
|
|
||||||
private final List<SubmissionStudent> studentsList;
|
|
||||||
|
|
||||||
public SubmissionAdapter(List<SubmissionStudent> students) {
|
|
||||||
this.studentsList = students;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public StudentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
View view = LayoutInflater.from(parent.getContext())
|
|
||||||
.inflate(R.layout.row_submission, parent, false);
|
|
||||||
return new StudentViewHolder(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(StudentViewHolder holder, int position) {
|
|
||||||
SubmissionStudent student = studentsList.get(position);
|
|
||||||
holder.studentNumberTextView.setText(String.valueOf(student.getStudentNumber()));
|
|
||||||
updateStatus(holder, student.isSubmitted());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return studentsList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//真偽値に応じて提出済みか未提出をセットする
|
|
||||||
private void updateStatus(StudentViewHolder holder, boolean isSubmitted) {
|
|
||||||
if (isSubmitted) {
|
|
||||||
holder.statusTextView.setText("提出済み");
|
|
||||||
setColors(holder, Color.BLACK, Color.WHITE);
|
|
||||||
} else {
|
|
||||||
holder.statusTextView.setText("未提出");
|
|
||||||
setColors(holder, Color.RED, Color.WHITE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//真偽値に応じて色をセットする
|
|
||||||
private void setColors(StudentViewHolder holder, int backgroundColor, int textColor) {
|
|
||||||
holder.statusTextView.setBackgroundColor(backgroundColor);
|
|
||||||
holder.statusTextView.setTextColor(textColor);
|
|
||||||
holder.studentNumberTextView.setBackgroundColor(backgroundColor);
|
|
||||||
holder.studentNumberTextView.setTextColor(textColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class StudentViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
public TextView studentNumberTextView;
|
|
||||||
public TextView statusTextView;
|
|
||||||
|
|
||||||
public StudentViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
// レイアウトファイルのTextViewを取得
|
|
||||||
studentNumberTextView = view.findViewById(R.id.studentNumberTextView);
|
|
||||||
statusTextView = view.findViewById(R.id.statusTextView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
|
|
||||||
public class SubmissionStudent implements Parcelable {
|
|
||||||
private int studentNumberInt;
|
|
||||||
private boolean submitted;
|
|
||||||
|
|
||||||
public SubmissionStudent(int studentNumber, boolean submitted) {
|
|
||||||
this.studentNumberInt = studentNumber;
|
|
||||||
this.submitted = submitted;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SubmissionStudent(Parcel in) {
|
|
||||||
studentNumberInt = in.readInt();
|
|
||||||
submitted = in.readByte() != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Creator<SubmissionStudent> CREATOR = new Creator<SubmissionStudent>() {
|
|
||||||
@Override
|
|
||||||
public SubmissionStudent createFromParcel(Parcel in) {
|
|
||||||
return new SubmissionStudent(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SubmissionStudent[] newArray(int size) {
|
|
||||||
return new SubmissionStudent[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public int getStudentNumber() {
|
|
||||||
return studentNumberInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSubmitted() {
|
|
||||||
return submitted;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel parcel, int i) {
|
|
||||||
parcel.writeInt(studentNumberInt);
|
|
||||||
parcel.writeByte((byte) (submitted ? 1 : 0));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,6 +2,7 @@ package com.example.oplogy;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.TimePickerDialog;
|
import android.app.TimePickerDialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.TimePicker;
|
import android.widget.TimePicker;
|
||||||
|
|
||||||
|
@ -17,14 +18,14 @@ public class TimePick extends DialogFragment implements
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) { // TimePeckerの生成
|
public Dialog onCreateDialog(Bundle savedInstanceState) { // TimePeckerの生成
|
||||||
final Calendar c = Calendar.getInstance();
|
final Calendar c = Calendar.getInstance();
|
||||||
int hourInt = c.get(Calendar.HOUR_OF_DAY);
|
int hour = c.get(Calendar.HOUR_OF_DAY);
|
||||||
int minuteInt = c.get(Calendar.MINUTE);
|
int minute = c.get(Calendar.MINUTE);
|
||||||
|
|
||||||
return new TimePickerDialog(getActivity(),
|
return new TimePickerDialog((Context) getActivity(),
|
||||||
(TimePickerDialog.OnTimeSetListener) getActivity(), hourInt, minuteInt, true);
|
(TimePickerDialog.OnTimeSetListener) getActivity(), hour, minute, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTimeSet(TimePicker view, int hourOfDayInt, int minuteInt) {
|
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||||
}
|
}
|
||||||
}
|
}
|
14
app/src/main/java/com/example/oplogy/TutorialActivity.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package com.example.oplogy;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class TutorialActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.tutorial);
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 48 KiB |
60
app/src/main/res/layout/activity_maps.xml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:weightSum="10"
|
||||||
|
tools:context=".MapsActivity">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="10">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/toMain"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="90dp"
|
||||||
|
android:src="@drawable/back_button"
|
||||||
|
android:layout_weight="5"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:id="@+id/date"
|
||||||
|
android:hint="今日の日付"
|
||||||
|
android:textSize="40dp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:id="@+id/map_fragment_container"
|
||||||
|
tools:context=".Map"
|
||||||
|
android:layout_weight="6"
|
||||||
|
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scrollName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="3"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -9,28 +9,20 @@
|
||||||
android:gravity="center">
|
android:gravity="center">
|
||||||
|
|
||||||
|
|
||||||
<!-- <TextView-->
|
<TextView
|
||||||
<!-- android:id="@+id/backMain"-->
|
android:id="@+id/backMain"
|
||||||
<!-- android:layout_width="wrap_content"-->
|
android:layout_width="wrap_content"
|
||||||
<!-- android:layout_height="wrap_content"-->
|
android:layout_height="wrap_content"
|
||||||
<!-- android:layout_gravity="left"-->
|
|
||||||
<!-- android:paddingStart="20dp"-->
|
|
||||||
<!-- android:text="@string/Back"-->
|
|
||||||
<!-- android:textSize="50sp"-->
|
|
||||||
<!-- tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />-->
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/toMain"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:layout_marginLeft="10dp"
|
android:paddingStart="20dp"
|
||||||
android:src="@drawable/back_button"/>
|
android:text="@string/Back"
|
||||||
|
android:textSize="50sp"
|
||||||
|
tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="25dp"
|
||||||
android:text="@string/setUp"
|
android:text="@string/setUp"
|
||||||
android:textSize="30sp"/>
|
android:textSize="30sp"/>
|
||||||
|
|
||||||
|
@ -81,59 +73,6 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="90sp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="日付設定"
|
|
||||||
android:gravity="center"/>
|
|
||||||
|
|
||||||
<!-- <TextView-->
|
|
||||||
<!-- android:id="@+id/startTime"-->
|
|
||||||
<!-- android:layout_width="wrap_content"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:text=" "-->
|
|
||||||
<!-- android:textSize="20sp"-->
|
|
||||||
<!-- android:textAlignment="center"-->
|
|
||||||
<!-- android:autofillHints=""-->
|
|
||||||
<!-- android:inputType=""-->
|
|
||||||
<!-- tools:ignore="HardcodedText,LabelFor"/>-->
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/setFirstDayButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="1日目"
|
|
||||||
android:layout_marginStart="7sp"
|
|
||||||
android:layout_marginEnd="7sp"
|
|
||||||
tools:ignore="DuplicateIds" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/setSecondDayButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="2日目"
|
|
||||||
android:layout_marginStart="7sp"
|
|
||||||
android:layout_marginEnd="7sp"
|
|
||||||
tools:ignore="DuplicateIds" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/setThirdDayButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="3日目"
|
|
||||||
android:layout_marginStart="7sp"
|
|
||||||
android:layout_marginEnd="7sp"
|
|
||||||
tools:ignore="DuplicateIds" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -151,20 +90,20 @@
|
||||||
android:id="@+id/startTime"
|
android:id="@+id/startTime"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="未設定"
|
android:text=" "
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:autofillHints=""
|
android:autofillHints=""
|
||||||
android:inputType=""
|
android:inputType=""
|
||||||
tools:ignore="LabelFor"/>
|
tools:ignore="HardcodedText,LabelFor"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/startTimeSetButton"
|
android:id="@+id/startTimeSetButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/timeSet"
|
|
||||||
android:layout_marginStart="65dp"
|
android:layout_marginStart="65dp"
|
||||||
android:layout_marginEnd="65dp"
|
android:layout_marginEnd="65dp"
|
||||||
|
android:text="@string/timeSet"
|
||||||
tools:ignore="DuplicateIds" />
|
tools:ignore="DuplicateIds" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -186,7 +125,7 @@
|
||||||
android:id="@+id/endTime"
|
android:id="@+id/endTime"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="未設定"
|
android:text=" "
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:autofillHints=""
|
android:autofillHints=""
|
||||||
|
@ -201,7 +140,6 @@
|
||||||
android:layout_marginStart="65dp"
|
android:layout_marginStart="65dp"
|
||||||
android:layout_marginEnd="65dp"
|
android:layout_marginEnd="65dp"
|
||||||
tools:ignore="DuplicateIds" />
|
tools:ignore="DuplicateIds" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:weightSum="13"
|
|
||||||
tools:context=".SettingView">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="2"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:weightSum="10">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/BackMain_fromSetting"
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="74dp"
|
|
||||||
android:layout_weight="3"
|
|
||||||
android:src="@drawable/back_button" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/Setting"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="7"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:text="設定"
|
|
||||||
android:textSize="40dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- ID作成のレイアウト-->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="3"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:weightSum="2">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageUuid"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:src="@drawable/createid" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/creatUUID"
|
|
||||||
android:layout_width="99dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="left"
|
|
||||||
android:text="ID作成"
|
|
||||||
android:textSize="50dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- セットアップのレイアウト-->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="3"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
|
|
||||||
android:weightSum="2">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageSetup"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:src="@drawable/settingsetup" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/setUp"
|
|
||||||
android:layout_width="99dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="left"
|
|
||||||
android:text="家庭訪問情報"
|
|
||||||
android:textSize="36dp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- フォームのURLのレイアウト-->
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="3"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:weightSum="2">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageFormURL"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:padding="16dp"
|
|
||||||
android:src="@drawable/form" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/formURL"
|
|
||||||
android:layout_width="99dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="left"
|
|
||||||
android:text="GoogleformのURL"
|
|
||||||
android:textSize="28dp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -1,148 +1,146 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:weightSum="20"
|
android:weightSum="20"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="2" />
|
android:layout_weight="2"/>
|
||||||
|
|
||||||
|
|
||||||
<!-- タイトルのレイアウト-->
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ID作成のレイアウト-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="400dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_gravity="center"
|
android:layout_weight="3"
|
||||||
android:layout_weight="4"
|
android:weightSum="2"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal">
|
||||||
android:weightSum="3">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageTitle"
|
android:id="@+id/imageUuid"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/checked_image"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:src="@drawable/app_icon" />
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/creatUUID"
|
||||||
android:layout_width="99dp"
|
android:layout_width="99dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_weight="2"
|
android:layout_weight="1"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:text="OPLOGY"
|
android:text="ID作成"
|
||||||
android:textSize="60dp"
|
android:textSize="50dp"
|
||||||
android:textStyle="bold" />
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Space
|
|
||||||
|
<!-- セットアップのレイアウト-->
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:weightSum="2"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageSetup"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="2" />
|
android:src="@drawable/checked_image"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/setUp"
|
||||||
|
android:layout_width="99dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="セットアップ"
|
||||||
|
android:textSize="40dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="left"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<!-- ルート表示のレイアウト-->
|
|
||||||
|
<!-- ルート表示のレイアウト-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="400dp"
|
android:layout_width="400dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="3"
|
android:layout_weight="3"
|
||||||
android:orientation="horizontal"
|
android:weightSum="2"
|
||||||
android:weightSum="2">
|
android:layout_gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageRoot"
|
android:id="@+id/imageRoot"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/pin"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:src="@drawable/pin" />
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/root"
|
android:id="@+id/root"
|
||||||
android:layout_width="99dp"
|
android:layout_width="99dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="left"
|
|
||||||
android:text="ルート表示"
|
android:text="ルート表示"
|
||||||
android:textSize="40dp"
|
android:textSize="40dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="left"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.5" />
|
android:layout_weight="3"/>
|
||||||
|
|
||||||
|
|
||||||
<!-- 提出状況のレイアウト-->
|
<!-- 提出状況のレイアウト-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="350dp"
|
android:layout_width="350dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="3"
|
android:layout_weight="3"
|
||||||
android:orientation="horizontal"
|
android:layout_gravity="center"
|
||||||
android:weightSum="2">
|
android:weightSum="2"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageSubmission"
|
android:id="@+id/imageSubmission"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/submission"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:src="@drawable/submission" />
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/submission"
|
android:id="@+id/submission"
|
||||||
android:layout_width="99dp"
|
android:layout_width="99dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="left"
|
|
||||||
android:text="提出状況"
|
android:text="提出状況"
|
||||||
android:textSize="40dp"
|
android:textSize="40dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0.5" />
|
|
||||||
|
|
||||||
<!-- 諸々の設定のレイアウト-->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="350dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="3"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:weightSum="2">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageSetting"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:src="@drawable/setting" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/setting"
|
|
||||||
android:layout_width="99dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:text="設定"
|
android:layout_gravity="center"/>
|
||||||
android:textSize="40dp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
60
app/src/main/res/layout/map_activity.xml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:weightSum="10"
|
||||||
|
tools:context=".Map_Activity">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="10">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/toMain"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="90dp"
|
||||||
|
android:src="@drawable/back_button"
|
||||||
|
android:layout_weight="5"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:id="@+id/date"
|
||||||
|
android:hint="今日の日付"
|
||||||
|
android:textSize="40dp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:id="@+id/map_fragment_container"
|
||||||
|
tools:context=".Map"
|
||||||
|
android:layout_weight="6"
|
||||||
|
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scrollName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="3"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1,58 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:map="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:weightSum="10"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".Maps">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:weightSum="10">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/BackMain"
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="90dp"
|
|
||||||
android:src="@drawable/back_button"
|
|
||||||
android:layout_weight="3" />
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/date"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="90dp"
|
|
||||||
android:layout_weight="7" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/map"
|
android:id="@+id/map"
|
||||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
tools:context=".Maps"
|
||||||
android:layout_width="match_parent"
|
android:name="com.google.android.gms.maps.SupportMapFragment"/>
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="6"
|
|
||||||
tools:context=".Maps" />
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="3"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
>
|
|
||||||
<ScrollView
|
|
||||||
android:id="@+id/scrollable"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="300dp"
|
|
||||||
>
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/locationsName"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical" />
|
|
||||||
</ScrollView>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
9
app/src/main/res/layout/root_search.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".RootSearchActivity">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,30 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/studentNumberTextView"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:background="@android:color/white"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:text="番号"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="36sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/statusTextView"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="3"
|
|
||||||
android:background="@android:color/white"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:text="提出状況"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="36sp" />
|
|
||||||
</LinearLayout>
|
|
296
app/src/main/res/layout/setup.xml
Normal file
|
@ -0,0 +1,296 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".SetUpActivity"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toMain"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="left"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:text="@string/Back"
|
||||||
|
android:textSize="50sp"
|
||||||
|
tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="25dp"
|
||||||
|
android:text="@string/setUp"
|
||||||
|
android:textSize="30sp"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="90sp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/teacherName"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/teacherName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:inputType=""
|
||||||
|
tools:ignore="LabelFor" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="90sp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/startPoint"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/startPoint"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/startpoint"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:inputType=""
|
||||||
|
tools:ignore="LabelFor" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="90sp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/startTime"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/startTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=" "
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:inputType=""
|
||||||
|
tools:ignore="HardcodedText,LabelFor"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/startTimeSetButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="65dp"
|
||||||
|
android:layout_marginEnd="65dp"
|
||||||
|
android:text="@string/timeSet"
|
||||||
|
tools:ignore="DuplicateIds" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="90sp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/endTime"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/endTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text=" "
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:inputType=""
|
||||||
|
tools:ignore="LabelFor"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/endTimeSetButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/timeSet"
|
||||||
|
android:layout_marginStart="65dp"
|
||||||
|
android:layout_marginEnd="65dp"
|
||||||
|
tools:ignore="DuplicateIds" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="90sp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/intervalTime"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/timeInterval"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="3">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/tenMinute"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/tenMinute"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/fifteenMinute"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/fifteenMinute"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/thirtyMinute"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/thirtyMinute"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="10"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="90sp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/breakTime" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/startBreakTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint=" から "
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:inputType=""
|
||||||
|
tools:ignore="LabelFor"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="~"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:paddingStart="30dp"
|
||||||
|
android:paddingEnd="30dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/endBreakTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:hint=" まで "
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:inputType=""
|
||||||
|
tools:ignore="LabelFor"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="90sp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/totalStudent"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/totalStudent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="例)30人➝30"
|
||||||
|
android:autofillHints=""
|
||||||
|
android:inputType=""
|
||||||
|
tools:ignore="LabelFor"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="2"
|
||||||
|
android:layout_marginTop="20sp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/resetButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/reset"
|
||||||
|
android:layout_marginEnd="100dp"
|
||||||
|
style="?android:attr/buttonBarButtonStyle" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/setUpButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/setUp"
|
||||||
|
style="?android:attr/buttonBarButtonStyle" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1,42 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:weightSum="10"
|
|
||||||
tools:context=".SubmissionActivity">
|
tools:context=".SubmissionActivity">
|
||||||
|
|
||||||
<LinearLayout
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:weightSum="10">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/BackMain_fromSubmission"
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="74dp"
|
|
||||||
android:layout_weight="2"
|
|
||||||
android:src="@drawable/back_button" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/imageSubmission"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="4"
|
|
||||||
android:hint="提出状況"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:textSize="40dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/recyclerView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="9"
|
|
||||||
android:scrollbars="vertical" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
9
app/src/main/res/layout/tutorial.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".TutorialActivity">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 982 B |
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 7.6 KiB |
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="ic_launcher_background">#FFFFFF</color>
|
|
||||||
</resources>
|
|
|
@ -1,9 +1,8 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Oplogy</string>
|
<string name="app_name">oplogy</string>
|
||||||
<string name="maps_api_key">AIzaSyBqLqPm76UFpwbpU8b3oiH0wbkhosrPWpU</string>
|
|
||||||
<string name="title_activity_maps">MapsActivity</string>
|
<string name="title_activity_maps">MapsActivity</string>
|
||||||
<string name="setUp">設定</string>
|
<string name="setUp">設定</string>
|
||||||
<string name="reset">データ削除</string>
|
<string name="reset">リセット</string>
|
||||||
<string name="teacherName">担任の名前</string>
|
<string name="teacherName">担任の名前</string>
|
||||||
<string name="startPoint">開始地点</string>
|
<string name="startPoint">開始地点</string>
|
||||||
<string name="startTime">開始時刻</string>
|
<string name="startTime">開始時刻</string>
|
||||||
|
@ -12,6 +11,7 @@
|
||||||
<string name="breakTime">休憩時間</string>
|
<string name="breakTime">休憩時間</string>
|
||||||
<string name="totalStudent">生徒の人数</string>
|
<string name="totalStudent">生徒の人数</string>
|
||||||
<string name="timeSet">時刻設定</string>
|
<string name="timeSet">時刻設定</string>
|
||||||
|
<string name="Back">🔙</string>
|
||||||
<string name="startpoint">住所</string>
|
<string name="startpoint">住所</string>
|
||||||
<string name="tenMinute">10分</string>
|
<string name="tenMinute">10分</string>
|
||||||
<string name="fifteenMinute">15分</string>
|
<string name="fifteenMinute">15分</string>
|
||||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '8.1.4' apply false
|
id 'com.android.application' version '8.0.2' apply false
|
||||||
id 'com.android.library' version '8.1.4' apply false
|
id 'com.android.library' version '8.0.2' apply false
|
||||||
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
|
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
|
||||||
}
|
}
|
||||||
|
|