Esempio n. 1
0
  private void dibujarCheck() {

    contenido.removeAllViews();

    for (Modulo m : modulos) {
      TextView mTitulo = new TextView(this);
      mTitulo.setText(m.getName());
      mTitulo.setBackgroundColor(Color.parseColor("#226666"));
      mTitulo.setTextColor(Color.WHITE);
      mTitulo.setLayoutParams(
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
      mTitulo.setPadding(0, 6, 0, 6);
      mTitulo.setGravity(Gravity.CENTER_HORIZONTAL);
      contenido.addView(mTitulo);

      LinearLayout itemLayout = new LinearLayout(this);
      itemLayout.setLayoutParams(
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
      itemLayout.setBackgroundResource(R.drawable.fondo_1);
      itemLayout.setGravity(Gravity.CENTER_HORIZONTAL);
      itemLayout.setOrientation(LinearLayout.VERTICAL);
      itemLayout.setPadding(16, 5, 16, 5);

      for (cl.tdc.felipe.tdc.objects.Relevar.Item item : m.getItems()) {
        TextView iTitulo = new TextView(this);
        iTitulo.setText(item.getName());
        iTitulo.setBackgroundColor(Color.GREEN);
        iTitulo.setLayoutParams(
            new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        iTitulo.setPadding(0, 8, 0, 4);
        iTitulo.setGravity(Gravity.CENTER_HORIZONTAL);

        View vista = getView(m.getId(), item);
        if (vista == null) continue;

        itemLayout.addView(iTitulo);
        itemLayout.addView(vista);
        vistas.add(vista);
      }

      contenido.addView(itemLayout);
    }

    Button agregarFoto = new Button(this);
    agregarFoto.setText("Agregar Foto");
    agregarFoto.setBackgroundResource(R.drawable.custom_button_rounded_green);
    agregarFoto.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            imgTmp = new FormImage();
            imgTmp.setIdSystem(estaciones.get(station.getSelectedItemPosition()).getId());
            tomarFoto();
          }
        });
    contenido.addView(agregarFoto);
  }
Esempio n. 2
0
  public void onClick_enviar(View v) {
    for (Modulo m : modulos) {
      for (cl.tdc.felipe.tdc.objects.Relevar.Item item : m.getItems()) {
        if (item.getValor().equals("NO RESPONDE") || item.getValor().length() == 0) {
          Toast.makeText(this, "Debe responder el CheckList completo.", Toast.LENGTH_LONG).show();
          return;
        }
      }
    }

    UploadImage task = new UploadImage(this, v);
    task.execute();
  }
Esempio n. 3
0
  private void saveData() {

    reg.addValue("SELECT" + depto.getId(), depto.getSelectedItem().toString());
    reg.addValue("SELECT" + province.getId(), province.getSelectedItem().toString());
    reg.addValue("SELECT" + district.getId(), district.getSelectedItem().toString());
    reg.addValue("SELECT" + station.getId(), station.getSelectedItem().toString());

    for (Modulo m : modulos) {
      for (cl.tdc.felipe.tdc.objects.Relevar.Item i : m.getItems()) {
        View v = i.getVista();
        View c = i.getDescription();
        if (i.getCheckBoxes() != null) {
          for (int x = 0; x < i.getCheckBoxes().size(); x++) {
            CheckBox check = i.getCheckBoxes().get(x);
            reg.addValue("CHECK" + check.getId(), check.isChecked());
            if (x == 0)
              reg.addValue("COMMENTCHECK" + check.getId(), ((EditText) c).getText().toString());
          }
        }
        if (v instanceof Spinner) {
          reg.addValue("SELECT" + v.getId(), ((Spinner) v).getSelectedItem().toString());
          reg.addValue("COMMENTSELECT" + v.getId(), ((EditText) c).getText().toString());
        }
        if (v instanceof EditText) {
          reg.addValue("TEXT" + v.getId(), ((EditText) v).getText().toString());
          if (c != null)
            reg.addValue("COMMENTTEXT" + v.getId(), ((EditText) c).getText().toString());
        }
      }
    }

    for (FormImage img : imagenes) {
      if (img.getImage() != null) {
        String id1 = "FOTOBITMAP" + img.getIdSystem() + img.getIdSubSystem();
        String id2 = "FOTONAME" + img.getIdSystem() + img.getIdSubSystem();
        String id3 = "FOTOCOMMENT" + img.getIdSystem() + img.getIdSubSystem();

        reg.addValue(id1, Funciones.encodeTobase64(img.getImage()));
        reg.addValue(id2, img.getName());
        reg.addValue(id3, img.getComment());
      }
    }
  }