hotfix: UIが崩壊するのを修正

This commit is contained in:
ろむねこ 2024-01-17 13:44:23 +09:00
parent 700f315bd3
commit 9649cc3a6e
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -68,7 +68,7 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
super.onStart();
// super.onStart();
BottomNavigationView bottomNavigationView = findViewById(R.id.nav_view);
@ -94,11 +94,24 @@ public class MainActivity extends AppCompatActivity {
});
//Bluetooth検知機能
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
Log.d("BT", "No permission to connect bluetooth devices");
return;
}
else {
Log.d("BT", "Permission to connect bluetooth devices granted");
}
registerReceiver(receiver, intentFilter);
}
@Override
protected void onResume() {
super.onResume();
SharedPreferences sharedPreferences = getSharedPreferences("app_situation", MODE_PRIVATE);
String IdPref = sharedPreferences.getString("ID", null);
if (IdPref == null) {
@ -106,7 +119,9 @@ public class MainActivity extends AppCompatActivity {
return;
}
DocumentReference mDocRef = FirebaseFirestore.getInstance().document("users/" + IdPref);//現在の位置を取得
initNotification(mDocRef);
// initNotification(mDocRef);
super.onResume();
}
private void initNotification(DocumentReference mDocRef) {
@ -170,20 +185,6 @@ public class MainActivity extends AppCompatActivity {
}
});
//Bluetooth検知機能
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
Log.d("BT", "No permission to connect bluetooth devices");
return;
}
else {
Log.d("BT", "Permission to connect bluetooth devices granted");
}
registerReceiver(receiver, intentFilter);
}