@Override
  public View getDropDownView(
      int position,
      View convertView,
      ViewGroup parent) { // This view starts when we click the spinner.
    View row = convertView;
    if (row == null) {
      LayoutInflater inflater = context.getLayoutInflater();
      row = inflater.inflate(R.layout.spinner_row_my_children, parent, false);
    }

    PatientChildData item = spinnerItems.get(position);

    if (item != null) { // Parse the data from each object and set it.
      TextView myChildName = (TextView) row.findViewById(R.id.spinnerTxtTitle);
      ImageView patientPhoto = (ImageView) row.findViewById(R.id.patientPhoto);

      if (myChildName != null) myChildName.setText(item.getFirtname() + " " + item.getLastname());

      byte[] childPhotoData = item.getPatientphoto();

      if (childPhotoData != null) {
        Log.d("ROBERT BTE", childPhotoData.length + "");
        Bitmap bMap = BitmapFactory.decodeByteArray(childPhotoData, 0, childPhotoData.length);
        patientPhoto.setBackground(Utils.resizedBitmapDisplayPatientQueue(context, bMap));
      }
    }

    return row;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    PatientChildData current = spinnerItems.get(position);

    LayoutInflater inflater = context.getLayoutInflater();
    View row = inflater.inflate(R.layout.spinner_row_my_children_photo, parent, false);
    ImageView patientPhoto = (ImageView) row.findViewById(R.id.patientPhoto);

    byte[] childPhotoData = current.getPatientphoto();

    if (childPhotoData != null) {
      Bitmap bMap = BitmapFactory.decodeByteArray(childPhotoData, 0, childPhotoData.length);
      patientPhoto.setBackground(Utils.resizedBitmapDisplayPatientQueue(context, bMap));
    }

    return row;
  }
Exemple #3
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup myFragmentView =
        (ViewGroup) inflater.inflate(R.layout.fragment_patient_information, container, false);

    CustomTextView lblAllergyRiskNotes =
        (CustomTextView) myFragmentView.findViewById(R.id.lblAllergyRiskNotes);
    lblAllergyRiskNotes.setText(Html.fromHtml(getString(R.string.lblAllergyRiskNotes)));
    Linkify.addLinks(lblAllergyRiskNotes, Linkify.WEB_URLS);

    imgPatientPhoto = (ImageView) myFragmentView.findViewById(R.id.patient_photo);
    etPatientsFName = (CustomEditTextView) myFragmentView.findViewById(R.id.etPatientsFName);
    etPatientsMName = (CustomEditTextView) myFragmentView.findViewById(R.id.etPatientsMName);
    etPatientsLName = (CustomEditTextView) myFragmentView.findViewById(R.id.etPatientsLName);
    etIWasBornDate = (CustomEditTextView) myFragmentView.findViewById(R.id.etIWasBornDate);
    etBornAt = (CustomEditTextView) myFragmentView.findViewById(R.id.etBornAt);
    etIWasDeliveredBy = (CustomEditTextView) myFragmentView.findViewById(R.id.etIWasDeliveredBy);
    etWhenIWasBornIWeighed =
        (CustomEditTextView) myFragmentView.findViewById(R.id.etWhenIWasBornIWeighed);
    etAndIMeasured = (CustomEditTextView) myFragmentView.findViewById(R.id.etAndIMeasured);
    etGrowthTrackerHead =
        (CustomEditTextView) myFragmentView.findViewById(R.id.etGrowthTrackerHead);
    etGrowthTrackerChest =
        (CustomEditTextView) myFragmentView.findViewById(R.id.etGrowthTrackerChest);
    etGrowthTrackerAbdomen =
        (CustomEditTextView) myFragmentView.findViewById(R.id.etGrowthTrackerAbdomen);
    etCircumcisedOn = (CustomEditTextView) myFragmentView.findViewById(R.id.etCircumcisedOn);
    etEarsPiercedOn = (CustomEditTextView) myFragmentView.findViewById(R.id.etEarsPiercedOn);
    etDistinguishingMarks =
        (CustomEditTextView) myFragmentView.findViewById(R.id.etDistinguishingMarks);
    etNewBornScreening = (CustomEditTextView) myFragmentView.findViewById(R.id.etNewBornScreening);
    etVaccinationsGiven =
        (CustomEditTextView) myFragmentView.findViewById(R.id.etVaccinationsGiven);
    etMomFName = (CustomEditTextView) myFragmentView.findViewById(R.id.etMomFName);
    etMomMName = (CustomEditTextView) myFragmentView.findViewById(R.id.etMomMName);
    etMomLName = (CustomEditTextView) myFragmentView.findViewById(R.id.etMomLName);
    etSheWorksAt = (CustomEditTextView) myFragmentView.findViewById(R.id.etSheWorksAt);
    etSheWorksAtAs = (CustomEditTextView) myFragmentView.findViewById(R.id.etSheWorksAtAs);
    etHerHMOIs = (CustomEditTextView) myFragmentView.findViewById(R.id.etHerHMOIs);
    etDadFName = (CustomEditTextView) myFragmentView.findViewById(R.id.etDadFName);
    etDadMName = (CustomEditTextView) myFragmentView.findViewById(R.id.etDadMName);
    etDadLName = (CustomEditTextView) myFragmentView.findViewById(R.id.etDadLName);
    etHeWorksAt = (CustomEditTextView) myFragmentView.findViewById(R.id.etHeWorksAt);
    etHeWorksAtAs = (CustomEditTextView) myFragmentView.findViewById(R.id.etHeWorksAtAs);
    etHisHMOIs = (CustomEditTextView) myFragmentView.findViewById(R.id.etHisHMOIs);
    etILiveAtAddress1 = (CustomEditTextView) myFragmentView.findViewById(R.id.etILiveAtAddress1);
    etILiveAtAddress2 = (CustomEditTextView) myFragmentView.findViewById(R.id.etILiveAtAddress2);

    spinnerMyMomGaveBirthToMeThrough =
        (Spinner) myFragmentView.findViewById(R.id.spinnerMyMomGaveBirthToMeThrough);
    CustomAdapter adapterMyMomGaveBirthToMeThrough =
        new CustomAdapter(
            getActivity(),
            android.R.layout.simple_spinner_item,
            ICareApplication.populateTypeOfDelivery());
    spinnerMyMomGaveBirthToMeThrough.setAdapter(adapterMyMomGaveBirthToMeThrough);

    spinnerAllergyRisk = (Spinner) myFragmentView.findViewById(R.id.spinnerAllergyRisk);
    CustomAdapter adapterAllergyRisk =
        new CustomAdapter(
            getActivity(),
            android.R.layout.simple_spinner_item,
            ICareApplication.populateAllergyRisk());
    spinnerAllergyRisk.setAdapter(adapterAllergyRisk);
    //         Log.d("mParamPatientData.getPatientphoto().length",
    // ""+mParamPatientData.getPatientphoto().length);
    if (mParamMyPicture != null) {
      Bitmap bMap = BitmapFactory.decodeByteArray(mParamMyPicture, 0, mParamMyPicture.length);
      imgPatientPhoto.setBackground(Utils.resizedBitmapDisplay(getActivity(), bMap));
    }

    etPatientsFName.setText(mParamPatientData.getFirtname());
    etPatientsMName.setText(mParamPatientData.getMiddlename());
    etPatientsLName.setText(mParamPatientData.getLastname());

    etIWasBornDate.setText(mParamPatientData.getbDate());
    etBornAt.setText(mParamPatientData.getbPlace());
    etIWasDeliveredBy.setText(mParamPatientData.getDrName());

    // Set Selection Delivery Type
    int spinnerPosition =
        adapterMyMomGaveBirthToMeThrough.getPosition(mParamPatientData.getDeliveryType());
    spinnerMyMomGaveBirthToMeThrough.setSelection(spinnerPosition);

    etWhenIWasBornIWeighed.setText(mParamPatientData.getpWeight());
    etAndIMeasured.setText(mParamPatientData.getpHeight());
    etGrowthTrackerHead.setText(mParamPatientData.getpHead());
    etGrowthTrackerChest.setText(mParamPatientData.getpChest());
    etGrowthTrackerAbdomen.setText(mParamPatientData.getpAbdomen());

    // Set Selection Delivery Type
    int spinnerPositionAllergy = adapterAllergyRisk.getPosition(mParamPatientData.getAllergyRisk());
    spinnerAllergyRisk.setSelection(spinnerPositionAllergy);

    etCircumcisedOn.setText(mParamPatientData.getpCircumcisedOn());
    etEarsPiercedOn.setText(mParamPatientData.getpEarPiercedOn());
    etDistinguishingMarks.setText(mParamPatientData.getpDistinguishingMarks());

    etNewBornScreening.setText(mParamPatientData.getpNewbornScreening());
    etVaccinationsGiven.setText(mParamPatientData.getpVaccinationsGiven());

    etMomFName.setText(mParamPatientData.getpMomsFname());
    etMomMName.setText(mParamPatientData.getpMomsMname());
    etMomLName.setText(mParamPatientData.getpMomsLname());
    etSheWorksAt.setText(mParamPatientData.getpMomsWorkPlace());
    etSheWorksAtAs.setText(mParamPatientData.getpMomsWorkAs());
    etHerHMOIs.setText(mParamPatientData.getpMomsHMO());

    etDadFName.setText(mParamPatientData.getpDadsFname());
    etDadMName.setText(mParamPatientData.getpDadsMname());
    etDadLName.setText(mParamPatientData.getpDadsLname());
    etHeWorksAt.setText(mParamPatientData.getpDadsWorkPlace());
    etHeWorksAtAs.setText(mParamPatientData.getpDadsWorkAs());
    etHisHMOIs.setText(mParamPatientData.getpDadsHMO());

    etILiveAtAddress1.setText(mParamPatientData.getpAddress1());
    etILiveAtAddress2.setText(mParamPatientData.getpAddress2());

    return myFragmentView;
  }