Esempio n. 1
0
    @Override
    protected Integer doInBackground(BatchDataBean... batchData) {
      Log.d(BatchAsyncTask.class.toString(), "doInBackground...");
      WebConnection webConnection = ConnectionFacade.getWebConnection();
      this.batchData = batchData[0];

      Integer result = 0;
      try {
        List<DayRecord> listDays =
            webConnection.getListDaysAndActivitiesForMonthAndYear(
                this.batchData.getNumMonth(), this.batchData.getYear(), false);
        listDays = DayUtils.fillListDaysWithOnlyActivityDay(listDays, this.batchData);

        totalDays = listDays.size();
        BatchMenuActivity activity = (BatchMenuActivity) AppData.getCurrentActivity();
        activity.pDialog.setMax(totalDays);

        int processed = 0;
        for (DayRecord day : listDays) {
          webConnection.saveDayBatch(day, true);
          processed++;
          publishProgress(processed);
        }
        result = 1;
      } catch (ConnectionException e) {
        Log.e(LOGTAG, "Error en el proceso de imputación de mes", e);
        result = -1;
      }
      return result;
    }
Esempio n. 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(LOGTAG, "onCreate");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.batch_menu);
    AppData.setCurrentActivity(this);

    restoreFromChangeOrientation(savedInstanceState);

    List<String> listMonths = ConnectionFacade.getWebConnection().getMonths();
    List<String> listYears = ConnectionFacade.getWebConnection().getYears();
    List<String> listProjects = ConnectionFacade.getWebConnection().getArrayProjects();

    linkMonthSpinner(listMonths);
    linkYearsSpinner(listYears);
    linkProjectSpinner(listProjects);
    linkSubProjectSpinner((String) this.projectSpinner.getSelectedItem());
    linkTypeHourSpinner();
    taskEditText = (EditText) findViewById(R.id.batchTaskEditText);

    markTodayMonthYearSelected();
  }
Esempio n. 3
0
  private void linkSubProjectSpinner(String projectSelected) {
    List<String> subProjectArray = null;
    subProjectArray = ConnectionFacade.getWebConnection().getArraySubProjects(projectSelected);
    // Cargar el combo de subproyectos
    if (subProjectSpinner == null) {
      subProjectSpinner = (Spinner) findViewById(R.id.batchSubprojectSpinner);
    }
    ArrayAdapter<String> subProjectAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, subProjectArray);
    subProjectSpinner.setAdapter(subProjectAdapter);
    subProjectSpinner.setSelection(0);
    subProjectSpinner.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {}

          public void onNothingSelected(AdapterView<?> parent) {}
        });
  }