NowLoading作成完了
This commit is contained in:
parent
65edd2e9f8
commit
52a03156a2
|
@ -1,5 +1,6 @@
|
|||
package com.example.oplogy;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -322,6 +323,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
}
|
||||
|
||||
private void createRoute(ExecutorService executor) {
|
||||
// ProgressDialogを作成
|
||||
ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
|
||||
progressDialog.setMessage("Loading...");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
executor.execute(() -> {
|
||||
List<MyDataClass> myDataList = null;
|
||||
while (myDataList == null) {
|
||||
|
@ -330,11 +337,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
runOnUiThread(progressDialog::dismiss); // 進行状況ダイアログを閉じる
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//final宣言することによって、スレッドセーフになる(ラムダ式内で使えるようにする)
|
||||
final List<MyDataClass> finalMyDataList = myDataList;
|
||||
CreateSchedule createSchedule = new CreateSchedule(MainActivity.this);
|
||||
String startPointLatLngString = createSchedule.receiveData(myDataList, getApplicationContext());
|
||||
|
@ -349,7 +356,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
}
|
||||
Boolean finalNotDuplicatesBoolean = notDuplicatesBoolean;
|
||||
Log.d("MainActivity", "重複判定" + String.valueOf(finalNotDuplicatesBoolean));
|
||||
|
||||
runOnUiThread(() -> {
|
||||
progressDialog.dismiss(); // 進行状況ダイアログを閉じる
|
||||
if (finalNotDuplicatesBoolean) {
|
||||
Log.d("MainActivity", "スケジュール作成成功");
|
||||
saveMyDataList(finalMyDataList);
|
||||
|
@ -367,6 +376,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
private void saveMyDataList(List<MyDataClass> myDataList) {
|
||||
// 共有プリファレンスのインスタンスを取得
|
||||
SharedPreferences sharedPreferences = getSharedPreferences("MyDataList", MODE_PRIVATE);
|
||||
|
|
Loading…
Reference in New Issue
Block a user