@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;
    }
  }
예제 #2
0
  private void setupViews() {
    //        mSixteenText.setOnClickListener(this);
    //        mThirthtytwoText.setOnClickListener(this);
    mSixtyfourLinearLayout.setOnClickListener(this);
    mOneTwoEightLinearLayout.setOnClickListener(this);
    mTwoFiveSixLinearLayout.setOnClickListener(this);
    mStartSearchButton.setOnClickListener(this);
    mCancelButton.setOnClickListener(this);
    mDefaultTransponder =
        TransponderUtil.getDefaultTransponder(
            this, DefaultParameter.DefaultTransponderType.DEFAULT_TRANSPONDER_TYPE_MANUAL);
    mFrequencyEditText.setText("" + mDefaultTransponder.getFrequency() / 1000);
    mSymbolRateEditText.setText("" + mDefaultTransponder.getSymbolRate());
    switch (mDefaultTransponder.getModulation()) {
        /*case 0:
            mSixteenImage.setVisibility(View.VISIBLE);
            break;
        case 1:
            mThirthtytwoImage.setVisibility(View.VISIBLE);
            break;*/
      case DefaultParameter.ModulationType.MODULATION_64QAM:
        mSixtyfourImage.setVisibility(View.VISIBLE);
        break;
      case DefaultParameter.ModulationType.MODULATION_128QAM:
        mOneTwoEightImage.setVisibility(View.VISIBLE);
        break;
      case DefaultParameter.ModulationType.MODULATION_256QAM:
        mTwoFiveSixImage.setVisibility(View.VISIBLE);
        break;
    }
    //        mFrequencyEditText.setRange(
    //                DefaultParameter.SearchParameterRange.FREQUENCY_MIN,
    //                DefaultParameter.SearchParameterRange.FREQUENCY_MAX);
    mFrequencyEditText.setOnInputDataErrorListener(
        new OnInputDataErrorListener() {

          public void onInputDataError(int errorType) {
            switch (errorType) {
              case MyEditText.INPUT_DATA_ERROR_TYPE_NULL:
                // 弹出对话框提示输入错误。
                //
                // SearchManualActivity.this.showDialog(DialogId.DIALOG_ALERT_FREQUENCY_NULL);
                AdapterViewSelectionUtil.showToast(
                    SearchManualActivity.this, R.string.frequency_null);
                mFrequencyEditText.setText("" + mDefaultTransponder.getFrequency() / 1000);
                break;
              case MyEditText.INPUT_DATA_ERROR_TYPE_OUT:
                //
                // SearchManualActivity.this.showDialog(DialogId.DIALOG_ALERT_FREQUENCY);
                //                        mFrequencyEditText.setText("" +
                // mDefaultTransponder.getFrequency() / 1000);
                break;
              case MyEditText.INPUT_DATA_ERROR_TYPE_NORMAL:
                break;
            }
          }
        });

    mSymbolRateEditText.setText("" + mDefaultTransponder.getSymbolRate());

    mSymbolRateEditText.setOnInputDataErrorListener(
        new OnInputDataErrorListener() {

          public void onInputDataError(int errorType) {
            switch (errorType) {
              case MyEditText.INPUT_DATA_ERROR_TYPE_NULL:
                //
                // SearchManualActivity.this.showDialog(DialogId.DIALOG_ALERT_SYMBOL_NULL);
                AdapterViewSelectionUtil.showToast(
                    SearchManualActivity.this, R.string.symbol_rate_null);
                mSymbolRateEditText.setText("" + mDefaultTransponder.getSymbolRate());
                break;
              case MyEditText.INPUT_DATA_ERROR_TYPE_OUT:
                //
                // SearchManualActivity.this.showDialog(DialogId.DIALOG_ALERT_SYMBOL);
                //                        mSymbolRateEditText.setText("" +
                // mDefaultTransponder.getSymbolRate());
                break;
              case MyEditText.INPUT_DATA_ERROR_TYPE_NORMAL:
                break;
            }
          }
        });
    mTwoFiveSixLinearLayout.setOnKeyListener(
        new View.OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_DOWN
                && keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
              mStartSearchButton.requestFocus();
              return true;
            }
            return false;
          }
        });
  }
예제 #3
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
        /*case R.id.sixteen_qam_manual_tv:
            mSixteenImage.setVisibility(View.VISIBLE);
            mThirthtytwoImage.setVisibility(View.INVISIBLE);
            mSixtyfourImage.setVisibility(View.INVISIBLE);
            mOneTwoEightImage.setVisibility(View.INVISIBLE);
            mTwoFiveSixImage.setVisibility(View.INVISIBLE);
            mDefaultTransponder.setModulation(0);
            break;

        case R.id.thirthtytwo_qam_manual_tv:
            mSixteenImage.setVisibility(View.INVISIBLE);
            mThirthtytwoImage.setVisibility(View.VISIBLE);
            mSixtyfourImage.setVisibility(View.INVISIBLE);
            mOneTwoEightImage.setVisibility(View.INVISIBLE);
            mTwoFiveSixImage.setVisibility(View.INVISIBLE);
            mDefaultTransponder.setModulation(1);
            break;*/

      case R.id.sixtyfour_qam_manual_tv:
        //                mSixteenImage.setVisibility(View.INVISIBLE);
        //                mThirthtytwoImage.setVisibility(View.INVISIBLE);
        mSixtyfourImage.setVisibility(View.VISIBLE);
        mOneTwoEightImage.setVisibility(View.INVISIBLE);
        mTwoFiveSixImage.setVisibility(View.INVISIBLE);
        mDefaultTransponder.setModulation(DefaultParameter.ModulationType.MODULATION_64QAM);
        break;

      case R.id.onetwoeight_qam_manual_tv:
        //                mSixteenImage.setVisibility(View.INVISIBLE);
        //                mThirthtytwoImage.setVisibility(View.INVISIBLE);
        mSixtyfourImage.setVisibility(View.INVISIBLE);
        mOneTwoEightImage.setVisibility(View.VISIBLE);
        mTwoFiveSixImage.setVisibility(View.INVISIBLE);
        mDefaultTransponder.setModulation(DefaultParameter.ModulationType.MODULATION_128QAM);
        break;

      case R.id.twofivesix_qam_manual_tv:
        //                mSixteenImage.setVisibility(View.INVISIBLE);
        //                mThirthtytwoImage.setVisibility(View.INVISIBLE);
        mSixtyfourImage.setVisibility(View.INVISIBLE);
        mOneTwoEightImage.setVisibility(View.INVISIBLE);
        mTwoFiveSixImage.setVisibility(View.VISIBLE);
        mDefaultTransponder.setModulation(DefaultParameter.ModulationType.MODULATION_256QAM);
        break;

      case R.id.btn_search_manual:
        String frequency = mFrequencyEditText.getText().toString();
        String symbolRate = mSymbolRateEditText.getText().toString();

        Bundle bundle = new Bundle();
        bundle.putInt(FREQUENCY, Integer.parseInt(frequency) * 1000);
        bundle.putInt(SYMBOLRATE, Integer.parseInt(symbolRate));
        bundle.putInt(MODULATION, mDefaultTransponder.getModulation());
        bundle.putBoolean("isManual", isManualSearch);
        mDefaultTransponder.setFrequency(Integer.parseInt(frequency) * 1000);
        mDefaultTransponder.setSymbolRate(Integer.parseInt(symbolRate));
        TransponderUtil.saveDefaultTransponer(
            this,
            DefaultParameter.DefaultTransponderType.DEFAULT_TRANSPONDER_TYPE_MANUAL,
            mDefaultTransponder);

        Intent autoSearchIntent = new Intent(this, SearchHandActivity.class);
        autoSearchIntent.putExtra(MANUALSEARCH, bundle);
        startActivity(autoSearchIntent);
        break;

      case R.id.btn_cancle_manual:
        finish();
        break;
    }
  }
  private void setupViews() {

    mSaveButton.setOnClickListener(this);
    mCancleButton.setOnClickListener(this);

    stringExtra = getIntent().getStringExtra(SEARCHTYPE);
    if (SearchMainActivity.FULLSEARCH.equals(stringExtra)) {
      mDefaultTransponder =
          TransponderUtil.getDefaultTransponder(
              this, DefaultParameter.DefaultTransponderType.DEFAULT_TRANSPONDER_TYPE_MAINTP);
      mAutoSearchTitle.setText(R.string.full_search_advanced_title);
    } else {
      mDefaultTransponder =
          TransponderUtil.getDefaultTransponder(
              this, DefaultParameter.DefaultTransponderType.DEFAULT_TRANSPONDER_TYPE_AUTO);
    }
    mFrequencyEditText.setText("" + mDefaultTransponder.getFrequency() / 1000);
    mSymbolRateEditText.setText("" + mDefaultTransponder.getSymbolRate());

    switch (mDefaultTransponder.getModulation()) {
      case DefaultParameter.ModulationType.MODULATION_64QAM:
        mSpinner.setSelection(0);
        break;
      case DefaultParameter.ModulationType.MODULATION_128QAM:
        mSpinner.setSelection(1);
        break;
      case DefaultParameter.ModulationType.MODULATION_256QAM:
        mSpinner.setSelection(2);
        break;
      default:
        break;
    }

    mFrequencyEditText.setRange(
        DefaultParameter.SearchParameterRange.FREQUENCY_MIN,
        DefaultParameter.SearchParameterRange.FREQUENCY_MAX);
    mSymbolRateEditText.setRange(
        DefaultParameter.SearchParameterRange.SYMBOLRATE_MIN,
        DefaultParameter.SearchParameterRange.SYMBOLRATE_MAX);

    mFrequencyEditText.setOnInputDataErrorListener(
        new OnInputDataErrorListener() {

          public void onInputDataError(int errorType) {
            switch (errorType) {
              case MyEditText.INPUT_DATA_ERROR_TYPE_NULL:
                // 弹出对话框提示输入错误。
                //
                // SearchAdvancedSettingActivity.this.showDialog(DialogId.DIALOG_ALERT_FREQUENCY_NULL);
                AdapterViewSelectionUtil.showToast(
                    SearchAdvancedSettingActivity.this, R.string.frequency_null);
                mFrequencyEditText.setText("" + mDefaultTransponder.getFrequency() / 1000);
                break;

              case MyEditText.INPUT_DATA_ERROR_TYPE_OUT:
                //
                // SearchAdvancedSettingActivity.this.showDialog(DialogId.DIALOG_ALERT_FREQUENCY);
                AdapterViewSelectionUtil.showToast(
                    SearchAdvancedSettingActivity.this, R.string.frequency_out_of_range);
                mFrequencyEditText.setText("" + mDefaultTransponder.getFrequency() / 1000);
                break;

              case MyEditText.INPUT_DATA_ERROR_TYPE_NORMAL:
                break;
            }
          }
        });
    mSymbolRateEditText.setText("" + mDefaultTransponder.getSymbolRate());

    mSymbolRateEditText.setOnInputDataErrorListener(
        new OnInputDataErrorListener() {

          public void onInputDataError(int errorType) {
            switch (errorType) {
              case MyEditText.INPUT_DATA_ERROR_TYPE_NULL:
                AdapterViewSelectionUtil.showToast(
                    SearchAdvancedSettingActivity.this, R.string.symbol_rate_null);
                mSymbolRateEditText.setText("" + mDefaultTransponder.getSymbolRate());
                break;
              case MyEditText.INPUT_DATA_ERROR_TYPE_OUT:
                AdapterViewSelectionUtil.showToast(
                    SearchAdvancedSettingActivity.this, R.string.symbol_rate_out_of_range);
                mSymbolRateEditText.setText("" + mDefaultTransponder.getSymbolRate());
                break;
              case MyEditText.INPUT_DATA_ERROR_TYPE_NORMAL:
                break;
            }
          }
        });
  }