ShardPreferenceのチェックが異常だったので修正

This commit is contained in:
ろむねこ 2024-01-17 19:49:28 +09:00
parent e4aafc44c6
commit 51fd91027d
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -23,6 +23,7 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Vibrator; import android.os.Vibrator;
@ -165,12 +166,11 @@ public class MainActivity extends AppCompatActivity {
String IdPref = sharedPreferences.getString("ID", null); String IdPref = sharedPreferences.getString("ID", null);
if (IdPref == null) { if (IdPref == null) {
Log.d("onResume", "ID not initialized."); Log.d("onResume", "ID not initialized.");
return; } else {
mDocRef = FirebaseFirestore.getInstance().document("users/" + IdPref);//現在の位置を取得
this.flg = false;
initNotification(mDocRef);
} }
mDocRef = FirebaseFirestore.getInstance().document("users/" + IdPref);//現在の位置を取得
this.flg = false;
initNotification(mDocRef);
super.onResume(); super.onResume();
} }
@ -203,13 +203,8 @@ public class MainActivity extends AppCompatActivity {
notifyMain(); notifyMain();
} }
} else { } else {
if (isInCar) { E.putBoolean("car", !isInCar);
E.putBoolean("car", false); E.apply();
E.apply();
} else {
E.putBoolean("car", true);
E.apply();
}
// SupportFragmentManagerが現在表示しているFragmentを取得 // SupportFragmentManagerが現在表示しているFragmentを取得
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragmentContainerView); Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragmentContainerView);
if (fragment instanceof HomeFragment) { if (fragment instanceof HomeFragment) {