Esempio n. 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_test_ripple);

    final RippleView rippleView = (RippleView) findViewById(R.id.rect);
    final TextView textView = (TextView) findViewById(R.id.rect_child);

    rippleView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.e("Sample", "Click Rect !");
          }
        });
    textView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.e("Sample", "Click rect child !");
          }
        });

    sourcesArrayList.add("Samsung");
    sourcesArrayList.add("Android");
    sourcesArrayList.add("Google");
    sourcesArrayList.add("Asus");
    sourcesArrayList.add("Apple");
    sourcesArrayList.add("Samsung");
    sourcesArrayList.add("Android");
    sourcesArrayList.add("Google");
    sourcesArrayList.add("Asus");
    sourcesArrayList.add("Apple");
    sourcesArrayList.add("Samsung");
    sourcesArrayList.add("Android");
    sourcesArrayList.add("Google");
    sourcesArrayList.add("Asus");
    sourcesArrayList.add("Apple");

    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);

    CustomAdapter customAdapter = new CustomAdapter();
    customAdapter.updateList(sourcesArrayList);

    customAdapter.setOnTapListener(
        new OnTapListener() {
          @Override
          public void onTapView(int position) {
            Log.e("MainActivity", "Tap item : " + position);
          }
        });
    recyclerView.setAdapter(customAdapter);
  }
Esempio n. 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    pager = (ViewPager) findViewById(R.id.pager);

    indicator = (TabPageIndicator) findViewById(R.id.indicator);

    adapter = new CustomAdapter(this, pager, indicator);

    adapter.addTab(RandomStringFragment.class, null, "PAGE 1");
    adapter.addTab(TestFragment.class, null, "PAGE 2");
    adapter.addTab(TestFragment.class, null, "PAGE 3");

    adapter.update(0);
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
      Bundle extras = data.getExtras();
      Bitmap imageBitmap = (Bitmap) extras.get("data");
      mImageView = (ImageView) findViewById(R.id.imgView);

      // Saving in Parse server
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      imageBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
      byte[] dataTostore = stream.toByteArray();

      final ParseFile imgFile = new ParseFile("img.png", dataTostore);
      imgFile.saveInBackground();

      GalleryObj tempPicObj = new GalleryObj();
      ParseObject obj = new ParseObject("Gallery");

      obj.put("pic", imgFile);
      obj.put("Apartment", ParseUser.getCurrentUser().getString("Apartment"));
      try {
        obj.save();
        tempPicObj.id = obj.getObjectId();
        tempPicObj.pic = imageBitmap;
        STgallery.getInstance().add(tempPicObj);
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      adapter.notifyDataSetChanged();
    }
  }
  public void deleteCheckedItems() {
    int sizeAdapter = adapter.getCount();
    for (int i = sizeAdapter - 1; i >= 0; i--) {

      View view = gv.getChildAt(i);

      CheckBox cv = (CheckBox) view.findViewById(R.id.gallery_checkBox_item);
      if (cv.isChecked()) {
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Gallery");
        query.getInBackground(
            STgallery.getInstance().get(i).id,
            new GetCallback<ParseObject>() {
              public void done(ParseObject galleryPic, ParseException e) {
                if (e == null) {
                  // delete from server
                  try {
                    galleryPic.delete();
                  } catch (ParseException e1) {
                    e1.printStackTrace();
                  }
                  galleryPic.saveInBackground();
                } else {
                  Toast.makeText(
                          GalleryActivity.this,
                          getResources().getString(R.string.please_check_internet_connection),
                          Toast.LENGTH_LONG)
                      .show();
                  e.printStackTrace();
                }
              }
            });
        STgallery.getInstance().remove(i);
      }
      adapter.notifyDataSetChanged();
    }
    Toast.makeText(getApplicationContext(), "Selected Items Cleared", Toast.LENGTH_SHORT).show();
  }
Esempio n. 5
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;
  }
 @Override
 protected void onResume() {
   super.onResume();
   adapter.notifyDataSetChanged();
 }