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