CreateRoot2 #19
|
@ -85,7 +85,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// クリック処理
|
// クリック処理
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
// ID作成のクリック処理
|
// ID作成のクリック処理
|
||||||
|
@ -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() {
|
||||||
|
@ -279,4 +313,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user