예제 #1
0
  @Override
  public void load(Plot plot) {
    slopeRG1.clearCheck();
    slopeRG2.clearCheck();
    slopeTV.setText(null);

    // String stringValue = plot.slope;
    // String stringValue = plot.slope == null ? null : Slope.valueOf(plot.slope).getDisplayName();
    String stringValue;
    try {
      stringValue = plot.slope == null ? null : Slope.valueOf(plot.slope).getDisplayName();
    } catch (IllegalArgumentException iAE) {
      stringValue = plot.slope;
      slopeTV.setText(stringValue);
      slopeTV.setVisibility(View.VISIBLE);
    }
    RadioButton rB = null;
    for (String slopeChoice : slopeChoices) {
      if (slopeChoice.equals(stringValue)) {
        rB = (RadioButton) slopeRG1.findViewWithTag(slopeChoice);
        if (rB == null) {
          rB = (RadioButton) slopeRG2.findViewWithTag(slopeChoice);
        }
        break;
      }
    }
    if (rB != null) rB.setChecked(true);

    // Waiting to add these here prevents Toast popping on load.  Still waiting to see if there are
    // side-effects.
    // slopeRG1.setOnCheckedChangeListener(slopeListener1);
    // slopeRG2.setOnCheckedChangeListener(slopeListener2);
  }
예제 #2
0
  /**
   * Updates the selected tool, and optionally notify listeners.
   *
   * @param tool selected tool.
   * @param notifyListeners true to notify listeners, false otherwise.
   */
  private void setTool(EditorTools tool, boolean notifyListeners) {
    if (mMissionProxy != null
        && mMissionProxy.getItems().size() > 0
        && tool != EditorTools.TRASH
        && tool != EditorTools.SELECTOR
        && tool != EditorTools.NONE) {

      MissionItemProxy lastMissionItem =
          mMissionProxy.getItems().get(mMissionProxy.getItems().size() - 1);
      switch (lastMissionItem.getMissionItem().getType()) {
        case LAND:
        case RETURN_TO_LAUNCH:
          tool = EditorTools.NONE;
          mEditorRadioGroup.clearCheck();
          Toast.makeText(
                  getActivity(), getString(R.string.editor_err_land_rtl_added), Toast.LENGTH_SHORT)
              .show();
          break;

        default:
          break;
      }
    }

    this.tool = tool;
    if (tool == EditorTools.NONE) {
      mEditorRadioGroup.clearCheck();
    }

    if (listener != null && notifyListeners) {
      listener.editorToolChanged(this.tool);
    }
  }
예제 #3
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_slope, container, false);
    slopeRG1 = (RadioGroup) root.findViewById(R.id.slopeRadioGroup1);
    slopeRG2 = (RadioGroup) root.findViewById(R.id.slopeRadioGroup2);
    slopeRG1.clearCheck(); // this is so we can start fresh, with no selection on both RadioGroups
    slopeRG2.clearCheck();
    // slopeRG1.setOnCheckedChangeListener(slopeListener1);
    // slopeRG2.setOnCheckedChangeListener(slopeListener2);

    for (int i = 0; i < slopeRG1.getChildCount(); i++) {
      // slopeChoices.add((String)slopeRG1.getChildAt(i).getTag());
      View v = slopeRG1.getChildAt(i);
      if (v instanceof RadioButton) {
        slopeChoices.add((String) v.getTag());
      }
    }
    for (int i = 0; i < slopeRG2.getChildCount(); i++) {
      // slopeChoices.add((String)slopeRG2.getChildAt(i).getTag());
      View v = slopeRG2.getChildAt(i);
      if (v instanceof RadioButton) {
        slopeChoices.add((String) v.getTag());
      }
    }

    Button clinometerB = (Button) root.findViewById(R.id.fragment_slope_clinometerButton);
    clinometerB.setOnClickListener(this);

    slopeTV = (TextView) root.findViewById(R.id.fragment_slope_clinometerResult);
    slopeTV.setVisibility(View.GONE);

    return root;
  }
예제 #4
0
 private void setSEIdx(RadioGroup gp, int status) {
   if (gp.getId() == mGpSE1.getId()) {
     switch (status) {
       case SE_MODE_STATUS_OFF:
         gp.check(R.id.NFC_SoftwareStack_Secure_Ele_SetMode_Ele1_OFF);
         break;
       case SE_MODE_STATUS_VIRTUAL:
         gp.check(R.id.NFC_SoftwareStack_Secure_Ele_SetMode_Ele1_Virtual);
         break;
       case SE_MODE_STATUS_WIRED:
         gp.check(R.id.NFC_SoftwareStack_Secure_Ele_SetMode_Ele1_Wired);
         break;
       default:
         gp.clearCheck();
         break;
     }
   } else {
     switch (status) {
       case SE_MODE_STATUS_OFF:
         gp.check(R.id.NFC_SoftwareStack_Secure_Ele_SetMode_Ele2_OFF);
         break;
       case SE_MODE_STATUS_VIRTUAL:
         gp.check(R.id.NFC_SoftwareStack_Secure_Ele_SetMode_Ele2_Virtual);
         break;
       case SE_MODE_STATUS_WIRED:
         gp.check(R.id.NFC_SoftwareStack_Secure_Ele_SetMode_Ele2_Wired);
         break;
       default:
         gp.clearCheck();
         break;
     }
   }
 }
예제 #5
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == 1) {
     slopeRG1.clearCheck();
     slopeRG2.clearCheck();
     // slopeTV.setText(data.getStringExtra("slope") + (char)176);
     slopeTV.setText(data.getStringExtra("slope"));
     slopeTV.setVisibility(View.VISIBLE);
     save(LandPKSApplication.getInstance().getPlot()); // ???
   }
 }
예제 #6
0
  @Override
  protected void resetResult() {
    super.resetResult();

    // banktransfer
    bankTransferNameEditText.setText("");
    ibanEdtiText.setText("");
    bicEditText.setText("");

    // transfer entry
    for (int i = 0; i < tranGroup.getChildCount(); i++) {
      RadioButton radioButton = (RadioButton) tranGroup.getChildAt(i);
      radioButton.setEnabled(true);
    }
    tranGroup.clearCheck();
    result = "";
    // sim
    simTopUpNameEdit.setText("");
    phoneNumberEdit.setText("");
    operatorText.setText("");
    // card
    beneficiaryNameEditText.setText("");
    cardNumberEditText.setText("");
    expandFocusResultChange("");
    account = null;
  }
예제 #7
0
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.wizard);
   wizard = (PageFlipView) findViewById(R.id.wizard_parent);
   // setup page 1
   // get ids and pointers to sync radio buttons
   syncGroup = (RadioGroup) findViewById(R.id.sync_group);
   syncWebDav = ((RadioButton) findViewById(R.id.sync_webdav)).getId();
   syncDropBox = ((RadioButton) findViewById(R.id.sync_dropbox)).getId();
   syncSdCard = ((RadioButton) findViewById(R.id.sync_sdcard)).getId();
   syncNull = ((RadioButton) findViewById(R.id.sync_null)).getId();
   syncSSH = ((RadioButton) findViewById(R.id.sync_ssh)).getId();
   syncGroup.clearCheck();
   syncGroup.setOnCheckedChangeListener(new Page1Listener());
   // setup dropbox
   Resources r = getResources();
   String key = r.getString(R.string.dropbox_consumer_key, "invalid");
   String secret = r.getString(R.string.dropbox_consumer_secret, "invalid");
   dropbox = new Dropbox(this, key, secret);
   // setup dropbox progress dialog
   progress = new ProgressDialog(this);
   progress.setMessage(getString(R.string.please_wait));
   progress.setTitle(getString(R.string.signing_in));
   // when wizard first starts can't go to next page
   wizard.setNavButtonStateOnPage(0, false, PageFlipView.FIRST_PAGE);
 }
예제 #8
0
  private void init(Context context, View contentview, String[] items) {
    /** 用数据初始化ui */
    radioGroup = (RadioGroup) contentview.findViewById(R.id.filter_layout);
    radioGroup.clearCheck();
    if (items == null) return;
    for (int i = 0; i < items.length; i++) {

      RadioButton radioButton =
          (RadioButton) LayoutInflater.from(context).inflate(R.layout.line_popupwindow_rbt, null);
      radioButton.setId(rbtIds[i]);
      radioButton.setText(items[i]);

      radioGroup.addView(radioButton, -1, radioGroup.getLayoutParams());

      if (items[i].equals(outCbx.getText())) {
        outCbx.setTag(i);
        radioButton.setChecked(true);
      }
    }
    radioGroup.setOnCheckedChangeListener(
        new RadioGroup.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            dismiss();
          }
        });
  }
예제 #9
0
 private void switchOff() {
   tv.setVisibility(View.GONE);
   rg.setVisibility(View.GONE);
   rg.clearCheck();
   img.setVisibility(View.GONE);
   swt.setChecked(false);
 }
예제 #10
0
  public void next() {
    boolean res;
    test();
    final quizdb quizc = new quizdb(qList.get(i));
    txtques.setText(quizc.getQues());
    opt1.setText(quizc.getOpt1());
    opt2.setText(quizc.getOpt2());
    opt3.setText(quizc.getOpt3());
    opt4.setText(quizc.getOpt4());

    i++;
    if (i >= qList.size()) {
      next.setText("Done");
      next.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {

              try {
                test();

                evaluate();
              } catch (Exception e) {
                Toast.makeText(getApplicationContext(), "Error" + e.getMessage(), Toast.LENGTH_LONG)
                    .show();
              }
            }
          });
    }

    rg.clearCheck();
  }
  @Override
  public void load(Plot plot) {
    crackedRG.clearCheck();
    saltRG.clearCheck();

    RadioButton rB = null;
    if (plot.surfaceCracking != null) {
      if (plot.surfaceCracking) {
        // rB = (RadioButton) crackedRG.findViewWithTag("true");
        rB =
            (RadioButton)
                crackedRG.findViewWithTag(
                    getString(R.string.special_soil_conditions_fragment_surface_cracked));
      } else {
        // rB = (RadioButton) crackedRG.findViewWithTag("false");
        rB =
            (RadioButton)
                crackedRG.findViewWithTag(
                    getString(R.string.special_soil_conditions_fragment_surface_not_cracked));
      }
    }
    if (rB != null) rB.setChecked(true);

    rB = null;
    if (plot.surfaceSalt != null) {
      if (plot.surfaceSalt) {
        // rB = (RadioButton) saltRG.findViewWithTag("true");
        rB =
            (RadioButton)
                saltRG.findViewWithTag(
                    getString(R.string.special_soil_conditions_fragment_surface_salt));
      } else {
        // rB = (RadioButton) saltRG.findViewWithTag("false");
        rB =
            (RadioButton)
                saltRG.findViewWithTag(
                    getString(R.string.special_soil_conditions_fragment_no_surface_salt));
      }
    }
    if (rB != null) rB.setChecked(true);

    // Waiting to add these here prevents Toast popping on load.  Still waiting to see if there are
    // side-effects.
    // crackedRG.setOnCheckedChangeListener(crackedRGListener);
    // saltRG.setOnCheckedChangeListener(saltRGListener);
  }
예제 #12
0
 private void UpdateQuest() {
   currentQuest++;
   nextQuestion.setEnabled(false);
   InitData();
   rg.clearCheck();
   setEnabledRadioButton(true);
   checkAns = false;
 }
예제 #13
0
  /** 初始显示第几个页面1/2/3 */
  private void switchSceneOninit() {
    // 选择界面
    Bundle choose = this.getIntent().getExtras();
    int tab = choose.getInt("TAB");
    // Log.d("spearhead", tab + "");
    switch (tab) {
      case 3:
        group.clearCheck();
        group.check(R.id.radio_button2);
        tabHost.setCurrentTabByTag(TAB_WARNING);
        break;

      default:
        group.clearCheck();
        group.check(R.id.radio_button0);
        tabHost.setCurrentTabByTag(TAB_MONITOR);
        break;
    }
  }
 private void newQuestion() {
   rg.clearCheck();
   partialPoints = POINTS_FOR_QUESTION; // Puntos parciales (al fallar se resta 2 puntos).
   test = testList.get((int) (Math.random() * (14 - 0)) + 0);
   // Mostrar pregunta y opciones.
   question.setText(test.getQuestion());
   for (int i = 0; i < NUMBER_OF_ANSWERS; i++) {
     respRadioButton[i].setText(test.getOption(i));
   }
 }
예제 #15
0
  /**
   * 显示第几个页面0/1/2
   *
   * @param tab
   */
  public static void switchScene(int tab) {
    switch (tab) {
      case 1:
        group.clearCheck();
        group.check(R.id.radio_button1);
        tabHost.setCurrentTabByTag(TAB_FIREWALL);
        break;
      case 2:
        group.clearCheck();
        group.check(R.id.radio_button2);
        tabHost.setCurrentTabByTag(TAB_WARNING);
        break;

      default:
        group.clearCheck();
        group.check(R.id.radio_button0);
        tabHost.setCurrentTabByTag(TAB_MONITOR);
        break;
    }
  }
예제 #16
0
 @Override
 public void onClick(View v) {
   if (v instanceof RadioButton) {
     if (v.getId() == mSelectedPlatformId) {
       mPlatforms.clearCheck();
       mSelectedPlatformId = -1;
     } else {
       mSelectedPlatformId = v.getId();
     }
   }
 }
예제 #17
0
 private void clearSelection(RadioGroup rG, OnCheckedChangeListener listener, boolean clearText) {
   rG.setOnCheckedChangeListener(
       null); // remove the listener before clearing so we don't throw that stackoverflow
              // exception(like Vladimir Volodin pointed out)
   rG.clearCheck(); // clear the second RadioGroup
   rG.setOnCheckedChangeListener(listener); // reset the listener
   if (clearText) {
     slopeTV.setText(null);
     slopeTV.setVisibility(View.GONE);
   }
 }
예제 #18
0
  private void setupButtons() {
    CheckBox cb = (CheckBox) findViewById(R.id.usefilterCB);
    cb.setChecked(settings.isFilterEnabled());
    cb.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            settings.useFilter(isChecked);
          }
        });

    RadioGroup rg = (RadioGroup) findViewById(R.id.filterType);
    String type = settings.filterType();
    rg.clearCheck();
    if (type.equals("0")) {
      ((RadioButton) findViewById(R.id.type0)).setChecked(true);
    } else {
      ((RadioButton) findViewById(R.id.type1)).setChecked(true);
    }
    rg.setOnCheckedChangeListener(
        new RadioGroup.OnCheckedChangeListener() {
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            switch (checkedId) {
              case R.id.type0:
                settings.filterType("0");
                break;
              case R.id.type1:
                settings.filterType("1");
                break;
              default:
                break;
            }
          }
        });

    Button add = (Button) findViewById(R.id.addButton);
    add.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            String num = ((EditText) findViewById(R.id.editNum)).getText().toString();
            //				if (num.length() != 10){
            //					Toast.makeText(FilterActivity.this, "Необходимо ввести
            // ДЕСЯТ�ЗНАЧНЫЙ номер телефона без кода страны.
            // Например: 9031234567", Toast.LENGTH_LONG).show();
            //					return;
            //				}

            settings.filterAdd(num);
            renderList();
          }
        });
  }
 private void CompruebaRespuesta() {
   if (mRbPressed.equals(mAnswers[mCurrentQuestion])) {
     showAnimationAnswer(true);
     if (mIsPlaying) {
       computeCorrectQuestion();
     }
     newRandomQuestion();
     updateQuestionText();
     mOptions.clearCheck();
   } else {
     showAnimationAnswer(false);
     computeIncorrectQuestion();
   }
 }
예제 #20
0
 public void onCheckedChanged(RadioGroup group, int checkedId) {
   rbTestType = (RadioButton) findViewById(checkedId);
   if (rbTestType != null) {
     if (rbTestType.isChecked()) {
       if (isAnyOfTestRunning) {
         if (rbTestType != rbExternalTest) {
           toast(Messages.TEST_ALRDY_RUNNING);
           rbTestTypeGroup.clearCheck();
           return;
         } else {
           if (!pref.isExternalTestRunning()) {
             toast(Messages.TEST_ALRDY_RUNNING);
             rbTestTypeGroup.clearCheck();
             return;
           }
         }
       }
       if (Constants.IS_FAILED_UPLOAD_RUNNING) {
         toast(Messages.FAILED_UPLOAD_ALRDY_RUNNING);
         rbTestTypeGroup.clearCheck();
         return;
       }
       if (rbTestType == rbDownloadConfigurationTest) {
         startDownloadConfig();
       } else if (rbTestType == rbManualConfigurationTest) {
         // showExistingList();
         Intent intent = new Intent(activity, TestListActivity.class);
         intent.putExtra(StringUtils.EXTRA_TEST_MODE, StringUtils.TEST_MODE_MANUAL);
         if (pref != null && pref.getValue(Preferences.KEY_IS_TEST_CONFIG_SET, false))
           pref.putValue(Preferences.KEY_IS_TEST_CONFIG_SET, false);
         showIntent(intent);
       } else if (rbTestType == rbExternalTest) {
         showActivity(ExternalTestActivity.class);
       }
     }
   }
 }
예제 #21
0
        @Override
        public void handleMessage(Message msg) {

          try {
            thrdDownload.interrupt();
          } catch (Exception e) {
          }

          rbTestTypeGroup.clearCheck();

          // ###################

          String sResponseCode = msg.getData().getString(StringUtils.CODE);
          String sResponseDesc = msg.getData().getString(StringUtils.DESC);

          if (sResponseCode.equals(ResponseCodes.SUCCESS)) {
            new AppAlert(activity, sResponseDesc) {
              public void okClickListener() {
                if (objTestConfig.getIsExternalTest()) {
                  L.debug("objTestConfig >>>>>>>:" + objTestConfig);
                  Intent intent = new Intent(activity, ExternalTestActivity.class);
                  intent.putExtra(StringUtils.EXTRA_TEST_MODE, StringUtils.TEST_MODE_MANUAL);
                  showIntent(intent);

                } else {
                  String sConfigFilePath =
                      activity
                          .getFileStreamPath(Constants.DOWNLOAD_CONFIG_FILENAME)
                          .getAbsolutePath();
                  debug("Config Path :: " + sConfigFilePath);

                  Intent intent = new Intent(activity, TestListActivity.class);
                  intent.putExtra(StringUtils.EXTRA_CONFIG_PATH, sConfigFilePath);
                  intent.putExtra(StringUtils.EXTRA_TEST_MODE, StringUtils.TEST_MODE_CONFIG);
                  showIntent(intent);
                }
                ;
              }
            };

          } else if (sResponseCode.equals(ResponseCodes.FAILURE)) {
            alert("Error while downloading...");
          } else {

            if (sResponseCode.equals(StringUtils.ERROR_CODE)) error(sResponseDesc);
            else new AppAlert(activity, sResponseCode, sResponseDesc);
          }
          hideLoading();
        }
예제 #22
0
파일: Home.java 프로젝트: anu70/Valentine
  public void send_rose(View view) {
    message = editText2.getText().toString();

    if (receiver == null) {
      Toast.makeText(getApplicationContext(), "enter valid name", Toast.LENGTH_SHORT).show();
    } else {
      if (radioGroup.getCheckedRadioButtonId() == -1) {
        Toast.makeText(getApplicationContext(), "Please Select a rose", Toast.LENGTH_SHORT).show();
      } else {
        functions.send(Home.this, user, receiver, red_rose, yellow_rose, anonymous, message);
      }

      radioGroup.clearCheck();
    }
    autoCompleteTextView.setText("");
    editText2.setText("");
  }
예제 #23
0
  private void initProblem() {
    right_answer = random();
    wrong_answer = chooseOtherThan(right_answer);

    choices.clear();
    choices.add(right_answer);
    choices.add(wrong_answer);
    Collections.shuffle(choices);

    radioGroup.clearCheck();

    choice1.setText(textFor(choices.get(0)));
    choice2.setText(textFor(choices.get(1)));

    continueButton.setVisibility(View.GONE);
    checkButton.setVisibility(View.VISIBLE);
    checkButton.setEnabled(false);
  }
예제 #24
0
  private void updateContent(int index) {
    final TextView question = (TextView) findViewById(R.id.question);
    RadioButton choice1 = (RadioButton) findViewById(R.id.choice1);
    RadioButton choice2 = (RadioButton) findViewById(R.id.choice2);
    RadioButton choice3 = (RadioButton) findViewById(R.id.choice3);
    RadioButton choice4 = (RadioButton) findViewById(R.id.choice4);

    class ImageHandler implements Html.ImageGetter {
      @Override
      public Drawable getDrawable(String source) {
        Drawable pics = null;
        try {
          pics = Drawable.createFromStream(getApplicationContext().getAssets().open(source), null);
          int width = question.getWidth();
          int height = pics.getIntrinsicHeight() * width / pics.getIntrinsicWidth();
          pics.setBounds(0, 0, width, height);
        } catch (IOException e) {
          e.printStackTrace();
        }
        return pics;
      }
    }

    // Set content view
    Soal soal = soals.get(index);
    question.setText(Html.fromHtml(soal.getQuestion(), new ImageHandler(), null));
    choice1.setText(Html.fromHtml(soal.getChoices().get(0), new ImageHandler(), null));
    choice2.setText(Html.fromHtml(soal.getChoices().get(1), new ImageHandler(), null));
    choice3.setText(Html.fromHtml(soal.getChoices().get(2), new ImageHandler(), null));
    choice4.setText(Html.fromHtml(soal.getChoices().get(3), new ImageHandler(), null));

    // Set checked radio
    Integer choice = opts[index];
    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup);
    while (!optionChecking.tryLock()) {}
    optionChecking.lock();
    if (choice != null) {
      radioGroup.check(radioGroup.getChildAt(choice).getId());
    } else {
      radioGroup.clearCheck();
    }
    optionChecking.unlock();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_radio_button_sample);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // ------------------------------------------------------------------------------------------
    /* Initialize Radio Group and attach click handler */
    radioGroup = (RadioGroup) findViewById(R.id.radioGroup);
    radioGroup.clearCheck();

    /* Attach CheckedChangeListener to radio group */
    radioGroup.setOnCheckedChangeListener(
        new RadioGroup.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            RadioButton rb = (RadioButton) group.findViewById(checkedId);
            if (null != rb && checkedId > -1) {
              Toast.makeText(RadioButtonSample.this, rb.getText(), Toast.LENGTH_SHORT).show();
            }
          }
        });
    // ------------------------------------------------------------------------------------------
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  }
예제 #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) throws NumberFormatException {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.credits_debits);

    /* Initialize Radio Groups and attach click handler */
    radioGroup1 = (RadioGroup) findViewById(R.id.radioGroup1);
    radioGroup1.clearCheck();
    radioGroup2 = (RadioGroup) findViewById(R.id.radioGroup2);
    radioGroup2.clearCheck();
    final RadioButton debit = (RadioButton) findViewById(R.id.debitRadioButton1);
    final RadioButton credit = (RadioButton) findViewById(R.id.creditRadioButton1);
    final RadioButton check = (RadioButton) findViewById(R.id.checkingRadioButton1);
    final RadioButton save = (RadioButton) findViewById(R.id.savingsRadioButton1);

    /* Attach CheckedChangeListener to radio group */
    radioGroup1.setOnCheckedChangeListener(
        new RadioGroup.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            RadioButton rb1 = (RadioButton) group.findViewById(checkedId);
            if (null != rb1 && checkedId > -1) {
              Toast.makeText(CreditsDebits.this, rb1.getText(), Toast.LENGTH_SHORT).show();
            }
            if (rb1.getId() == credit.getId()) {
              isdebit = 0;
              Log.i(LOGTAG, "rb1 credit");
            } else if (rb1.getId() == debit.getId()) {
              isdebit = 1;
              Log.i(LOGTAG, "rb1 debit");
            }
          }
        });

    radioGroup2.setOnCheckedChangeListener(
        new RadioGroup.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            RadioButton rb2 = (RadioButton) group.findViewById(checkedId);
            if (null != rb2 && checkedId > -1) {
              Toast.makeText(CreditsDebits.this, rb2.getText(), Toast.LENGTH_SHORT).show();
            }
            if (rb2.getId() == check.getId()) {
              ischecking = true;
              Log.i(LOGTAG, "rb2 checking");
            } else if (rb2.getId() == save.getId()) {
              ischecking = false;
              Log.i(LOGTAG, "rb2 saving");
            }
          }
        });

    // SPINNER FOR DROP DOWN CHOICE
    spinner1 = (Spinner) findViewById(R.id.type1Spinner);
    spinner1.setOnItemSelectedListener(this);

    // set up spinner
    ArrayAdapter<CharSequence> adapter1 =
        ArrayAdapter.createFromResource(
            this, R.array.type1Array, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    spinner1.setAdapter(adapter1);

    // EDIT TEXT FOR AMOUNT
    amount1Edit = (EditText) findViewById(R.id.amountEditText1);
    amount1 = (TextView) findViewById(R.id.amount1);

    submitBtn1 = (Button) findViewById(R.id.creditDebitSubmit);
    submitBtn1.setOnClickListener(this);
  }
예제 #27
0
 public void onClear(View v) {
   /* Clears all selected radio buttons to default */
   radioGroup1.clearCheck();
   radioGroup2.clearCheck();
 }
  @Override
  public void initShowDate(
      final ViewHolderUtil viewHolder, final Standard_CK_Table_Item t, int position) {
    viewHolder.setText(R.id.txt_item_description, t.getItem_description());

    if (t.getItem_repairType() != null && !t.getItem_repairType().equals("")) {
      if (t.getItem_repairType().equals("L")) {
        viewHolder.setText(R.id.txt_item_repairType, "限期整改");
        viewHolder.setTextColor(R.id.txt_item_repairType, Color.rgb(253, 113, 0));
        viewHolder.setText(R.id.txt_item_repairLimit, t.getItem_repairLimit());
        viewHolder.setTextColor(R.id.txt_item_repairLimit, Color.rgb(253, 113, 0));
      } else {
        viewHolder.setText(R.id.txt_item_repairType, "立即整改");
        viewHolder.setTextColor(R.id.txt_item_repairType, Color.RED);
        viewHolder.setText(R.id.txt_item_repairLimit, "无");
      }
    } else {
      viewHolder.setText(R.id.txt_item_repairLimit, "无");
      viewHolder.setText(R.id.txt_item_repairLimit, "无");
    }

    final RadioGroup rg_isok = (RadioGroup) viewHolder.getMconvertView().findViewById(R.id.rg_isok);
    final RadioButton rb_ck_stand_yes =
        (RadioButton) viewHolder.getMconvertView().findViewById(R.id.rb_ck_stand_yes);
    final RadioButton rb_ck_stand_no =
        (RadioButton) viewHolder.getMconvertView().findViewById(R.id.rb_ck_stand_no);
    rg_isok.setOnCheckedChangeListener(null);
    rg_isok.clearCheck();
    rb_ck_stand_yes.setTextColor(Color.parseColor("#FF7D899D"));
    rb_ck_stand_no.setTextColor(Color.parseColor("#FF7D899D"));

    viewHolder.setRadioButtonCkecked(R.id.rb_ck_stand_yes, false);
    viewHolder.setRadioButtonCkecked(R.id.rb_ck_stand_no, false);
    if (t.getItem_reviewResult() != null && !t.getItem_reviewResult().equals("")) {
      if (t.getItem_reviewResult().equals("YES")) {
        viewHolder.setRadioButtonCkecked(R.id.rb_ck_stand_yes, true);
        rb_ck_stand_yes.setTextColor(Color.parseColor("#28aae1"));
      } else {
        viewHolder.setRadioButtonCkecked(R.id.rb_ck_stand_no, true);
        rb_ck_stand_no.setTextColor(Color.parseColor("#28aae1"));
      }
    }

    RelativeLayout rel_standitem_measure = viewHolder.getView(R.id.rel_standitem_measure);
    rel_standitem_measure.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            AlertDialog.Builder builder = new AlertDialog.Builder(mContext); // 先得到构造器
            builder.setTitle("整改措施"); // 设置标题
            builder.setMessage(t.getItem_repairMethod()); // 设置内容
            builder.setIcon(R.drawable.note_stand48); // 设置图标,图片id即可
            builder.setNegativeButton(
                "取消",
                new DialogInterface.OnClickListener() { // 设置取消按钮
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                  }
                });
            // 参数都设置完成了,创建并显示出来
            builder.create().show();
          }
        });

    RelativeLayout rel_standitem_condition = viewHolder.getView(R.id.rel_standitem_condition);
    rel_standitem_condition.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            AlertDialog.Builder builder = new AlertDialog.Builder(mContext); // 先得到构造器
            builder.setTitle("整改情况"); // 设置标题
            builder.setMessage(t.getItem_repairCondition()); // 设置内容
            builder.setIcon(R.drawable.note_stand48); // 设置图标,图片id即可
            builder.setNegativeButton(
                "取消",
                new DialogInterface.OnClickListener() { // 设置取消按钮
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                  }
                });
            // 参数都设置完成了,创建并显示出来
            builder.create().show();
          }
        });

    rg_isok.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            int radioButtonId = group.getCheckedRadioButtonId();
            RadioButton rb = (RadioButton) viewHolder.getMconvertView().findViewById(radioButtonId);

            rb_ck_stand_yes.setTextColor(Color.parseColor("#FF7D899D"));
            rb_ck_stand_no.setTextColor(Color.parseColor("#FF7D899D"));

            rb.setTextColor(Color.parseColor("#28aae1"));

            if (mApcceptOpinionListener != null) {
              switch (radioButtonId) {
                case R.id.rb_ck_stand_yes:
                  mApcceptOpinionListener.setItenApcceptOpinion(t, true);
                  break;
                case R.id.rb_ck_stand_no:
                  mApcceptOpinionListener.setItenApcceptOpinion(t, false);
                  break;
                default:
                  break;
              }
            }
          }
        });
  }
예제 #29
0
 @Override
 public void clearAnswer() {
   mButtons.clearCheck();
   mAnswer = null;
 }
예제 #30
0
 /** 第一个页面切换到第三个页面的按钮 */
 public void tabThree() {
   group.clearCheck();
   group.check(R.id.radio_button2);
   tabHost.setCurrentTabByTag(TAB_WARNING);
 }