Exemplo n.º 1
0
  public void SaveSettingsOnClick(View v) {

    if (Mode1.isChecked()) {
      app.RadioMode = 1;
    } else {
      app.RadioMode = 2;
    }

    if (Protocol20.isChecked()) {
      app.Protocol = 200;
    }

    if (Protocol21.isChecked()) {
      app.Protocol = 210;
    }

    if (MagMode1.isChecked()) {
      app.MagMode = 1;
    } else {
      app.MagMode = 2;
    }

    app.TextToSpeach = CheckBoxTTS.isChecked();
    app.ConnectOnStart = CheckBoxConnectOnStart.isChecked();
    app.AltCorrection = CheckBoxAltCorrection.isChecked();
    app.DisableBTonExit = CheckBoxDisableBTonExit.isChecked();
    app.UseOfflineMaps = CheckBoxUseOfflineMap.isChecked();
    app.CopyFrskyToMW = CheckBoxCopyFrskyToMW.isChecked();
    app.ReverseRoll = CheckBoxReverseRollDirection.isChecked();

    if (RadioNotForce.isChecked()) app.ForceLanguage = "";
    if (RadioForceEnglish.isChecked()) app.ForceLanguage = "en";
    if (RadioForceGerman.isChecked()) app.ForceLanguage = "de";
    if (RadioForceHungarian.isChecked()) app.ForceLanguage = "hu";
    if (RadioForcePolish.isChecked()) app.ForceLanguage = "pl";
    if (RadioForceCzech.isChecked()) app.ForceLanguage = "cs";

    app.PeriodicSpeaking = Integer.parseInt(EditTextPeriodicSpeaking.getText().toString()) * 1000;
    app.VoltageAlarm = Float.parseFloat(EditTextVoltageAlarm.getText().toString());
    app.RefreshRate = Integer.parseInt(EditTextRefreshRate.getText().toString());
    app.MapCenterPeriod = Integer.parseInt(EditTextMapCenterPeriod.getText().toString());

    if (CheckBoxUseFTDISerial.isChecked()) {
      if (RadioFTDI.isChecked()) app.CommunicationTypeMW = App.COMMUNICATION_TYPE_SERIAL_FTDI;

      if (RadioOtherChips.isChecked())
        app.CommunicationTypeMW = App.COMMUNICATION_TYPE_SERIAL_OTHERCHIPS;

    } else {
      app.CommunicationTypeMW = App.COMMUNICATION_TYPE_BT;
    }

    app.SerialPortBaudRateMW = EditTextSerialBaudRateMW.getText().toString();

    if (CheckBoxNewRequestMethod.isChecked()) {
      app.MainRequestMethod = 2;
    } else {
      app.MainRequestMethod = 1;
    }

    app.SaveSettings(false);

    // app.Init();

  }