Compare commits

..

24 Commits
last ... master

Author SHA1 Message Date
301d097cd6 Merge pull request '本番環境移行' (#60) from 本番環境以降 into master
Reviewed-on: #60
2024-07-24 06:34:15 +00:00
nemukemo
7bfda687cd 粉砕玉砕大喝采 2024-07-24 15:32:54 +09:00
nemukemo
c61e41a8ae setupが落ちる原因を取り除く
FirestoreReceptionを本番用にしてい
uuidもreturn値を固定解除
2024-07-24 15:29:17 +09:00
422e105808 Merge pull request 'アイコンや設定画面を切り離しなど' (#59) from murakumo_Home画面をぶっ壊す into master コンフリ起きない万歳
Reviewed-on: #59
2024-07-19 01:45:37 +00:00
nemukemo
856e125612 webpども:アプリアイコンのため
SettingView:設定画面作成
main:設定情報を切り離した
その他:intentの調整
2024-07-19 10:44:32 +09:00
2c0bb36c68 Merge pull request '背景色消して○で表現できるようにした。すごい' (#58) from murakumo_Mapに○を into master
Reviewed-on: #58
2024-07-17 05:30:25 +00:00
b2f452c6fe Merge pull request '提出状況-1問題の解決' (#57) from murakumo_提出状況-1問題 into master
Reviewed-on: #57
2024-07-17 05:28:44 +00:00
nemukemo
1c1f366bf8 背景色消して○で表現できるようにした 2024-07-17 14:27:08 +09:00
nemukemo
bb4912f123 uuid:値をテストデータに固定中
main:各メソッドが何の処理をしているかのコメント追加
SubmissionActivity:nullチェックと謎のコード削除
SubmissionAdapter:色のセットなどをメソッド化
submission.xml:recyclerviewがマッチョペアレントだったから-1されるフレンズでした。てへぺろ
2024-07-17 12:23:41 +09:00
f28fd3c4ff Merge pull request 'murakumo_URLコピペボタンの作成完了' (#56) from murakumo_URLコピペボタン into master oh year
Reviewed-on: #56
2024-07-16 05:32:54 +00:00
nemukemo
d3c94b5a7b コンクリ解消 2024-07-16 14:31:50 +09:00
nemukemo
98f35c6555 Merge branch 'master' into murakumo_URLコピペボタン
# Conflicts:
#	app/src/main/java/com/example/oplogy/MainActivity.java
2024-07-16 14:30:59 +09:00
nemukemo
6f968f2b9b 再コミット 2024-07-16 14:26:37 +09:00
9c523c1047 Merge pull request 'NowLoading作成完了' (#54) from murakumo_NowLoading into master
Reviewed-on: #54
2024-07-16 05:20:05 +00:00
nemukemo
52a03156a2 NowLoading作成完了 2024-07-16 14:15:35 +09:00
nemukemo
e7a7838c2b コピペボタンの作成
レイアウトを調整する必要あり
2024-07-16 00:31:15 +09:00
65edd2e9f8 Merge pull request 'マップ表示のバグ修正' (#53) from murakumo_classIdが0になる問題 into master
Reviewed-on: #53
2024-07-15 04:17:56 +00:00
nemukemo
4e20d0006f マップ表示のバグ修正 2024-07-14 01:12:56 +09:00
2f2c99cf6f Merge pull request 'classIdの表示する時、0になる問題を解決' (#51) from murakumo_classIdが0になる問題 into master
Reviewed-on: #51
2024-07-12 01:16:34 +00:00
nemukemo
ecbb551c35 classIdの表示する時、0になる問題を解決 2024-07-12 10:15:21 +09:00
8f606dd30d Merge pull request '・重複時のダイアログに保護者の情報が表示されるように調整しました。' (#50) from api into master
Reviewed-on: #50
2024-07-10 07:31:26 +00:00
fe7752e758 Merge branch 'master' into api
# Conflicts:
#	app/src/main/java/com/example/oplogy/MainActivity.java
2024-07-10 16:21:05 +09:00
6a5eca8000 ・重複時のダイアログに保護者の情報が表示されるように調整しました。
・その他細かなバグを修正しました。
2024-07-10 16:13:24 +09:00
362b7b5544 プルリクエスト 'ID作成時に表示をダイアログに変更、セットアップが終了していない場合にtoast表示を行い遷移しないように変更' (#49) from last into master
Reviewed-on: #49
2024-07-10 07:09:15 +00:00
38 changed files with 652 additions and 386 deletions

View File

@ -18,6 +18,9 @@
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" />
@ -40,15 +43,9 @@
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" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 KiB

View File

@ -42,13 +42,14 @@ public class CreateSchedule {
private final AppDatabase db; private final AppDatabase db;
private int arraySizeInt; private int arraySizeInt;
boolean notSecondDuplicatesBoolean = true;//スケジュールの重複の有無(第一希望日のみで通った場合も考えて初期はtrue) private boolean notSecondDuplicatesBoolean;//スケジュールの重複の有無(第一希望日のみで通った場合も考えて初期はtrue)
String[] homeVisitDaysString; String[] homeVisitDaysString;
public CreateSchedule(AppCompatActivity activity) { public CreateSchedule(AppCompatActivity activity) {
this.db = Room.databaseBuilder(activity.getApplicationContext(), AppDatabase.class, "SetUpTable").build(); this.db = Room.databaseBuilder(activity.getApplicationContext(), AppDatabase.class, "SetUpTable").build();
this.notSecondDuplicatesBoolean = true; // 初期値をtrueに設定する
SharedPreferences sharedPreferences = activity.getSharedPreferences("visitingDate", Context.MODE_PRIVATE); SharedPreferences sharedPreferences = activity.getSharedPreferences("visitingDate", Context.MODE_PRIVATE);
String firstDay = sharedPreferences.getString("day1", null); String firstDay = sharedPreferences.getString("day1", null);
@ -57,7 +58,6 @@ public class CreateSchedule {
Log.d("createSchedule","day1"+firstDay+"day2"+secondDay+"thirdday"+thirdDay); Log.d("createSchedule","day1"+firstDay+"day2"+secondDay+"thirdday"+thirdDay);
homeVisitDaysString = new String[]{firstDay, secondDay, thirdDay}; homeVisitDaysString = new String[]{firstDay, secondDay, thirdDay};
} }
//MainActivityからデータを受け取る //MainActivityからデータを受け取る
@ -123,11 +123,12 @@ public class CreateSchedule {
Log.d("CreateSchedule", "startPointLatLngString" + startPointLatLngString); Log.d("CreateSchedule", "startPointLatLngString" + startPointLatLngString);
outPutLogSchedule(myDataList); outPutLogSchedule(myDataList);
return startPointLatLngString; return startPointLatLngString;
} } else {
// 重複があるときは""を返す // 重複があるときは""を返す
Log.d("CreateSchedule", "重複によるエラー"); Log.d("CreateSchedule", "重複によるエラー");
return ""; return "";
} }
}
private void setData(List<MyDataClass> myDataList) { private void setData(List<MyDataClass> myDataList) {
@ -348,6 +349,7 @@ public class CreateSchedule {
} }
} }
for (int i = 0; i < myDataList.size(); i++) { for (int i = 0; i < myDataList.size(); i++) {
if (myDataList.get(i).getSchedule() == 0) {//重複により割り当てがされていない保護者がいないかの確認 if (myDataList.get(i).getSchedule() == 0) {//重複により割り当てがされていない保護者がいないかの確認
return false; return false;

View File

@ -21,8 +21,6 @@ public class CreateUUID {
//firestoreに挿入処理 //firestoreに挿入処理
InsertClassIdforFirebase insertClassIdforFirebase = new InsertClassIdforFirebase(); InsertClassIdforFirebase insertClassIdforFirebase = new InsertClassIdforFirebase();
insertClassIdforFirebase.insertClassId(uuidInt); insertClassIdforFirebase.insertClassId(uuidInt);
//テスト用
uuidInt = 100;
return uuidInt; return uuidInt;
} }
} }

View File

@ -27,9 +27,9 @@ public class FirestoreReception {
//ClassIdを引数にデータの作成を行う //ClassIdを引数にデータの作成を行う
public void getDocumentsByClassId(int classId) { public void getDocumentsByClassId(int classId) {
myDataList.clear(); myDataList.clear();
CollectionReference collectionRef = db.collection("testDistinct"); 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

View File

@ -1,6 +1,6 @@
package com.example.oplogy; package com.example.oplogy;
import android.content.DialogInterface; import android.app.ProgressDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
@ -26,29 +26,21 @@ import java.util.concurrent.Executors;
public class MainActivity extends AppCompatActivity implements View.OnClickListener { public class MainActivity extends AppCompatActivity implements View.OnClickListener {
// ダイアログの宣言 // ダイアログの宣言
private AlertDialog alertDialog; 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;
private FirestoreReception_classIdDatabase firestoreReception_classIdDatabase;
//取得するためのクラスID //取得するためのクラスID
private int classId; private int classId;
@ -58,19 +50,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
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);
imageUuid.setOnClickListener(this);
// セットアップ用のインテント
setUp = findViewById(R.id.setUp);
setUp.setOnClickListener(this);
imageSetup = findViewById(R.id.imageSetup);
imageSetup.setOnClickListener(this);
// ルート作成用のインテント // ルート作成用のインテント
root = findViewById(R.id.root); root = findViewById(R.id.root);
root.setOnClickListener(this); root.setOnClickListener(this);
@ -83,6 +64,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
imageSubmission = findViewById(R.id.imageSubmission); imageSubmission = findViewById(R.id.imageSubmission);
imageSubmission.setOnClickListener(this); 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();
@ -109,30 +96,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// クリック処理 // クリック処理
@Override @Override
public void onClick(View view) { public void onClick(View view) {
// ID作成のクリック処理
if (view == creatUUID) {
imageUuid.setImageResource(R.drawable.ischecked_uuid);
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
}
if (view == imageUuid) {
imageUuid.setImageResource(R.drawable.ischecked_uuid);
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
}
// セットアップのクリック処理
if (view == setUp) {
imageSetup.setImageResource(R.drawable.ischecked_uuid);
Intent toSetup = new Intent(MainActivity.this, SetUpActivity.class);
toSetup.putExtra("classId", classId);
startActivity(toSetup);
finish(); // 画面遷移後元の状態に戻す
}
if (view == imageSetup) {
imageSetup.setImageResource(R.drawable.ischecked_uuid);
Intent toSetup = new Intent(MainActivity.this, SetUpActivity.class);
startActivity(toSetup);
finish(); // 画面遷移後元の状態に戻す
}
// ルート作成のクリック処理 // ルート作成のクリック処理
if (view == root) { if (view == root) {
imageRoot.setImageResource(R.drawable.pin); imageRoot.setImageResource(R.drawable.pin);
@ -159,71 +122,14 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
startActivity(toSubmission); startActivity(toSubmission);
}); });
} }
if (view == SettingView) {
Intent toSettingView = new Intent(MainActivity.this, SettingView.class);
startActivity(toSettingView);
} }
if (view == imageSettingView) {
//ID作成表示に関する処理 Intent toSettingView = new Intent(MainActivity.this, SettingView.class);
private void showUUIDYesNoDialog() { startActivity(toSettingView);
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();
runOnUiThread(() -> {
// 現在のクラスIDを表示するダイアログ
showClassIdDialog("現在のID", currentClassId);
});
});
executor.shutdown();
}
});
alertDialog = builder.create();
alertDialog.show();
}
private int getCurrentClassIdFromRoom() {
AppDatabase db = getDatabaseInstance();
SetUpTableDao setUpTableDao = db.setUpTableDao();
// 現在のクラスIDを取得
return setUpTableDao.getClassId();
}
//クラスIDを表示するダイアログ
private void showClassIdDialog(String title, int classId) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(title);
builder.setMessage("ID: " + classId);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
} }
@ -235,7 +141,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
runOnUiThread(onSetupComplete); runOnUiThread(onSetupComplete);
} else { } else {
runOnUiThread(() -> { runOnUiThread(() -> {
Toast.makeText(this, "先にセットアップを済ませてください", Toast.LENGTH_LONG).show(); Toast.makeText(this, "先に設定画面で情報を入力してください", Toast.LENGTH_SHORT).show();
}); });
} }
}).exceptionally(ex -> { }).exceptionally(ex -> {
@ -246,7 +152,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
return null; return null;
}); });
} else { } else {
Toast.makeText(this, "先にIDの作成を行ってください", Toast.LENGTH_LONG).show(); Toast.makeText(this, "先に設定画面で情報を入力してください", Toast.LENGTH_SHORT).show();
} }
} }
@ -301,6 +207,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// `fetchDataAndCreateRoute`メソッド内ではshutdownを呼び出さない // `fetchDataAndCreateRoute`メソッド内ではshutdownを呼び出さない
} }
// 未提出者がいることの警告ダイアログ
private void showRouteCreationDialog() { private void showRouteCreationDialog() {
new AlertDialog.Builder(MainActivity.this) new AlertDialog.Builder(MainActivity.this)
.setTitle("警告") .setTitle("警告")
@ -317,7 +224,15 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
.show(); .show();
} }
// ルート作成の非同期処理
private void createRoute(ExecutorService executor) { private void createRoute(ExecutorService executor) {
// ProgressDialogを作成
ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
progressDialog.show();
executor.execute(() -> { executor.execute(() -> {
List<MyDataClass> myDataList = null; List<MyDataClass> myDataList = null;
while (myDataList == null) { while (myDataList == null) {
@ -326,6 +241,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
Thread.sleep(3000); Thread.sleep(3000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
runOnUiThread(progressDialog::dismiss); // 進行状況ダイアログを閉じる
return; return;
} }
} }
@ -334,9 +250,21 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
final List<MyDataClass> finalMyDataList = myDataList; final List<MyDataClass> finalMyDataList = myDataList;
CreateSchedule createSchedule = new CreateSchedule(MainActivity.this); CreateSchedule createSchedule = new CreateSchedule(MainActivity.this);
String startPointLatLngString = createSchedule.receiveData(myDataList, getApplicationContext()); 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(() -> { runOnUiThread(() -> {
if (!startPointLatLngString.equals("")) { progressDialog.dismiss(); // 進行状況ダイアログを閉じる
if (finalNotDuplicatesBoolean) {
Log.d("MainActivity", "スケジュール作成成功"); Log.d("MainActivity", "スケジュール作成成功");
saveMyDataList(finalMyDataList); saveMyDataList(finalMyDataList);
Intent toRoot = new Intent(MainActivity.this, Maps.class); Intent toRoot = new Intent(MainActivity.this, Maps.class);
@ -353,6 +281,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
}); });
} }
// 作成したルートを(Mapに渡せるように)保存するメソッド
private void saveMyDataList(List<MyDataClass> myDataList) { private void saveMyDataList(List<MyDataClass> myDataList) {
// 共有プリファレンスのインスタンスを取得 // 共有プリファレンスのインスタンスを取得
SharedPreferences sharedPreferences = getSharedPreferences("MyDataList", MODE_PRIVATE); SharedPreferences sharedPreferences = getSharedPreferences("MyDataList", MODE_PRIVATE);
@ -367,6 +296,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
editor.apply(); editor.apply();
} }
// 保護者の重複による警告ダイアログ
private void showErrorDialog(List<MyDataClass> myDataList) { private void showErrorDialog(List<MyDataClass> myDataList) {
List<Integer> studentNumbers = new ArrayList<>(); List<Integer> studentNumbers = new ArrayList<>();
for (MyDataClass data : myDataList) { for (MyDataClass data : myDataList) {
@ -374,12 +304,22 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
studentNumbers.add(data.getStudentNumber()); studentNumbers.add(data.getStudentNumber());
} }
} }
StringBuilder message = new StringBuilder("保護者の重複が重大でルート作成ができません。調整してください。\n出席番号: "); StringBuilder message = new StringBuilder("保護者の重複が重大でルート作成ができません。保護者に連絡して調整してください。\n\n");
for (int i = 0; i < studentNumbers.size(); i++) { for (int i = 0; i < studentNumbers.size(); i++) {
message.append(studentNumbers.get(i)); message.append("出席番号:" + studentNumbers.get(i));
if (i < studentNumbers.size() - 1) { message.append("\n保護者名:" + myDataList.get(i).getPatronName());
message.append(", "); 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) new AlertDialog.Builder(MainActivity.this)
.setTitle("警告") .setTitle("警告")
@ -390,14 +330,14 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
.show(); .show();
} }
// データベースのインスタンスを取得するメソッド
private AppDatabase getDatabaseInstance() { private AppDatabase getDatabaseInstance() {
return Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build(); return Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
} }
//提出状況の取得 //提出状況の取得
private ArrayList<SubmissionStudent> getSubmissionStudents() { public ArrayList<SubmissionStudent> getSubmissionStudents() {
ArrayList<SubmissionStudent> submissionStudents = new ArrayList<>(); ArrayList<SubmissionStudent> submissionStudents = new ArrayList<>();
List<MyDataClass> myDataList = firestoreReception.getMyDataList(); List<MyDataClass> myDataList = firestoreReception.getMyDataList();
@ -405,10 +345,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch = new CountDownLatch(1);
executor.execute(() -> { executor.execute(() -> {
try {
// 1. Roomデータベースから全生徒数を取得 // 1. Roomデータベースから全生徒数を取得
AppDatabase db = getDatabaseInstance(); AppDatabase db = getDatabaseInstance();
SetUpTableDao setUpTableDao = db.setUpTableDao(); SetUpTableDao setUpTableDao = db.setUpTableDao();
int totalStudentInt = setUpTableDao.getTotalStudent(); int totalStudentInt = setUpTableDao.getTotalStudent();
// 2. Firestoreから生徒番号のリストを取得 // 2. Firestoreから生徒番号のリストを取得
ArrayList<Integer> firestoreStudentNumbersList = new ArrayList<>(); ArrayList<Integer> firestoreStudentNumbersList = new ArrayList<>();
for (MyDataClass myData : myDataList) { for (MyDataClass myData : myDataList) {
@ -421,24 +363,26 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
boolean submitted = firestoreStudentNumbersList.contains(i); boolean submitted = firestoreStudentNumbersList.contains(i);
submissionStudents.add(new SubmissionStudent(i, submitted)); submissionStudents.add(new SubmissionStudent(i, submitted));
} }
} catch (Exception e) {
e.printStackTrace(); // ログにエラーメッセージを出力
} finally {
// 4. データベース操作が完了したことを通知 // 4. データベース操作が完了したことを通知
latch.countDown(); latch.countDown();
}
}); });
try { try {
// データベース操作が完了するのを待つ latch.await(); // 非同期処理が完了するまで待機
latch.await();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} finally {
executor.shutdown(); // ExecutorServiceをシャットダウン
} }
executor.shutdown();
// SubmissionStudentオブジェクトのリストを返す
return submissionStudents; return submissionStudents;
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();

View File

@ -2,6 +2,8 @@ package com.example.oplogy;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -42,9 +44,6 @@ import java.util.Map;
public class Maps extends FragmentActivity implements OnMapReadyCallback, View.OnClickListener, GoogleMap.OnMarkerClickListener { public class Maps extends FragmentActivity implements OnMapReadyCallback, View.OnClickListener, GoogleMap.OnMarkerClickListener {
ImageView backMain;
private GoogleMap mMap;
private LinearLayout locationsName;
//GoogleMapAPiで使用可能な色 //GoogleMapAPiで使用可能な色
private static final int[] COLORS = new int[]{Color.parseColor("#007FFF"), // HUE_AZURE private static final int[] COLORS = new int[]{Color.parseColor("#007FFF"), // HUE_AZURE
Color.parseColor("#0000FF"), // HUE_BLUE Color.parseColor("#0000FF"), // HUE_BLUE
@ -57,13 +56,14 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
Color.parseColor("#8A2BE2"), // HUE_VIOLET Color.parseColor("#8A2BE2"), // HUE_VIOLET
Color.parseColor("#FFFF00") // HUE_YELLOW Color.parseColor("#FFFF00") // HUE_YELLOW
}; };
private int colorIndex = 0;
private final List<LatLng> latLngList = new ArrayList<>(); private final List<LatLng> latLngList = new ArrayList<>();
private final List<String> nameList = new ArrayList<>(); private final List<String> nameList = new ArrayList<>();
private final List<Integer> colorList = new ArrayList<>(); private final List<Integer> colorList = new ArrayList<>();
private final Map<String, Runnable> dateMap = new HashMap<>(); private final Map<String, Runnable> dateMap = new HashMap<>();
ImageView backMain;
private GoogleMap mMap;
private LinearLayout locationsName;
private int colorIndex = 0;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -213,11 +213,22 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
//家庭訪問のscheduleを7桁の整数から(604120006月12日05時20分)に変換 //家庭訪問のscheduleを7桁の整数から(604120006月12日05時20分)に変換
private String formatSchedule(String schedule) { 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 monthString = "0" + schedule.substring(0, 1);
String dayString = schedule.substring(1, 3); String dayString = schedule.substring(1, 3);
String hourString = schedule.substring(3, 5); String hourString = schedule.substring(3, 5);
String minuteString = schedule.substring(5, 7); String minuteString = schedule.substring(5, 7);
return monthString + "" + dayString + "" + hourString + "" + minuteString + ""; return monthString + "" + dayString + "" + hourString + "" + minuteString + "";
}
} }
// 共有プリファレンスからMyDataListを取得するメソッド // 共有プリファレンスからMyDataListを取得するメソッド
@ -404,6 +415,8 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
} }
} }
// スクロールビューに位置情報を追加するメソッド
// スクロールビューに位置情報を追加するメソッド
// スクロールビューに位置情報を追加するメソッド // スクロールビューに位置情報を追加するメソッド
private void addLocationToScrollView(String locationName, int color) { private void addLocationToScrollView(String locationName, int color) {
runOnUiThread(() -> { runOnUiThread(() -> {
@ -413,35 +426,52 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
textView.setText(locationName); textView.setText(locationName);
textView.setTextSize(20); textView.setTextSize(20);
textView.setPadding(16, 16, 16, 16); textView.setPadding(16, 16, 16, 16);
textView.setBackgroundColor(color); 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 -> { textView.setOnClickListener(v -> {
// 名前リストから位置情報を取得 for (int j = 0; j < nameList.size(); j++) {
int index = nameList.indexOf(locationName); if (nameList.get(j).equals(locationName)) {
if (index != -1) { mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLngList.get(j), 17));
LatLng position = latLngList.get(index); break;
// カメラを該当ピンの位置に移動 }
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(position, 17));
} }
}); });
// 下線のビューの作成 // ボーダーラインの作成
View underline = new View(this); View border = new View(this);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 3); border.setLayoutParams(new LinearLayout.LayoutParams(
params.setMargins(0, 0, 0, 16); LinearLayout.LayoutParams.MATCH_PARENT, // 横幅は親と同じ
underline.setLayoutParams(params); 2 // 高さは2dp
underline.setBackgroundColor(Color.BLACK); ));
border.setBackgroundColor(Color.GRAY); // ボーダーラインの色を設定
// テキストビューと下線のビューをスクロールビューに追加 // レイアウトの作成
locationsName.addView(textView); LinearLayout layout = new LinearLayout(this);
locationsName.addView(underline); layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(textView);
layout.addView(border);
// スクロールビューにレイアウトを追加
locationsName.addView(layout);
} catch (Exception e) { } catch (Exception e) {
Log.e("Maps", "Error adding location to scroll view", e); Log.e("Maps", "エラーが発生しました。原因は以下", e);
} }
}); });
} }
private int getNextColor() { private int getNextColor() {
int color = COLORS[colorIndex]; int color = COLORS[colorIndex];
colorIndex = (colorIndex + 1) % COLORS.length; colorIndex = (colorIndex + 1) % COLORS.length;

View File

@ -1,14 +0,0 @@
package com.example.oplogy;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class RootSearchActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.root_search);
}
}

View File

@ -97,15 +97,29 @@ public class SetUpActivity extends FragmentActivity
Button reset = findViewById(R.id.resetButton); Button reset = findViewById(R.id.resetButton);
toMain.setOnClickListener(view -> { toMain.setOnClickListener(view -> {
Intent intent = new Intent(SetUpActivity.this, MainActivity.class); //main画面へ戻る処理 Intent intent = new Intent(SetUpActivity.this, SettingView.class); //main画面へ戻る処理
startActivity(intent); startActivity(intent);
}); });
setUp.setOnClickListener(view -> { setUp.setOnClickListener(view -> {
teacherNameString = setTeacherName.getText().toString(); //各変数に値を挿入 teacherNameString = setTeacherName.getText().toString(); //各変数に値を挿入
Log.d(TAG, "Teacher Name: " + teacherNameString);
startPointString = setStartPoint.getText().toString(); startPointString = setStartPoint.getText().toString();
firstDayString = setFirstDay.getText().toString();
secondDayString = setSecondDay.getText().toString();
thirdDayString = setThirdDay.getText().toString();
startTimeString = setStartTime.getText().toString();
endTimeString = setEndTime.getText().toString();
startBreakTimeString = setStartBreakTime.getText().toString();
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, "Start Point: " + startPointString);
Log.d(TAG, "First Day:" + firstDayString); Log.d(TAG, "First Day:" + firstDayString);
Log.d(TAG, "Second Day:" + secondDayString); Log.d(TAG, "Second Day:" + secondDayString);
@ -124,11 +138,9 @@ public class SetUpActivity extends FragmentActivity
Log.d(TAG, "Interval Time" + intervalTimeString); Log.d(TAG, "Interval Time" + intervalTimeString);
Log.d(TAG, "Start Break Time" + startBreakTimeString); Log.d(TAG, "Start Break Time" + startBreakTimeString);
Log.d(TAG, "End Break Time" + endBreakTimeString); Log.d(TAG, "End Break Time" + endBreakTimeString);
totalStudentString = Integer.parseInt(setTotalStudent.getText().toString()); //数値型に変更
Log.d(TAG, "Total Student" + totalStudentString); Log.d(TAG, "Total Student" + totalStudentString);
Log.d(TAG, "onClick: できてるよ"); Log.d(TAG, "onClick: できてるよ");
// データベースへの登録処理 // データベースへの登録処理
ExecutorService executor = Executors.newSingleThreadExecutor(); ExecutorService executor = Executors.newSingleThreadExecutor();
@ -176,7 +188,6 @@ public class SetUpActivity extends FragmentActivity
}); });
}); });
setFirstDay.setOnClickListener(v -> { setFirstDay.setOnClickListener(v -> {
@ -235,6 +246,7 @@ public class SetUpActivity extends FragmentActivity
}); });
} }
@Override @Override
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) { //Dateを成形する public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) { //Dateを成形する
// DatePickerDialogで選択された日付を処理する // DatePickerDialogで選択された日付を処理する

View File

@ -0,0 +1,190 @@
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();
}
}

View File

@ -1,7 +1,9 @@
package com.example.oplogy; package com.example.oplogy;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView; 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.LinearLayoutManager;
@ -11,10 +13,9 @@ import java.util.ArrayList;
import java.util.List; 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 RecyclerView recyclerView;
private SubmissionAdapter submissionAdapter; private SubmissionAdapter submissionAdapter;
private final List<SubmissionStudent> studentsList = new ArrayList<>();
ArrayList<Integer> studentNumbersList = new ArrayList<>();
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -25,10 +26,7 @@ public class SubmissionActivity extends AppCompatActivity {
ImageView backButton = findViewById(R.id.BackMain_fromSubmission); ImageView backButton = findViewById(R.id.BackMain_fromSubmission);
backButton.setOnClickListener(v -> finish()); backButton.setOnClickListener(v -> finish());
// RecyclerViewとアダプターの初期化
// インテントから提出状況の生徒の数を取得
studentNumbersList=getIntent().getIntegerArrayListExtra("submissionStudents");
recyclerView = findViewById(R.id.recyclerView); recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setLayoutManager(new LinearLayoutManager(this));
submissionAdapter = new SubmissionAdapter(studentsList); submissionAdapter = new SubmissionAdapter(studentsList);
@ -37,15 +35,21 @@ public class SubmissionActivity extends AppCompatActivity {
// 生徒のリストを取得 // 生徒のリストを取得
fetchStudents(); fetchStudents();
} }
private void fetchStudents() { private void fetchStudents() {
// インテントから生徒のリストを取得 // インテントから生徒のリストを取得
ArrayList<SubmissionStudent> submissionStudentsList = getIntent().getParcelableArrayListExtra("submissionStudents"); ArrayList<SubmissionStudent> submissionStudentsList = getIntent().getParcelableArrayListExtra("submissionStudents");
// 生徒のリストを反復処理しそれをRecyclerViewに表示 if (submissionStudentsList != null) {
Log.d("SubmissionActivity", "Size of submissionStudentsList: " + submissionStudentsList.size());
studentsList.addAll(submissionStudentsList); studentsList.addAll(submissionStudentsList);
} else {
Log.e("SubmissionActivity", "submissionStudentsList is null");
Toast.makeText(this, "生徒のリストが取得できませんでした", Toast.LENGTH_SHORT).show();
}
// データが変更されたことをアダプターに通知 // データが変更されたことをアダプターに通知
submissionAdapter.notifyDataSetChanged(); submissionAdapter.notifyDataSetChanged();
} }
} }

View File

@ -8,24 +8,13 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import java.util.List; import java.util.List;
public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.StudentViewHolder> { public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.StudentViewHolder> {
private final List<SubmissionStudent> studentsList; private final List<SubmissionStudent> studentsList;
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);
}
}
public SubmissionAdapter(List<SubmissionStudent> students) { public SubmissionAdapter(List<SubmissionStudent> students) {
this.studentsList = students; this.studentsList = students;
} }
@ -42,24 +31,42 @@ public class SubmissionAdapter extends RecyclerView.Adapter<SubmissionAdapter.St
public void onBindViewHolder(StudentViewHolder holder, int position) { public void onBindViewHolder(StudentViewHolder holder, int position) {
SubmissionStudent student = studentsList.get(position); SubmissionStudent student = studentsList.get(position);
holder.studentNumberTextView.setText(String.valueOf(student.getStudentNumber())); holder.studentNumberTextView.setText(String.valueOf(student.getStudentNumber()));
// 提出済みかどうかで表示を変える updateStatus(holder, student.isSubmitted());
if (student.isSubmitted()) {
holder.statusTextView.setText("提出済み");
holder.statusTextView.setBackgroundColor(Color.BLACK);
holder.statusTextView.setTextColor(Color.WHITE);
holder.studentNumberTextView.setBackgroundColor(Color.BLACK);
holder.studentNumberTextView.setTextColor(Color.WHITE);
} else {
holder.statusTextView.setText("未提出");
holder.statusTextView.setBackgroundColor(Color.RED);
holder.statusTextView.setTextColor(Color.WHITE);
holder.studentNumberTextView.setBackgroundColor(Color.RED);
holder.studentNumberTextView.setTextColor(Color.WHITE);
}
} }
@Override @Override
public int getItemCount() { public int getItemCount() {
return studentsList.size(); 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);
}
}
} }

View File

@ -1,14 +0,0 @@
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);
}
}

View File

@ -0,0 +1,126 @@
<?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>

View File

@ -1,146 +1,148 @@
<?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="wrap_content" android:layout_width="400dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="3" android:layout_gravity="center"
android:weightSum="2" android:layout_weight="4"
android:orientation="horizontal"> android:orientation="horizontal"
android:weightSum="3">
<ImageView <ImageView
android:id="@+id/imageUuid" android:id="@+id/imageTitle"
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/creatUUID" android:id="@+id/title"
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="1" android:layout_weight="2"
android:gravity="left" android:gravity="left"
android:text="ID作成" android:text="OPLOGY"
android:textSize="50dp" android:textSize="60dp"
/> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<!-- セットアップのレイアウト-->
<LinearLayout
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: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>
<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="3"/> android:layout_weight="2" />
<!-- ルート表示のレイアウト--> <!-- ルート表示のレイアウト-->
<LinearLayout <LinearLayout
android:layout_width="400dp" android:layout_width="400dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="3"
android:weightSum="2"
android:layout_gravity="center" android:layout_gravity="center"
android:orientation="horizontal"> android:layout_weight="3"
android:orientation="horizontal"
android:weightSum="2">
<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:text="ルート表示" android:layout_gravity="center"
android:textSize="40dp"
android:textStyle="bold"
android:layout_weight="1" android:layout_weight="1"
android:gravity="left" android:gravity="left"
android:layout_gravity="center"/> android:text="ルート表示"
android:textSize="40dp"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
<!-- 提出状況のレイアウト--> <!-- 提出状況のレイアウト-->
<LinearLayout <LinearLayout
android:layout_width="350dp" android:layout_width="350dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="3"
android:layout_gravity="center" android:layout_gravity="center"
android:weightSum="2" android:layout_weight="3"
android:orientation="horizontal"> android:orientation="horizontal"
android:weightSum="2">
<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:text="提出状況" android:layout_gravity="center"
android:textSize="40dp"
android:textStyle="bold"
android:layout_weight="1" android:layout_weight="1"
android:gravity="left" android:gravity="left"
android:layout_gravity="center"/> android:text="提出状況"
android:textSize="40dp"
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:gravity="left"
android:text="設定"
android:textSize="40dp"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -1,9 +0,0 @@
<?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>

View File

@ -4,7 +4,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/studentNumberTextView" android:id="@+id/studentNumberTextView"
android:layout_width="0dp" android:layout_width="0dp"
@ -22,10 +21,10 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="3" android:layout_weight="3"
android:text="提出状況" android:background="@android:color/white"
android:textSize="36sp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingStart="8dp" android:paddingStart="8dp"
android:background="@android:color/white" android:text="提出状況"
android:textColor="@android:color/black" /> android:textColor="@android:color/black"
android:textSize="36sp" />
</LinearLayout> </LinearLayout>

View File

@ -1,6 +1,5 @@
<?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"
@ -10,7 +9,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
@ -29,15 +28,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="4" android:layout_weight="4"
android:hint="提出状況" android:hint="提出状況"
android:textSize="40dp"
android:padding="8dp" android:padding="8dp"
/> android:textSize="40dp" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView" android:id="@+id/recyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="0dp"
/> android:layout_weight="9"
android:scrollbars="vertical" />
</LinearLayout> </LinearLayout>

View File

@ -1,9 +0,0 @@
<?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>

View File

@ -1,6 +1,5 @@
<?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="@drawable/ic_launcher_background" /> <background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon> </adaptive-icon>

View File

@ -1,6 +1,5 @@
<?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="@drawable/ic_launcher_background" /> <background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon> </adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@ -3,7 +3,7 @@
<string name="maps_api_key">AIzaSyBqLqPm76UFpwbpU8b3oiH0wbkhosrPWpU</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>