コード例 #1
0
ファイル: ReportActivity.java プロジェクト: ipetty/i-bang
 @Override
 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   CheckBox checkbox = (CheckBox) buttonView;
   if (isChecked) {
     checkList.add(checkbox.getText().toString());
   } else {
     checkList.remove(checkbox.getText().toString());
   }
 }
コード例 #2
0
 public String getStringTag() {
   String text = "";
   if (cDeg.isChecked()) text += cDeg.getText() + "\n";
   if (cFuite.isChecked()) text += cFuite.getText() + "\n";
   if (cRecy.isChecked()) {
     text += cRecy.getText();
     if (spinner != null && spinner.getSelectedItemPosition() != 0)
       text += " : " + spinner.getSelectedItem().toString();
   }
   return text;
 }
コード例 #3
0
 public List<String> getTitleTag() {
   List<String> list = new ArrayList<String>();
   if (cDeg.isChecked()) list.add(cDeg.getText().toString());
   if (cFuite.isChecked()) list.add(cFuite.getText().toString());
   if (cRecy.isChecked()) {
     if (spinner != null && spinner.getSelectedItemPosition() != 0)
       list.add(cRecy.getText().toString() + " : " + spinner.getSelectedItem().toString());
     else list.add(cRecy.getText().toString());
   }
   return list;
 }
コード例 #4
0
  public void onCheckboxClicked(View view) {
    CheckBox checkboxRedd = (CheckBox) findViewById(R.id.checkboxRed);
    CheckBox checkboxBluee = (CheckBox) findViewById(R.id.checkboxBlue);
    CheckBox checkboxGreenn = (CheckBox) findViewById(R.id.checkboxGreen);
    CheckBox checkboxYelloww = (CheckBox) findViewById(R.id.checkboxYellow);
    CheckBox checkboxOrangee = (CheckBox) findViewById(R.id.checkboxOrange);
    CheckBox checkboxBlackk = (CheckBox) findViewById(R.id.checkboxBlack);
    CheckBox checkboxWhitee = (CheckBox) findViewById(R.id.checkboxWhite);
    CheckBox checkboxBrownn = (CheckBox) findViewById(R.id.checkboxBrown);
    CheckBox checkboxPurplee = (CheckBox) findViewById(R.id.checkboxPurple);

    StringBuilder sb = new StringBuilder();

    if (checkboxRedd.isChecked()) {
      sb.append(", " + checkboxRedd.getText());
    }

    if (checkboxBluee.isChecked()) {
      sb.append(", " + checkboxBluee.getText());
    }

    if (checkboxGreenn.isChecked()) {
      sb.append(", " + checkboxGreenn.getText());
    }

    if (checkboxYelloww.isChecked()) {
      sb.append(", " + checkboxYelloww.getText());
    }

    if (checkboxOrangee.isChecked()) {
      sb.append(", " + checkboxOrangee.getText());
    }

    if (checkboxBlackk.isChecked()) {
      sb.append(", " + checkboxBlackk.getText());
    }

    if (checkboxWhitee.isChecked()) {
      sb.append(", " + checkboxWhitee.getText());
    }

    if (checkboxBrownn.isChecked()) {
      sb.append(", " + checkboxBrownn.getText());
    }

    if (checkboxPurplee.isChecked()) {
      sb.append(", " + checkboxPurplee.getText());
    }

    if (sb.length() > 0) {
      colour = sb.deleteCharAt(sb.indexOf(",")).toString();
    } else {
      colour = "";
    }
  }
コード例 #5
0
        public void onClick(View v) {
          String message = "";

          if (mChkSephiroth.isChecked()) {
            message += mChkSephiroth.getText().toString() + "\n";
          }
          if (mChkKefka.isChecked()) {
            message += mChkKefka.getText().toString() + "\n";
          }
          if (mChkExdeath.isChecked()) {
            message += mChkExdeath.getText().toString();
          }
          Toast.makeText(v.getContext(), message, Toast.LENGTH_LONG).show();
        }
コード例 #6
0
 @Override
 public CheckBoxBean dehydrate(final CheckBox checkBox) {
   CheckBoxBean bean =
       new CheckBoxBean(
           checkBox.getText().toString(), checkBox.isEnabled(), checkBox.getVisibility());
   return bean;
 }
コード例 #7
0
 private String getOtherRequirements() {
   String result = null;
   if (haveMainMark.isChecked()) {
     result = haveMainMark.getText().toString() + "|";
   }
   if (haveTag.isChecked()) {
     result += haveTag.getText().toString() + "|";
   }
   if (haveWaterWash.isChecked()) {
     result += haveWaterWash.getText().toString() + "|";
   }
   if (other2.isChecked()) {
     result += otherEdit2.getText().toString();
   }
   return result;
 }
コード例 #8
0
 private String getSpecialData() {
   String result = null;
   if (waterWash.isChecked()) {
     result = waterWash.getText().toString() + "|";
   }
   if (laser.isChecked()) {
     result += laser.getText().toString() + "|";
   }
   if (push.isChecked()) {
     result += push.getText().toString() + "|";
   }
   if (other1.isChecked()) {
     result += otherEdit1.getText().toString();
   }
   return result;
 }
コード例 #9
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();
          }
        });
  }
コード例 #10
0
  @Test
  public void testStoreCheckedValueIntoChildJSONObject() throws JSONException {

    field.setOptionStrings(
        new HashMap<String, List<String>>() {
          {
            put("en", Arrays.asList("one", "two", "three"));
          }
        });
    view.initialize(field, child);

    CheckBox checkBox1 = checkCheckBoxAtIndex(0, true);
    JSONArray options = new JSONArray();
    options.put(checkBox1.getText());
    assertEquals(options.toString(), (child.get(field.getId())).toString());

    CheckBox checkBox2 = checkCheckBoxAtIndex(1, true);
    options.put(checkBox2.getText());
    assertEquals(options.toString(), child.get(field.getId()).toString());
  }
コード例 #11
0
  private ArrayList<String> getFileList() {
    ArrayList<String> files = new ArrayList<String>();

    int fileSize = fileListView.getChildCount();
    for (int i = 0; i < fileSize; i++) {
      CheckBox checkBox = (CheckBox) fileListView.getChildAt(i);
      if (checkBox.isChecked()) files.add(checkBox.getText().toString());
    }

    return files;
  }
コード例 #12
0
ファイル: BCheckBox1.java プロジェクト: zengyun2020/Git_code
 @Override
 public void onClick(View v) {
   if (v.getId() == R.id.box_con) {
     StringBuffer sb = new StringBuffer();
     for (CheckBox cb : cbs) {
       sb.append(cb.getText().toString() + " ±»Ñ¡ÖÐ:" + cb.isChecked() + "\n");
     }
     Toast.makeText(this, sb.toString(), Toast.LENGTH_SHORT).show();
   } else if (v.getId() == R.id.box_next) {
     this.startActivity(new Intent(this, BCheckBox2.class));
   }
 }
コード例 #13
0
  /**
   * Return the selected Own Majors.
   *
   * @return selected Majors
   */
  public MajorCriterion getOwnMajorCriterion() {
    MajorCriterion criterion = new MajorCriterion(getString(R.string.criteria_major), "");

    ArrayList<String> selMaj = new ArrayList<String>();
    for (CheckBox cb : majors) {
      if (cb.isChecked()) {
        MajorValues v = Enum.valueOf(MajorValues.class, cb.getText().toString());
        criterion.addValue(v);
      }
    }
    return criterion;
  }
コード例 #14
0
  @Test
  public void testCreateSingleCheckBox() {
    field.setOptionStrings(
        new HashMap<String, List<String>>() {
          {
            put("en", Arrays.asList("one"));
          }
        });
    view.initialize(field, child);

    CheckBox box = (CheckBox) view.getCheckBoxGroup().getChildAt(0);
    assertThat(box.getText().toString(), equalTo("one"));
    assertThat(box.isChecked(), equalTo(false));
  }
コード例 #15
0
ファイル: QUESTION.java プロジェクト: pgeorge27/tdc
  public String getAswer3G() {
    String Answer = "";

    if (idType.equals(Constantes.RADIO)) {
      RadioGroup rg = (RadioGroup) view;
      int id = rg.getCheckedRadioButtonId();
      if (id != -1) {
        RadioButton rb = (RadioButton) rg.findViewById(id);
        Answer = rb.getText().toString();
      } else Answer = "";
    }
    if (idType.equals(Constantes.CHECK)) {
      int count = 0;
      for (CheckBox c : checkBoxes) {

        if (c.isChecked()) {
          if (checkBoxes.indexOf(c) == 0) {
            Answer += c.getText().toString();
          } else {
            Answer += ";" + c.getText().toString();
          }
          count++;
        }
        if (count == 0) Answer = "";
      }
    }
    if (idType.equals(Constantes.TEXT) || idType.equals(Constantes.NUM)) {
      Answer = ((EditText) view).getText().toString();
    }

    if (idType.equals(Constantes.DATE)) {
      Answer = editTexts.get(0).getText().toString();
    }

    return Answer;
  }
コード例 #16
0
 /**
  * 获得多选注码
  *
  * @param check
  * @return
  */
 private String getCheckCode() {
   String betCode = "";
   for (CheckBox check : checks) {
     if (check.isChecked()) {
       betCode +=
           touzhuDialog.getBetCode(check.getText().toString())
               + "_"
               + PublicMethod.isTen(touzhuDialog.getBeishu())
               + "_"
               + oneAmt * 100
               + "_"
               + touzhuDialog.getZhushu(check.getId() + 2) * oneAmt * 100
               + "!";
     }
   }
   return betCode.substring(0, betCode.length() - 1);
 }
コード例 #17
0
ファイル: QUESTION.java プロジェクト: pgeorge27/tdc
  public String getAswerIDEN() {
    String Answer = "";

    if (idType.equals(Constantes.RADIO)) {
      RadioGroup rg = (RadioGroup) view;
      int id = rg.getCheckedRadioButtonId();
      if (id != -1) {
        RadioButton rb = (RadioButton) rg.findViewById(id);
        Answer = rb.getText().toString();
      } else Answer = "";
    }
    if (idType.equals(Constantes.CHECK)) {
      for (CheckBox c : checkBoxes) {
        if (c.isChecked()) Answer = c.getText().toString();
        else Answer = "";
      }
    }
    if (idType.equals(Constantes.TEXT) || idType.equals(Constantes.NUM)) {
      Answer = ((EditText) view).getText().toString();
    }

    return Answer;
  }
コード例 #18
0
  public boolean saveCurrentPyramid(Context context) {

    // get the views
    final CheckBox checkBoxOne = (CheckBox) findViewById(R.id.itemOneCheckBox);
    final CheckBox checkBoxTwo = (CheckBox) findViewById(R.id.itemTwoCheckBox);
    final CheckBox checkBoxThree = (CheckBox) findViewById(R.id.itemThreeCheckBox);
    final CheckBox checkBoxFour = (CheckBox) findViewById(R.id.itemFourCheckBox);
    final CheckBox checkBoxFive = (CheckBox) findViewById(R.id.itemFiveCheckBox);
    final CheckBox checkBoxSix = (CheckBox) findViewById(R.id.itemSixCheckBox);

    String nameOne = (String) checkBoxOne.getText();
    String nameTwo = (String) checkBoxTwo.getText();
    String nameThree = (String) checkBoxThree.getText();
    String nameFour = (String) checkBoxFour.getText();
    String nameFive = (String) checkBoxFive.getText();
    String nameSix = (String) checkBoxSix.getText();

    int checkOne = 0;
    int checkTwo = 0;
    int checkThree = 0;
    int checkFour = 0;
    int checkFive = 0;
    int checkSix = 0;

    if (checkBoxOne.isChecked()) {
      checkOne = 1;
    }
    if (checkBoxTwo.isChecked()) {
      checkTwo = 1;
    }
    if (checkBoxThree.isChecked()) {
      checkThree = 1;
    }
    if (checkBoxFour.isChecked()) {
      checkFour = 1;
    }
    if (checkBoxFive.isChecked()) {
      checkFive = 1;
    }
    if (checkBoxSix.isChecked()) {
      checkSix = 1;
    }

    // get the top name
    final TextView myTopName = (TextView) findViewById(R.id.TopItemCheckBox);
    String topTextName = (String) myTopName.getText();

    if (topTextName.equalsIgnoreCase("Hold To Edit")) {
      Toast.makeText(context, "Please Name The Top Block", Toast.LENGTH_LONG).show();
      return false;
    }

    Boolean updateIt = false;
    Cursor tempCursor = getPyramidCursorByName(topTextName);
    if (tempCursor.getCount() > 0) {
      updateIt = true;
    }

    SQLiteDatabase db = pyramidData.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(InventorySQLHelper.TOPBLOCK, topTextName);

    values.put(InventorySQLHelper.BLOCKONE, nameOne);
    values.put(InventorySQLHelper.BLOCKTWO, nameTwo);
    values.put(InventorySQLHelper.BLOCKTHREE, nameThree);
    values.put(InventorySQLHelper.BLOCKFOUR, nameFour);
    values.put(InventorySQLHelper.BLOCKFIVE, nameFive);
    values.put(InventorySQLHelper.BLOCKSIX, nameSix);

    values.put(InventorySQLHelper.CHECKEDONE, checkOne);
    values.put(InventorySQLHelper.CHECKEDTWO, checkTwo);
    values.put(InventorySQLHelper.CHECKEDTHREE, checkThree);
    values.put(InventorySQLHelper.CHECKEDFOUR, checkFour);
    values.put(InventorySQLHelper.CHECKEDFIVE, checkFive);
    values.put(InventorySQLHelper.CHECKEDSIX, checkSix);

    values.put(InventorySQLHelper.COLORTOP, colortop);

    values.put(InventorySQLHelper.COLORONE, color1);
    values.put(InventorySQLHelper.COLORTWO, color2);
    values.put(InventorySQLHelper.COLORTHREE, color3);
    values.put(InventorySQLHelper.COLORFOUR, color4);
    values.put(InventorySQLHelper.COLORFIVE, color5);
    values.put(InventorySQLHelper.COLORSIX, color6);

    Spinner spinner = (Spinner) findViewById(R.id.oldpyramids);

    if (updateIt == true) {
      long latestRowId =
          db.update(InventorySQLHelper.TABLE, values, "topblock = '" + topTextName + "'", null);
    } else {
      long latestRowId = db.insert(InventorySQLHelper.TABLE, null, values);
      m_adapterForSpinner.add(topTextName);
      spinner.setSelection(spinner.getCount() - 1);
    }
    db.close();

    spinner.setEnabled(true);

    Button deleteButton = (Button) findViewById(R.id.delete);
    deleteButton.setEnabled(true);
    return true;
  }
コード例 #19
0
  private void preencherCampos() {

    if (cadastroIndividualThrift != null) {

      for (int i = 0; i < estaGestanteRadio.getChildCount(); i++) {
        ((RadioButton) estaGestanteRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) estaGestanteRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusEhGestante()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      maternidadeReferenciaText.setText(
          cadastroIndividualThrift.getCondicoesDeSaude().getMaternidadeDeReferencia());

      final SharedPreferences sobrePeso =
          getActivity()
              .getSharedPreferences(DicionarioHelper.CONSIDERACAOPESO, Context.MODE_PRIVATE);

      for (int i = 0; i < sobrePesoRadio.getChildCount(); i++) {
        ((RadioButton) sobrePesoRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) sobrePesoRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        sobrePeso.getString(
                            String.valueOf(
                                cadastroIndividualThrift.getCondicoesDeSaude().getSituacaoPeso()),
                            ""))));
      }

      for (int i = 0; i < estaFumanteRadio.getChildCount(); i++) {
        ((RadioButton) estaFumanteRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) estaFumanteRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusEhFumante()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < usoAlcoolRadio.getChildCount(); i++) {
        ((RadioButton) usoAlcoolRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) usoAlcoolRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusEhDependenteAlcool()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < usoOutrasDrogasRadio.getChildCount(); i++) {
        ((RadioButton) usoOutrasDrogasRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) usoOutrasDrogasRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift
                                .getCondicoesDeSaude()
                                .isStatusEhDependenteOutrasDrogas()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < hipertensaoRadio.getChildCount(); i++) {
        ((RadioButton) hipertensaoRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) hipertensaoRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift
                                .getCondicoesDeSaude()
                                .isStatusTemHipertensaoArterial()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < diabetesRadio.getChildCount(); i++) {
        ((RadioButton) diabetesRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) diabetesRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusTemDiabetes()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      // for (int i = 0; i < doencaFalciformeRadio.getChildCount(); i++) {
      //    ((RadioButton) doencaFalciformeRadio.getChildAt(i)).setChecked((((RadioButton)
      // doencaFalciformeRadio.getChildAt(i)).getText().toString().equalsIgnoreCase(
      //            (cadastroIndividualThrift.getCondicoesDeSaude().isXXX() ?
      // getString(R.string.sim) : getString(R.string.nao)))));
      // }

      for (int i = 0; i < avcDerrameRadio.getChildCount(); i++) {
        ((RadioButton) avcDerrameRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) avcDerrameRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusTeveAvcDerrame()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < infartoRadio.getChildCount(); i++) {
        ((RadioButton) infartoRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) infartoRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusTeveInfarto()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < doencaCoracaoRadio.getChildCount(); i++) {
        ((RadioButton) doencaCoracaoRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) doencaCoracaoRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusTeveDoencaCardiaca()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      if (cadastroIndividualThrift.getCondicoesDeSaude().getDoencaCardiaca() == null)
        cadastroIndividualThrift.getCondicoesDeSaude().setDoencaCardiaca(new SoapList<Long>());

      final SharedPreferences doencaCardiaca =
          getActivity().getSharedPreferences(DicionarioHelper.DOENCACARDIACA, Context.MODE_PRIVATE);

      doencaCoracaoInsuficienciaCardiacaCheck.setChecked(
          cadastroIndividualThrift
              .getCondicoesDeSaude()
              .getDoencaCardiaca()
              .contains(
                  DicionarioHelper.findId(
                      doencaCardiaca,
                      doencaCoracaoInsuficienciaCardiacaCheck.getText().toString())));

      doencaCoracaoOutroCheck.setChecked(
          cadastroIndividualThrift
              .getCondicoesDeSaude()
              .getDoencaCardiaca()
              .contains(
                  DicionarioHelper.findId(
                      doencaCardiaca, doencaCoracaoOutroCheck.getText().toString())));

      doencaCoracaoNaoSabeCheck.setChecked(
          cadastroIndividualThrift
              .getCondicoesDeSaude()
              .getDoencaCardiaca()
              .contains(
                  DicionarioHelper.findId(
                      doencaCardiaca, doencaCoracaoNaoSabeCheck.getText().toString())));

      for (int i = 0; i < doencaRimRadio.getChildCount(); i++) {
        ((RadioButton) doencaRimRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) doencaRimRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusTemTeveDoencasRins()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      final SharedPreferences problemaRins =
          getActivity().getSharedPreferences(DicionarioHelper.PROBLEMARINS, Context.MODE_PRIVATE);

      if (cadastroIndividualThrift.getCondicoesDeSaude().getDoencaRins() == null)
        cadastroIndividualThrift.getCondicoesDeSaude().setDoencaRins(new SoapList<Long>());

      doencaRimInsuficienciaRenalCheck.setChecked(
          cadastroIndividualThrift
              .getCondicoesDeSaude()
              .getDoencaRins()
              .contains(
                  DicionarioHelper.findId(
                      problemaRins, doencaRimInsuficienciaRenalCheck.getText().toString())));

      doencaRimOutroCheck.setChecked(
          cadastroIndividualThrift
              .getCondicoesDeSaude()
              .getDoencaRins()
              .contains(
                  DicionarioHelper.findId(problemaRins, doencaRimOutroCheck.getText().toString())));

      doencaRimNaoSabeCheck.setChecked(
          cadastroIndividualThrift
              .getCondicoesDeSaude()
              .getDoencaRins()
              .contains(
                  DicionarioHelper.findId(
                      problemaRins, doencaRimNaoSabeCheck.getText().toString())));

      for (int i = 0; i < hanseniaseRadio.getChildCount(); i++) {
        ((RadioButton) hanseniaseRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) hanseniaseRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusTemHanseniase()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < tuberculoseRadio.getChildCount(); i++) {
        ((RadioButton) tuberculoseRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) tuberculoseRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusTemTuberculose()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < cancerRadio.getChildCount(); i++) {
        ((RadioButton) cancerRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) cancerRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusTemTeveCancer()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < intervencaoRadio.getChildCount(); i++) {
        ((RadioButton) intervencaoRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) intervencaoRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift
                                .getCondicoesDeSaude()
                                .isStatusTeveInternadoEm12Meses()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      intervencaoText.setText(
          cadastroIndividualThrift.getCondicoesDeSaude().getDescricaoCausaInternacaoEm12Meses());

      for (int i = 0; i < psiquiatraRadio.getChildCount(); i++) {
        ((RadioButton) psiquiatraRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) psiquiatraRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift
                                .getCondicoesDeSaude()
                                .isStatusTratamentoPsiquicoOuProblemaMental()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < acamadoRadio.getChildCount(); i++) {
        ((RadioButton) acamadoRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) acamadoRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusEstaAcamado()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < domiciliadoRadio.getChildCount(); i++) {
        ((RadioButton) domiciliadoRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) domiciliadoRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift.getCondicoesDeSaude().isStatusEstaDomiciliado()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      for (int i = 0; i < plantasMedicinaisRadio.getChildCount(); i++) {
        ((RadioButton) plantasMedicinaisRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) plantasMedicinaisRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift
                                .getCondicoesDeSaude()
                                .isStatusUsaPlantaMedicinais()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      plantasMedicinaisText.setText(
          cadastroIndividualThrift.getCondicoesDeSaude().getDescricaoPlantasMedicinaisUsadas());

      for (int i = 0; i < praticasIntegrativasRadio.getChildCount(); i++) {
        ((RadioButton) praticasIntegrativasRadio.getChildAt(i))
            .setChecked(
                (((RadioButton) praticasIntegrativasRadio.getChildAt(i))
                    .getText()
                    .toString()
                    .equalsIgnoreCase(
                        (cadastroIndividualThrift
                                .getCondicoesDeSaude()
                                .isStatusUsaOutrasPraticasIntegrativasOuComplementares()
                            ? getString(R.string.sim)
                            : getString(R.string.nao)))));
      }

      outraCondicaoSaude1Text.setText(
          cadastroIndividualThrift.getCondicoesDeSaude().getDescricaoOutraCondicao1());
      outraCondicaoSaude2Text.setText(
          cadastroIndividualThrift.getCondicoesDeSaude().getDescricaoOutraCondicao2());
      outraCondicaoSaude3Text.setText(
          cadastroIndividualThrift.getCondicoesDeSaude().getDescricaoOutraCondicao3());
    }
  }
コード例 #20
0
  public void next(View v) {
    availability = availability.substring(0, 16);
    int daysChecked = 0;
    for (int i = 0; i < days.size(); i++) {
      CheckBox box = days.get(i);
      if (box.isChecked()) {
        availability += "\"" + box.getText().toString() + "\",";
        daysChecked++;
      }
    }
    if (daysChecked == 0) {
      Toast.makeText(
              getApplicationContext(),
              "Please select at least one city and day",
              Toast.LENGTH_SHORT)
          .show();
      return;
    }
    availability = availability.substring(0, availability.length() - 1);
    availability += "]";

    // Log.i("WorkerDays", availability);
    if (action.equals("")) {
      Intent citiesIntent = new Intent(this, WorkerCitiesActivity.class);
      data.put(1, availability);
      citiesIntent.putExtra("data", data);
      startActivity(citiesIntent);
    } else {
      progress.show();
      String url = Constants.URLS.WORKER_DETAIL.string;
      JsonObjectRequest workerRequest;
      availability = "{" + availability;
      availability += "}";
      try {
        workerRequest =
            new JsonObjectRequest(
                Request.Method.PUT,
                url,
                new JSONObject(availability),
                new Response.Listener<JSONObject>() {
                  @Override
                  public void onResponse(JSONObject response) {
                    progress.dismiss();
                    finish();
                  }
                },
                new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                    Toast.makeText(
                            getApplicationContext(),
                            "Request error. Please try again",
                            Toast.LENGTH_SHORT)
                        .show();
                    progress.dismiss();
                  }
                }) {
              @Override
              public Map<String, String> getHeaders() throws AuthFailureError {
                HashMap<String, String> headers = new HashMap<>();
                headers.put(
                    "Authorization", "Token " + settings.getString(Constants.AUTH_TOKEN, ""));
                return headers;
              }
            };
      } catch (JSONException e) {
        Toast.makeText(this, "Request error. Please try again", Toast.LENGTH_SHORT).show();
        progress.dismiss();
        return;
      }

      Volley.newRequestQueue(getApplicationContext()).add(workerRequest);
    }
  }