use of dz.easy.androidclient.Util.CustomRequestArray in project easy by MehdiBenmesa.
the class RendezVousService method getRendezvousByManager.
private void getRendezvousByManager(final IRendezVous callBack) {
CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_RDV_BY_TEACHER, null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
//setup materialviewpager
callBack.onDataRecieved(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
App.getInstance().addToRequestQueue(jsonReq);
}
use of dz.easy.androidclient.Util.CustomRequestArray 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);
}
use of dz.easy.androidclient.Util.CustomRequestArray 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);
}
Aggregations