private void saveState() {

    Intent returnIntent = new Intent();
    ArrayList<DeviceConfiguration> motors = new ArrayList<>();
    if (motor1Enabled) {
      String name = motor1_name.getText().toString();
      MotorConfiguration newMotor = new MotorConfiguration(name);
      newMotor.setDisabled(false);
      newMotor.setPort(1);
      motors.add(newMotor);
    } else {
      motors.add(new MotorConfiguration(1));
    } // add disabled motor

    if (motor2Enabled) {
      String name = motor2_name.getText().toString();
      MotorConfiguration newMotor = new MotorConfiguration(name);
      newMotor.setDisabled(false);
      newMotor.setPort(2);
      motors.add(newMotor);
    } else {
      motors.add(new MotorConfiguration(2));
    } // add disabled motor

    motorControllerConfigurationConfig.addMotors(motors);
    motorControllerConfigurationConfig.setName(controller_name.getText().toString());
    returnIntent.putExtra(EDIT_MOTOR_CONTROLLER_CONFIG, motorControllerConfigurationConfig);

    setResult(RESULT_OK, returnIntent);
    finish();
  }
 private void m139c() {
   Intent intent = new Intent();
   ArrayList arrayList = new ArrayList();
   if (this.f190g) {
     MotorConfiguration motorConfiguration =
         new MotorConfiguration(this.f194k.getText().toString());
     motorConfiguration.setEnabled(true);
     motorConfiguration.setPort(1);
     arrayList.add(motorConfiguration);
   } else {
     arrayList.add(new MotorConfiguration(1));
   }
   if (this.f191h) {
     motorConfiguration = new MotorConfiguration(this.f195l.getText().toString());
     motorConfiguration.setEnabled(true);
     motorConfiguration.setPort(2);
     arrayList.add(motorConfiguration);
   } else {
     arrayList.add(new MotorConfiguration(2));
   }
   this.f185b.addMotors(arrayList);
   this.f185b.setName(this.f189f.getText().toString());
   intent.putExtra(EDIT_MOTOR_CONTROLLER_CONFIG, this.f185b);
   setResult(-1, intent);
   finish();
 }