ID作成時に表示をダイアログに変更、セットアップが終了していない場合にtoast表示を行い遷移しないように変更 #49

Merged
murakumo merged 3 commits from last into master 2024-07-10 07:09:15 +00:00
2 changed files with 26 additions and 34 deletions
Showing only changes of commit 634547622a - Show all commits

View File

@ -16,19 +16,18 @@ 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) {
myDataList.clear(); myDataList.clear();
CollectionReference collectionRef = db.collection("QuestionnaireForms"); CollectionReference collectionRef = db.collection("testTimeStamp");
// classIdが引数のものを取得する // classIdが引数のものを取得する
collectionRef.whereEqualTo("classId", classId).get() collectionRef.whereEqualTo("classId", classId).get()

View File

@ -2,7 +2,6 @@ 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.DatePickerDialog;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
@ -42,6 +41,16 @@ public class SetUpActivity extends FragmentActivity
String startBreakTimeString; String startBreakTimeString;
String endBreakTimeString; String endBreakTimeString;
int totalStudentString; 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;
@ -52,29 +61,13 @@ public class SetUpActivity extends FragmentActivity
private int isDateSelectedInt; private int isDateSelectedInt;
private int isStartTimeSelectedInt; private int isStartTimeSelectedInt;
String stringYearString;
String stringMonthString;
String stringDayOfMonthString;
String stringHourOfDayString;
String stringMinuteString;
Button setFirstDay;
Button setSecondDay;
Button setThirdDay;
Button setStartTimeButton;
Button setEndTimeButton;
@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); 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); //開始地点
@ -104,7 +97,7 @@ 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, MainActivity.class); //main画面へ戻る処理
startActivity(intent); startActivity(intent);
}); });
@ -119,7 +112,7 @@ public class SetUpActivity extends FragmentActivity
Log.d(TAG, "Third Day:" + thirdDayString); Log.d(TAG, "Third Day:" + thirdDayString);
Log.d(TAG, "Start Time" + startTimeString); Log.d(TAG, "Start Time" + startTimeString);
Log.d(TAG, "End Time" + endTimeString); Log.d(TAG, "End Time" + endTimeString);
if (setTenMinute.isChecked()){ //ラジオボタンの状態を取得 if (setTenMinute.isChecked()) { //ラジオボタンの状態を取得
intervalTimeString = "10"; intervalTimeString = "10";
} else if (setFifteenMinute.isChecked()) { } else if (setFifteenMinute.isChecked()) {
intervalTimeString = "15"; intervalTimeString = "15";
@ -172,12 +165,12 @@ public class SetUpActivity extends FragmentActivity
runOnUiThread(() -> Toast.makeText(SetUpActivity.this, "登録しました", Toast.LENGTH_SHORT).show()); runOnUiThread(() -> Toast.makeText(SetUpActivity.this, "登録しました", Toast.LENGTH_SHORT).show());
} }
//家庭訪問日を保存する共有プリファレンス //家庭訪問日を保存する共有プリファレンス
SharedPreferences sharedPreferences=getSharedPreferences("visitingDate",MODE_PRIVATE); SharedPreferences sharedPreferences = getSharedPreferences("visitingDate", MODE_PRIVATE);
SharedPreferences.Editor editor= sharedPreferences.edit(); SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("day1",firstDayString); editor.putString("day1", firstDayString);
editor.putString("day2",secondDayString); editor.putString("day2", secondDayString);
editor.putString("day3",thirdDayString); editor.putString("day3", thirdDayString);
editor.apply(); editor.apply();
@ -186,17 +179,17 @@ public class SetUpActivity extends FragmentActivity
}); });
setFirstDay.setOnClickListener(v ->{ setFirstDay.setOnClickListener(v -> {
isDateSelectedInt = 1; isDateSelectedInt = 1;
showDatePickerDialog(); //DatePickerの表示 showDatePickerDialog(); //DatePickerの表示
}); });
setSecondDay.setOnClickListener(v ->{ setSecondDay.setOnClickListener(v -> {
isDateSelectedInt = 2; isDateSelectedInt = 2;
showDatePickerDialog(); showDatePickerDialog();
}); });
setThirdDay.setOnClickListener(v ->{ setThirdDay.setOnClickListener(v -> {
isDateSelectedInt = 3; isDateSelectedInt = 3;
showDatePickerDialog(); showDatePickerDialog();
}); });
@ -245,7 +238,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で選択された日付を処理する
String str = String.format(Locale.JAPAN, "%02d/%02d", month + 1, dayOfMonth); // TextViewに表示する日付の形式を設定 String str = String.format(Locale.JAPAN, "%02d/%02d", month + 1, dayOfMonth); // TextViewに表示する日付の形式を設定
if (isDateSelectedInt == 1) { if (isDateSelectedInt == 1) {
stringYearString = String.valueOf(year); // stringYearString = String.valueOf(year); //
@ -291,7 +284,7 @@ public class SetUpActivity extends FragmentActivity
} else if (isStartTimeSelectedInt == 3) { } else if (isStartTimeSelectedInt == 3) {
stringHourOfDayString = String.format("%02d", hourOfDay); stringHourOfDayString = String.format("%02d", hourOfDay);
stringMinuteString = String.format("%02d", minute); stringMinuteString = String.format("%02d", minute);
startBreakTimeString =stringHourOfDayString + stringMinuteString; startBreakTimeString = stringHourOfDayString + stringMinuteString;
setStartBreakTime.setText(" " + str + " "); setStartBreakTime.setText(" " + str + " ");
} else if (isStartTimeSelectedInt == 4) { } else if (isStartTimeSelectedInt == 4) {