Search in sources :

Example 11 with CustomRequestArray

use of dz.easy.androidclient.Util.CustomRequestArray in project easy by MehdiBenmesa.

the class NoteService method getNoteByStudentByModule.

public void getNoteByStudentByModule(String moduleId, final INote callBack) throws JSONException {
    System.out.println("AVANT ABSENCE 2 ");
    CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_NOTE_BY_MODULES + "/" + App.getInstance().getUser().getString("_id") + "/" + moduleId, null, new Response.Listener<JSONArray>() {

        @Override
        public void onResponse(JSONArray response) {
            callBack.onDataReceived(response);
        }
    }, 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) JSONArray(org.json.JSONArray)

Example 12 with CustomRequestArray

use of dz.easy.androidclient.Util.CustomRequestArray in project easy by MehdiBenmesa.

the class AbsenceService method getAbsneceBySeance.

public void getAbsneceBySeance(String idSeance, final IAbsence callBack) {
    CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_ABSENCE_BY_SEANCE + "/" + idSeance, null, new Response.Listener<JSONArray>() {

        @Override
        public void onResponse(JSONArray response) {
            callBack.onDataReceived(response);
        }
    }, 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) JSONArray(org.json.JSONArray)

Example 13 with CustomRequestArray

use of dz.easy.androidclient.Util.CustomRequestArray in project easy by MehdiBenmesa.

the class RendeVousFragment 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(getActivity(), 2));
            } else {
                lstView.setLayoutManager(new LinearLayoutManager(getActivity()));
            }
            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));
        }
    }, 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) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) JSONException(org.json.JSONException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 14 with CustomRequestArray

use of dz.easy.androidclient.Util.CustomRequestArray in project easy by MehdiBenmesa.

the class NoteFragment method getNoteByStudent.

public void getNoteByStudent() {
    try {
        System.out.println("AVANT ABSENCE 2 ");
        CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_NOTE_BY_MODULES + "/" + user.getString("_id") + "/" + moduleID, null, new Response.Listener<JSONArray>() {

            @Override
            public void onResponse(JSONArray response) {
                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 NoteAdapter(response));
            }
        }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
            }
        });
        App.getInstance().addToRequestQueue(jsonReq);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
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) NoteAdapter(dz.easy.androidclient.Adapters.NoteAdapter) JSONException(org.json.JSONException) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MaterialViewPagerHeaderDecorator(com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)

Example 15 with CustomRequestArray

use of dz.easy.androidclient.Util.CustomRequestArray 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)

Aggregations

Response (com.android.volley.Response)18 VolleyError (com.android.volley.VolleyError)18 CustomRequestArray (dz.easy.androidclient.Util.CustomRequestArray)18 JSONArray (org.json.JSONArray)18 GridLayoutManager (android.support.v7.widget.GridLayoutManager)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 MaterialViewPagerHeaderDecorator (com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)6 JSONException (org.json.JSONException)5 TeachersAdapter (dz.easy.androidclient.Adapters.TeachersAdapter)2 JSONObject (org.json.JSONObject)2 NoteAdapter (dz.easy.androidclient.Adapters.NoteAdapter)1