Search in sources :

Example 6 with Patient

use of com.hci.carebase.domain.Patient in project Carebase by robertsimoes.

the class DebugFragment method onPatientUpdate.

@OnClick(R.id.debug_but_patient_update)
public void onPatientUpdate(View v) {
    final String newLName = patientLName.getText().toString();
    final String newFName = patientFName.getText().toString();
    final String newHNum = patientHnum.getText().toString();
    final String id = patientGet.getText().toString();
    provider.getPatient(id, new ValueEventListener() {

        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            Patient p = dataSnapshot.getValue(Patient.class);
            p.setFirstName(newFName);
            p.setLastName(newLName);
            p.setHealthCardNumber(newHNum);
            provider.updatePatient(id, p, new OnCompleteListener<Void>() {

                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    results.setText("Updated! ");
                    Toast.makeText(getContext(), "Updated", Toast.LENGTH_LONG).show();
                }
            });
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
        }
    });
}
Also used : OnCompleteListener(com.google.android.gms.tasks.OnCompleteListener) Task(com.google.android.gms.tasks.Task) DatabaseError(com.google.firebase.database.DatabaseError) NonNull(android.support.annotation.NonNull) Patient(com.hci.carebase.domain.Patient) ValueEventListener(com.google.firebase.database.ValueEventListener) DataSnapshot(com.google.firebase.database.DataSnapshot) OnClick(butterknife.OnClick)

Example 7 with Patient

use of com.hci.carebase.domain.Patient in project Carebase by robertsimoes.

the class RxFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_rx, container, false);
    ButterKnife.bind(this, view);
    final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    if (getArguments() == null) {
        tvNoContents.setVisibility(View.VISIBLE);
    } else {
        Patient p = (Patient) getArguments().getSerializable(Const.BUNDLE_KEY_PATIENT);
        if (p.getScripts() == null || p.getScripts().isEmpty()) {
            tvNoContents.setVisibility(View.VISIBLE);
        } else {
            ArrayList data = p.getScripts();
            listAdapter = new ListAdapter(data);
            recyclerView.setAdapter(listAdapter);
        }
    }
    return view;
}
Also used : ArrayList(java.util.ArrayList) Patient(com.hci.carebase.domain.Patient) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Aggregations

Patient (com.hci.carebase.domain.Patient)7 OnClick (butterknife.OnClick)4 DataSnapshot (com.google.firebase.database.DataSnapshot)3 DatabaseError (com.google.firebase.database.DatabaseError)3 ValueEventListener (com.google.firebase.database.ValueEventListener)3 Intent (android.content.Intent)2 NonNull (android.support.annotation.NonNull)2 Bundle (android.os.Bundle)1 Nullable (android.support.annotation.Nullable)1 BottomNavigationView (android.support.design.widget.BottomNavigationView)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Toolbar (android.support.v7.widget.Toolbar)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 OnCompleteListener (com.google.android.gms.tasks.OnCompleteListener)1 Task (com.google.android.gms.tasks.Task)1 LocalCacheDb (com.hci.carebase.data.datasource.LocalCacheDb)1