This commit is contained in:
ろむねこ 2024-01-17 19:15:24 +09:00
parent d6af5b935b
commit 1eea70f920
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -160,21 +160,16 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onResume() {
Log.d("onResume", "called");
if (mDocRef == null) {
Log.d("onResume", "mDocRef is null");
SharedPreferences sharedPreferences = getSharedPreferences("app_situation", MODE_PRIVATE);
String IdPref = sharedPreferences.getString("ID", null);
if (IdPref == null) {
Log.d("onResume", "ID not initialized.");
return;
}
mDocRef = FirebaseFirestore.getInstance().document("users/" + IdPref);//現在の位置を取得
initNotification(mDocRef);
}
if (mDocRef.getId().equals(null)) {
Log.d("onResume", "mDocRef.getId() is null");
Log.d("onResume", "mDocRef is null");
SharedPreferences sharedPreferences = getSharedPreferences("app_situation", MODE_PRIVATE);
String IdPref = sharedPreferences.getString("ID", null);
if (IdPref == null) {
Log.d("onResume", "ID not initialized.");
return;
}
mDocRef = FirebaseFirestore.getInstance().document("users/" + IdPref);//現在の位置を取得
this.flg = false;
initNotification(mDocRef);
super.onResume();
}
@ -218,7 +213,9 @@ public class MainActivity extends AppCompatActivity {
// SupportFragmentManagerが現在表示しているFragmentを取得
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragmentContainerView);
if (fragment instanceof HomeFragment) {
((HomeFragment) fragment).updateUiState(!isInCar);
((HomeFragment) fragment).onEvent(!isInCar);
} else {
Log.d("nt", "HomeFragment is not visible");
}
}
}