Ejemplo n.º 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.wizard_enter_drug_details);

    try {
      this.wizardData = WizardData.getData(getIntent().getExtras());
    } catch (Exception e) {
      Log.d(LOG_TAG, "No data found in intent.");
    }

    drug = (Drug) wizardData.get(WizardData.DRUG);
    patient = (Patient) wizardData.get(WizardData.PATIENT);

    // Print out what the information received so far is:
    Log.d(LOG_TAG, "Drug info: Name : " + drug.getBrandName());
    Log.d(LOG_TAG, "Drug info: Form : " + drug.getForm());
    Log.d(LOG_TAG, "Drug info: Type : " + drug.getType().toString());

    Log.d(LOG_TAG, "Patient info: First Name : " + patient.getFirstName());
    Log.d(LOG_TAG, "Patient info: Last : " + patient.getLastName());

    Spinner spinner = (Spinner) this.findViewById(R.id.wizard_enter_drug_details_spinner);
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            this, R.array.drug_form_label_array, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);

    /**
     * Order of array Pills - 0 mL - 1 mg - 2 oz - 3 Tablespoons - 4 other - 5
     *
     * <p>Taken from strings.xml (drug label array)
     */
    if (drug.getForm().equals(Drug.FORM.CAPSULES) || drug.getForm().equals(Drug.FORM.TABLETS)) {
      spinner.setSelection(0);
    } else if (drug.getForm().equals(Drug.FORM.LIQUIDS)) spinner.setSelection(4);
    else spinner.setSelection(5);

    Button next = (Button) this.findViewById(R.id.button_enter_drug_details_next);
    next.setOnClickListener(this);

    sizeOneDose = (TextView) this.findViewById(R.id.wizard_enter_drug_details_dose_size);
    totalQuantity = (TextView) this.findViewById(R.id.wizard_enter_drug_details_total_quantity);
  }
Ejemplo n.º 2
0
  public void rescan() {
    rescanButton.setEnabled(false);

    // get the shared data structure
    WizardData data = this.getWizardData();

    if (data != null) {
      // get the Project
      TProject dummy = (TProject) data.getData();

      // project data
      TProjectData pdat = dummy.getProjectData();

      // base file specified ?
      String base = getBaseFileName();
      if (base != null) {
        if (base.length() > 0) {
          File workFile;

          // !!! working directory and directory of basefile could be not equal !!!!
          if (baseFile != null) {
            workFile = baseFile;
          } else {
            workFile = new File(dummy.getWorkingDirectory(), base);
          }

          pdat.collect(workFile);
          rescanButton.setEnabled(true);
        }
      }
      /*
            else  // no base file -> delete all files in table
            {
              TLanguageList lList = pdat.getAvailableLangs() ;
              lList.clear();
            }
      */
      // update the visible components
      updateProjectData();
    }
  }