hotfix: UIが崩壊するのを修正
This commit is contained in:
parent
700f315bd3
commit
9649cc3a6e
|
@ -68,7 +68,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
super.onStart();
|
// super.onStart();
|
||||||
|
|
||||||
BottomNavigationView bottomNavigationView = findViewById(R.id.nav_view);
|
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
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
|
||||||
SharedPreferences sharedPreferences = getSharedPreferences("app_situation", MODE_PRIVATE);
|
SharedPreferences sharedPreferences = getSharedPreferences("app_situation", MODE_PRIVATE);
|
||||||
String IdPref = sharedPreferences.getString("ID", null);
|
String IdPref = sharedPreferences.getString("ID", null);
|
||||||
if (IdPref == null) {
|
if (IdPref == null) {
|
||||||
|
@ -106,7 +119,9 @@ public class MainActivity extends AppCompatActivity {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DocumentReference mDocRef = FirebaseFirestore.getInstance().document("users/" + IdPref);//現在の位置を取得
|
DocumentReference mDocRef = FirebaseFirestore.getInstance().document("users/" + IdPref);//現在の位置を取得
|
||||||
initNotification(mDocRef);
|
// initNotification(mDocRef);
|
||||||
|
|
||||||
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initNotification(DocumentReference mDocRef) {
|
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user