Search in sources :

Example 1 with MyAppointmentDataAdapter

use of com.jexapps.bloodhub.m_UI.MyAppointmentDataAdapter in project BloodHub by kazijehangir.

the class AppointmentsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = (View) inflater.inflate(R.layout.fragment_appointments, container, false);
    db = FirebaseDatabase.getInstance().getReference().child("appointments");
    appointments = new ArrayList<Appointment>();
    keys = new ArrayList<String>();
    fetchData();
    numAppointments = (TextView) rootView.findViewById(R.id.num_appointments);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.appointment_list_recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addItemDecoration(new RecycleMarginDecoration(getActivity()));
    mAdapter = new MyAppointmentDataAdapter(appointments, keys);
    mRecyclerView.setAdapter(mAdapter);
    return rootView;
}
Also used : Appointment(com.jexapps.bloodhub.m_Model.Appointment) MyAppointmentDataAdapter(com.jexapps.bloodhub.m_UI.MyAppointmentDataAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 TextView (android.widget.TextView)1 Appointment (com.jexapps.bloodhub.m_Model.Appointment)1 MyAppointmentDataAdapter (com.jexapps.bloodhub.m_UI.MyAppointmentDataAdapter)1