|
@@ -155,15 +155,19 @@ public class ServicesListAdapter extends ArrayAdapter<ServicesListItem> {
|
|
|
}
|
|
|
}
|
|
|
else if (!MainActivity.getInstance().getHostageService().isRunning(item.protocol)) {
|
|
|
- MainActivity.getInstance().getHostageService().startListener(item.protocol);
|
|
|
-
|
|
|
- //set the main switch to null, so that he won't react and starts all protocols
|
|
|
- mServicesSwitch.setOnCheckedChangeListener(null);
|
|
|
- mServicesSwitch.setChecked(true);
|
|
|
- mServicesSwitch.setOnCheckedChangeListener(mListener);
|
|
|
- if(!buttonView.isChecked()) {
|
|
|
- buttonView.setChecked(true);
|
|
|
- }
|
|
|
+ boolean success = MainActivity.getInstance().getHostageService().startListener(item.protocol);
|
|
|
+
|
|
|
+ if (success) {
|
|
|
+ //set the main switch to null, so that he won't react and starts all protocols
|
|
|
+ mServicesSwitch.setOnCheckedChangeListener(null);
|
|
|
+ mServicesSwitch.setChecked(true);
|
|
|
+ mServicesSwitch.setOnCheckedChangeListener(mListener);
|
|
|
+ if (!buttonView.isChecked()) {
|
|
|
+ buttonView.setChecked(true);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ buttonView.setChecked(false);
|
|
|
+ }
|
|
|
} else {
|
|
|
if(!buttonView.isChecked()) {
|
|
|
buttonView.setChecked(true);
|