@Override protected void onPrepareDialog(int id, Dialog dialog) { AlertDialog alertDialog = (AlertDialog) dialog; switch (id) { case DialogId.DIALOG_ALERT_FREQUENCY: alertDialog.setMessage(getResources().getString(R.string.frequency_out_of_range)); break; case DialogId.DIALOG_ALERT_FREQUENCY_NULL: alertDialog.setMessage(getResources().getString(R.string.frequency_null)); break; /*case DialogId.DIALOG_ALERT_SYMBOL: alertDialog.setMessage(getResources().getString(R.string.symbol_rate_out_of_range)); break;*/ case DialogId.DIALOG_ALERT_SYMBOL_NULL: alertDialog.setMessage(getResources().getString(R.string.symbol_rate_null)); break; case DialogId.DIALOG_ALERT_SYMBOL_OUT: alertDialog.setMessage(getResources().getString(R.string.symbol_rate_out_range)); break; } Message msg = new Message(); msg.what = DIALOG_ALERT_DISMISS; msg.arg1 = id; mainHandler.sendMessageDelayed(msg, 3000); log.D("message: dismiss dialog" + msg.arg1); super.onPrepareDialog(id, dialog); }
@Override public void handleMessage(Message msg) { switch (msg.what) { case DIALOG_ALERT_DISMISS: log.D("MainHandlerMsg.DIALOG_ALERT_DISMISS dialog id = " + msg.arg1); dismissDialog(msg.arg1); break; } super.handleMessage(msg); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_save_auto: String frequencyStr = mFrequencyEditText.getText().toString(); String symbolRateStr = mSymbolRateEditText.getText().toString(); mDefaultTransponder.setFrequency(Integer.parseInt(frequencyStr) * 1000); mDefaultTransponder.setSymbolRate(Integer.parseInt(symbolRateStr)); // 点击保存后设置频点信息到bundle 返回搜索时带着频点数据 Intent resultIntent = new Intent(); Bundle mBundle = new Bundle(); mBundle.putInt(MODULATION, mDefaultTransponder.getModulation()); mBundle.putInt(FREQUENCY, Integer.parseInt(frequencyStr) * 1000); mBundle.putInt(SYMBOLRATE, Integer.parseInt(symbolRateStr)); resultIntent.putExtras(mBundle); setResult(AUTOSEARCH_RESPONSECODE, resultIntent); // 保存tp信息到sp if (SearchMainActivity.FULLSEARCH.equals(stringExtra)) { log.D("save mainTP"); TransponderUtil.saveDefaultTransponer( this, DefaultParameter.DefaultTransponderType.DEFAULT_TRANSPONDER_TYPE_MAINTP, mDefaultTransponder); } else { log.D("save autoTp"); TransponderUtil.saveDefaultTransponer( this, DefaultParameter.DefaultTransponderType.DEFAULT_TRANSPONDER_TYPE_AUTO, mDefaultTransponder); } finish(); break; case R.id.btn_cancle_auto: finish(); break; } }