only disconnect device when confirming delete dialog
This commit is contained in:
parent
456fcfdd98
commit
56d8a49d5b
|
@ -300,7 +300,6 @@ public class ControlCenter extends GBActivity {
|
||||||
return true;
|
return true;
|
||||||
case R.id.controlcenter_delete_device:
|
case R.id.controlcenter_delete_device:
|
||||||
if (selectedDevice != null) {
|
if (selectedDevice != null) {
|
||||||
GBApplication.deviceService().disconnect();
|
|
||||||
showDeleteDeviceDialog(selectedDevice);
|
showDeleteDeviceDialog(selectedDevice);
|
||||||
selectedDevice = null;
|
selectedDevice = null;
|
||||||
refreshPairedDevices();
|
refreshPairedDevices();
|
||||||
|
@ -372,6 +371,10 @@ public class ControlCenter extends GBActivity {
|
||||||
|
|
||||||
private void deleteDevice(final GBDevice gbDevice) {
|
private void deleteDevice(final GBDevice gbDevice) {
|
||||||
LOG.info("will try to delete device: " + gbDevice.getName());
|
LOG.info("will try to delete device: " + gbDevice.getName());
|
||||||
|
if (gbDevice.isConnected() || gbDevice.isConnected()) {
|
||||||
|
GBApplication.deviceService().disconnect();
|
||||||
|
}
|
||||||
|
GBApplication.deviceService().disconnect();
|
||||||
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
||||||
DaoSession session = dbHandler.getDaoSession();
|
DaoSession session = dbHandler.getDaoSession();
|
||||||
Device device = DBHelper.getDevice(gbDevice, session);
|
Device device = DBHelper.getDevice(gbDevice, session);
|
||||||
|
|
Loading…
Reference in New Issue