@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); app = (App) getApplication(); app.ForceLanguage(); setContentView(R.layout.nav_wp_editor); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setVolumeControlStream(AudioManager.STREAM_MUSIC); getWindow() .setLayout(LayoutParams.MATCH_PARENT /* width */, LayoutParams.WRAP_CONTENT /* height */); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); Bundle extras = getIntent().getExtras(); if (extras != null) { MarkerId = extras.getString("MARKERID"); } TVWPTitle = (TextView) findViewById(R.id.textViewWPTitle); ETAltitude = (EditText) findViewById(R.id.editTextAltitude); ETParameter1 = (EditText) findViewById(R.id.editTextParameter1); ETParameter2 = (EditText) findViewById(R.id.editTextParameter2); ETParameter3 = (EditText) findViewById(R.id.editTextParameter3); SpinnerAction = (Spinner) findViewById(R.id.spinnerAction); TVPar1 = (TextView) findViewById(R.id.textViewPar1); TVPar2 = (TextView) findViewById(R.id.textViewPar2); TVPar3 = (TextView) findViewById(R.id.textViewPar3); IVActionIcon = (ImageView) findViewById(R.id.imageViewActionIcon); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( this, R.array.wp_actions, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); SpinnerAction.setAdapter(adapter); SpinnerAction.setOnItemSelectedListener( new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { setParametersDesc(position + 1); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); ((CheckBox) findViewById(R.id.checkBoxCircle)) .setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { ((TableLayout) findViewById(R.id.TLCircle)).setVisibility(View.VISIBLE); ((TableLayout) findViewById(R.id.TLWP)).setVisibility(View.GONE); SpinnerAction.setSelection(WaypointNav.WP_ACTION_SET_POI - 1); } else { ((TableLayout) findViewById(R.id.TLCircle)).setVisibility(View.GONE); ((TableLayout) findViewById(R.id.TLWP)).setVisibility(View.VISIBLE); } } }); loadWPData(); }
@Override protected void onResume() { super.onResume(); app.ForceLanguage(); }
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(); }
@Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); app.ForceLanguage(); }
@Override protected void onResume() { super.onResume(); app.ForceLanguage(); if (app.RadioMode == 1) { Mode1.setChecked(true); } else { Mode2.setChecked(true); } if (app.Protocol == 200) { Protocol20.setChecked(true); } else { Protocol21.setChecked(true); } if (app.MagMode == 1) { MagMode1.setChecked(true); } else { MagMode2.setChecked(true); } CheckBoxTTS.setChecked(app.TextToSpeach); CheckBoxConnectOnStart.setChecked(app.ConnectOnStart); CheckBoxAltCorrection.setChecked(app.AltCorrection); CheckBoxDisableBTonExit.setChecked(app.DisableBTonExit); CheckBoxCopyFrskyToMW.setChecked(app.CopyFrskyToMW); CheckBoxUseOfflineMap.setChecked(app.UseOfflineMaps); CheckBoxReverseRollDirection.setChecked(app.ReverseRoll); CheckBoxUseFTDISerial.setChecked( app.CommunicationTypeMW == App.COMMUNICATION_TYPE_SERIAL_FTDI || app.CommunicationTypeMW == App.COMMUNICATION_TYPE_SERIAL_OTHERCHIPS); RadioFTDI.setChecked( app.CommunicationTypeMW == App.COMMUNICATION_TYPE_SERIAL_FTDI || app.CommunicationTypeMW == App.COMMUNICATION_TYPE_BT); RadioOtherChips.setChecked(app.CommunicationTypeMW == App.COMMUNICATION_TYPE_SERIAL_OTHERCHIPS); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) { LayoutSerialFTDI.setVisibility(View.GONE); } MacAddressBTTV.setText("MAC:" + app.MacAddress); MacAddressBTFrskyTV.setText("MAC:" + app.MacAddressFrsky); RadioNotForce.setChecked(app.ForceLanguage.equals("")); RadioForceEnglish.setChecked(app.ForceLanguage.equals("en")); RadioForceGerman.setChecked(app.ForceLanguage.equals("de")); RadioForceHungarian.setChecked(app.ForceLanguage.equals("hu")); RadioForcePolish.setChecked(app.ForceLanguage.equals("pl")); EditTextPeriodicSpeaking.setText(String.valueOf(app.PeriodicSpeaking / 1000)); EditTextVoltageAlarm.setText(String.valueOf(app.VoltageAlarm)); EditTextRefreshRate.setText(String.valueOf(app.RefreshRate)); EditTextMapCenterPeriod.setText(String.valueOf(app.MapCenterPeriod)); EditTextSerialBaudRateMW.setText(app.SerialPortBaudRateMW); if (app.MainRequestMethod == 2) { CheckBoxNewRequestMethod.setChecked(true); } else { CheckBoxNewRequestMethod.setChecked(false); } app.Say(getString(R.string.Config)); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); }