@Override protected void onStart() { super.onStart(); utility.updateHeader( Utility.NO_FILE, R.string.pref_hardware_config_filename, R.id.active_filename, R.id.included_header); Intent intent = getIntent(); Serializable extra = intent.getSerializableExtra(EDIT_MOTOR_CONTROLLER_CONFIG); if (extra != null) { motorControllerConfigurationConfig = (MotorControllerConfiguration) extra; motors = (ArrayList<DeviceConfiguration>) motorControllerConfigurationConfig.getMotors(); motor1 = (MotorConfiguration) motors.get(0); motor2 = (MotorConfiguration) motors.get(1); controller_name.setText(motorControllerConfigurationConfig.getName()); motor1_name.setText(motor1.getName()); motor2_name.setText(motor2.getName()); addListenerOnPort1(); handleDisabledMotor(motor1, checkbox_motor1); addListenerOnPort2(); handleDisabledMotor(motor2, checkbox_motor2); } }
private void m133a(MotorConfiguration motorConfiguration, CheckBox checkBox) { if (motorConfiguration.getName().equals("NO DEVICE ATTACHED") || motorConfiguration.getType() == ConfigurationType.NOTHING) { checkBox.setChecked(true); checkBox.performClick(); return; } checkBox.setChecked(true); }
private void handleDisabledMotor(MotorConfiguration motor, CheckBox checkbox) { if (motor.getName().equals(DeviceConfiguration.DISABLED_DEVICE_NAME) || motor.getType() == DeviceConfiguration.ConfigurationType.NOTHING) { checkbox.setChecked(true); // kind of a hack. Sets the checkbox to true, so // when performing the click programmatically, // the checkbox becomes "unclicked" which does the right thing. checkbox.performClick(); } else { checkbox.setChecked(true); } }