Beispiel #1
0
  public void populateListViewArticol(List<ArticolDB> listArticole) {

    CautareArticoleAdapter adapterArticole =
        new CautareArticoleAdapter(getActivity(), listArticole);
    listViewArticole.setAdapter(adapterArticole);
    ScreenUtils.hideSoftKeyboard(getActivity(), txtNumeArticol);
  }
Beispiel #2
0
  @SuppressWarnings("unchecked")
  private void performSaveSelectedArt() {

    try {

      if (codArticol.length() == 18) codArticol = codArticol.substring(10, 18);

      int nrArt = listArtSelClp.size(), ii = 0, selectedArtPos = -1;

      for (ii = 0; ii < nrArt; ii++) {
        artMap = (HashMap<String, String>) CLPFragment2.adapterListArtClp.getItem(ii);
        if (codArticol.equals(artMap.get("codArt"))) {
          selectedArtPos = ii;
          listArtSelClp.remove(ii);
          break;
        }
      }

      HashMap<String, String> temp;
      temp = new HashMap<String, String>(20, 0.75f);

      nf2.setMinimumFractionDigits(3);
      nf2.setMaximumFractionDigits(3);

      double greutateCantitate =
          greutateArticol.getGreutate()
              * Double.valueOf(textCantArt.getText().toString().trim())
              * factorConversie;

      Integer tokNrCrt = -1;

      if (selectedArtPos == -1) {
        selectedArtPos = listArtSelClp.size();
        tokNrCrt = listArtSelClp.size() + 1;
      } else {
        tokNrCrt = selectedArtPos + 1;
      }

      temp.put("nrCrt", String.valueOf(tokNrCrt) + ".");
      temp.put("numeArt", numeArticol);
      temp.put("codArt", codArticol);
      temp.put("cantArt", nf2.format(Double.valueOf(textCantArt.getText().toString().trim())));
      temp.put("Umb", selectedUnitMas);
      temp.put("depozit", globalDepozSel);
      temp.put("sintetic", sintetic);
      temp.put("greutate", nf2.format(greutateCantitate));
      temp.put("umgreutate", greutateArticol.getUnitMas().toString());
      temp.put("depart", depArtSel);

      listArtSelClp.add(selectedArtPos, temp);
      listArtCmdClp.setAdapter(adapterListArtClp);
      adapterListArtClp.notifyDataSetChanged();

      ScreenUtils.hideSoftKeyboard(getActivity(), txtNumeArticol);
      getTotalGreutate();

      clearVars();

    } catch (Exception ex) {
      Toast.makeText(getActivity(), ex.getMessage(), Toast.LENGTH_SHORT).show();
    }
  }