Prevent disconnection if device is not connected.

master
Daniele Gobbetti 2016-10-30 14:42:08 +01:00
parent 46824b7235
commit a45f76d3bf
1 changed files with 4 additions and 2 deletions

View File

@ -80,8 +80,10 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
holder.container.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showTransientSnackbar(R.string.controlcenter_snackbar_disconnecting);
GBApplication.deviceService().disconnect();
if (device.isInitialized() || device.isConnected()) {
showTransientSnackbar(R.string.controlcenter_snackbar_disconnecting);
GBApplication.deviceService().disconnect();
}
return true;
}
});