Search in sources :

Example 1 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project MaterialViewPager by florent37.

the class RecyclerViewFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    final List<Object> items = new ArrayList<>();
    for (int i = 0; i < ITEM_COUNT; ++i) {
        items.add(new Object());
    }
    if (GRID_LAYOUT) {
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    } else {
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    }
    mRecyclerView.setHasFixedSize(true);
    //Use this now
    mRecyclerView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
    mRecyclerView.setAdapter(new TestRecyclerViewAdapter(items));
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TestRecyclerViewAdapter(com.github.florent37.materialviewpager.sample.TestRecyclerViewAdapter) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 2 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project easy by MehdiBenmesa.

the class RecyclerViewFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    final List<Object> items = new ArrayList<>();
    for (int i = 0; i < ITEM_COUNT; ++i) {
        items.add(new Object());
    }
    if (GRID_LAYOUT) {
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    } else {
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    }
    mRecyclerView.setHasFixedSize(true);
    //Use this now
    mRecyclerView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
    mRecyclerView.setAdapter(new TestRecyclerViewAdapter(items));
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TestRecyclerViewAdapter(com.github.florent37.materialviewpager.sample.TestRecyclerViewAdapter) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 3 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project easy by MehdiBenmesa.

the class RendezVousFragment method getRendeVousByManager.

private void getRendeVousByManager() {
    CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_RDV_BY_TEACHER, null, new Response.Listener<JSONArray>() {

        @Override
        public void onResponse(JSONArray response) {
            if (GRID_LAYOUT) {
                recyclerViewRendeVous.setLayoutManager(new GridLayoutManager(getActivity(), 2));
            } else {
                recyclerViewRendeVous.setLayoutManager(new LinearLayoutManager(getActivity()));
            }
            recyclerViewRendeVous.setHasFixedSize(true);
            //Use this now
            recyclerViewRendeVous.addItemDecoration(new MaterialViewPagerHeaderDecorator());
        //recyclerViewRendeVous.setAdapter(new TeachersAdapter(response,(TeachersAdapter.AdapterInterface) RendezVousActivity.this));
        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
        }
    });
    App.getInstance().addToRequestQueue(jsonReq);
}
Also used : Response(com.android.volley.Response) VolleyError(com.android.volley.VolleyError) CustomRequestArray(dz.easy.androidclient.Util.CustomRequestArray) GridLayoutManager(android.support.v7.widget.GridLayoutManager) JSONArray(org.json.JSONArray) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 4 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project easy by MehdiBenmesa.

the class ModuleFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    mReceiver = new DataReceiver(new Handler());
    mReceiver.setReceiver(this);
    if (GRID_LAYOUT) {
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    } else {
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    }
    mRecyclerView.setHasFixedSize(true);
    //Use this now
    mRecyclerView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
    try {
        if (user.getString("_type").equals("Teacher")) {
            ModuleService.getModulesByTeacher(getContext(), mReceiver);
        } else if (user.getString("_type").equals("Manager")) {
            ModuleService.getTeachers(getContext(), mReceiver);
        } else if (user.getString("_type").equals("Student")) {
            ModuleService.getModulesByStudent(getContext(), mReceiver);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) Handler(android.os.Handler) JSONException(org.json.JSONException) DataReceiver(dz.easy.androidclient.Services.DataReceiver) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 5 with MaterialViewPagerHeaderDecorator

use of com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator in project easy by MehdiBenmesa.

the class AbsenceFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    mReceiver = new DataReceiver(new Handler());
    mReceiver.setReceiver(this);
    if (GRID_LAYOUT) {
        mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    } else {
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    }
    mRecyclerView.setHasFixedSize(true);
    //Use this now
    mRecyclerView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
    AbsenceService.getAbsenceByStudentByModule(getContext(), mReceiver, moduleID);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) Handler(android.os.Handler) DataReceiver(dz.easy.androidclient.Services.DataReceiver) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)14 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)14 MaterialViewPagerHeaderDecorator (com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)14 JSONException (org.json.JSONException)7 Response (com.android.volley.Response)6 VolleyError (com.android.volley.VolleyError)6 CustomRequestArray (dz.easy.androidclient.Util.CustomRequestArray)6 JSONArray (org.json.JSONArray)6 Handler (android.os.Handler)4 DataReceiver (dz.easy.androidclient.Services.DataReceiver)4 TestRecyclerViewAdapter (com.github.florent37.materialviewpager.sample.TestRecyclerViewAdapter)2 TeachersAdapter (dz.easy.androidclient.Adapters.TeachersAdapter)2 ArrayList (java.util.ArrayList)2 JSONObject (org.json.JSONObject)2 NoteAdapter (dz.easy.androidclient.Adapters.NoteAdapter)1 RendezVousStatesAdapter (dz.easy.androidclient.Adapters.RendezVousStatesAdapter)1 TimeTableManagerAdapter (dz.easy.androidclient.Adapters.TimeTableManagerAdapter)1 TimeTableStudentAdapter (dz.easy.androidclient.Adapters.TimeTableStudentAdapter)1 TimeTableTeacherAdapter (dz.easy.androidclient.Adapters.TimeTableTeacherAdapter)1