必須項目が記入されていないを画面に表示する条件を変更しました。

This commit is contained in:
Ekamo-11 2024-07-05 13:11:12 +09:00
parent 4808e7a761
commit 6f9f4bce75

View File

@ -25,6 +25,7 @@ import androidx.fragment.app.FragmentActivity;
import androidx.room.Room; import androidx.room.Room;
import java.util.Locale; import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -145,7 +146,7 @@ public class SetUpActivity extends FragmentActivity
// 入力データのバリデーション // 入力データのバリデーション
if (TextUtils.isEmpty(teacherName) || TextUtils.isEmpty(startPoint) || TextUtils.isEmpty(startTime) if (TextUtils.isEmpty(teacherName) || TextUtils.isEmpty(startPoint) || TextUtils.isEmpty(startTime)
|| TextUtils.isEmpty(firstDay) || TextUtils.isEmpty(secondDay) || TextUtils.isEmpty(thirdDay) || TextUtils.isEmpty(firstDay) || TextUtils.isEmpty(secondDay) || TextUtils.isEmpty(thirdDay)
|| TextUtils.isEmpty(endTime) || TextUtils.isEmpty(intervalTime) || TextUtils.isEmpty(startBreakTime) || TextUtils.isEmpty(endTime) || Objects.equals(intervalTime, "0") || TextUtils.isEmpty(startBreakTime)
|| TextUtils.isEmpty(endBreakTime) || totalStudent <= 0) { || TextUtils.isEmpty(endBreakTime) || totalStudent <= 0) {
Toast.makeText(SetUpActivity.this, "必須項目を入力してください", Toast.LENGTH_SHORT).show(); Toast.makeText(SetUpActivity.this, "必須項目を入力してください", Toast.LENGTH_SHORT).show();
return; return;
@ -257,6 +258,18 @@ public class SetUpActivity extends FragmentActivity
textViewEndBreakTime.setText(""); textViewEndBreakTime.setText("");
textViewTotalStudent.setText(""); textViewTotalStudent.setText("");
teacherName = "";
startPoint = "";
firstDay = "";
secondDay = "";
thirdDay = "";
startTime = "";
endTime = "";
intervalTime = "";
startBreakTime = "";
endBreakTime ="" ;
ExecutorService executor = Executors.newSingleThreadExecutor(); ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(() -> { executor.execute(() -> {
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build(); AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();