Search in sources :

Example 11 with MaterialViewPagerHeaderDecorator

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

the class RendeVousFragment method getTeachers.

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

        @Override
        public void onResponse(JSONArray response) {
            JSONArray teachers = response;
            if (GRID_LAYOUT) {
                lstView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
            } else {
                lstView.setLayoutManager(new LinearLayoutManager(getActivity()));
            }
            lstView.setHasFixedSize(true);
            //Use this now
            lstView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
        //lstView.setAdapter(new TeachersAdapter(teachers));
        }
    }, 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 12 with MaterialViewPagerHeaderDecorator

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

the class NoteFragment 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());
    getNoteByStudent();
}
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)

Example 13 with MaterialViewPagerHeaderDecorator

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

the class RendezVousActivity method getTeachersSearcheed.

private void getTeachersSearcheed(final String newTextS) {
    CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_TEACHERS, null, new Response.Listener<JSONArray>() {

        @Override
        public void onResponse(JSONArray response) {
            JSONArray teachers = response;
            if (GRID_LAYOUT) {
                lstView.setLayoutManager(new GridLayoutManager(RendezVousActivity.this, 2));
            } else {
                lstView.setLayoutManager(new LinearLayoutManager(RendezVousActivity.this));
            }
            lstView.setHasFixedSize(true);
            //Use this now
            lstView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
            //Search action
            JSONArray lstFound = new JSONArray();
            JSONObject item = null;
            for (int i = 0; i < teachers.length(); i++) {
                try {
                    item = teachers.getJSONObject(i);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                try {
                    if (item.getString("name").contains(newTextS) || item.getString("lastname").contains(newTextS)) {
                        lstFound.put(item);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
            /*ArrayAdapter adapter = new ArrayAdapter(RendeVous.this, android.R.layout.simple_list_item_1, lstFound);
          lstView.setAdapter(adapter);*/
            lstView.setAdapter(new TeachersAdapter(lstFound, (TeachersAdapter.AdapterInterface) RendezVousActivity.this));
        }
    }, new Response.ErrorListener() {

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

Example 14 with MaterialViewPagerHeaderDecorator

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

the class RendezVousActivity method getTeachers.

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

        @Override
        public void onResponse(JSONArray response) {
            JSONArray teachers = response;
            if (GRID_LAYOUT) {
                lstView.setLayoutManager(new GridLayoutManager(RendezVousActivity.this, 2));
            } else {
                lstView.setLayoutManager(new LinearLayoutManager(RendezVousActivity.this));
            }
            lstView.setHasFixedSize(true);
            //Use this now
            lstView.addItemDecoration(new MaterialViewPagerHeaderDecorator());
            lstView.setAdapter(new TeachersAdapter(teachers, (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) TeachersAdapter(dz.easy.androidclient.Adapters.TeachersAdapter) 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)

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