コンフリクト修正

This commit is contained in:
it232115 2024-06-28 10:21:32 +09:00
parent af694c67f0
commit 6bd8a4ab81

View File

@ -187,10 +187,26 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// タスク2: Firestoreからデータを取得 // タスク2: Firestoreからデータを取得
executor.execute(() -> { executor.execute(() -> {
List<MyDataClass> myDataList = firestoreReception.getMyDataList(); List<MyDataClass> myDataList = null;
while (myDataList == null) {
myDataList = firestoreReception.getMyDataList();
try {
Thread.sleep(3000);
Log.d("MainActivity","myDataList"+ myDataList.size());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
Log.d("MainActivity","myDataList"+ myDataList.size());
CreateRoot createRoot = new CreateRoot(MainActivity.this); CreateRoot createRoot = new CreateRoot(MainActivity.this);
createRoot.receiveData(myDataList); Boolean notDuplicates=createRoot.receiveData(myDataList);
latch.countDown(); latch.countDown();
if(notDuplicates){
Log.d("MainActivity","スケジュール作成成功");
}else{
showErrorDialog(latch);
}
}); });
new Thread(() -> { new Thread(() -> {
@ -226,7 +242,25 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
}) })
.show(); .show();
} }
public void showErrorDialog(CountDownLatch latch) {
new AlertDialog.Builder(MainActivity.this)
.setTitle("警告")
.setMessage("保護者の重複が重大でルート作成ができません。調整してください")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
latch.countDown();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.show();
}
//Main //Main
private ArrayList<SubmissionStudent> getSubmissionStudents() { private ArrayList<SubmissionStudent> getSubmissionStudents() {
@ -280,3 +314,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
} }
} }