use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class RendezVousFragment method accept.
public void accept(JSONObject rdv, final String date, final String heur, final String remarque) {
CustomRequest jsonReq = null;
try {
jsonReq = new CustomRequest(Request.Method.POST, ACCEPT_RDV + "/" + rdv.getString("_id"), null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// hidepDialog();
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("date", date);
params.put("heur", heur);
params.put("remarque", remarque);
return params;
}
};
} catch (JSONException e) {
e.printStackTrace();
}
App.getInstance().addToRequestQueue(jsonReq);
}
use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class StudentsListAbsenceAdapter method updateAbsences.
public void updateAbsences(Context c) {
StudentsListAbsenceAdapter.MyViewHolder child;
final JSONArray students = new JSONArray();
Iterator iter = myList.iterator();
int i = 0;
while (iter.hasNext()) {
child = (StudentsListAbsenceAdapter.MyViewHolder) iter.next();
if (child.abs.isChecked()) {
System.out.println("ETUDIANTS CHECKED " + child.title.getText().toString());
try {
students.put(i, child.idStudent.getText().toString());
i++;
} catch (JSONException e) {
e.printStackTrace();
}
}
}
CustomRequest jsonReq = new CustomRequest(Request.Method.POST, POST_UPDATE_ABSENCES, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
try {
JSONObject absence = new JSONObject();
absence.put("students", students);
absence.put("idabs", adapterIdAbsence);
params.put("absence", absence.toString());
} catch (JSONException e) {
e.printStackTrace();
}
return params;
}
};
App.getInstance().addToRequestQueue(jsonReq);
}
use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class StudentsListAbsenceAdapter method ajoutAbsences.
public void ajoutAbsences(Context c, final String idSeance) {
StudentsListAbsenceAdapter.MyViewHolder child;
final JSONArray students = new JSONArray();
Iterator iter = myList.iterator();
int i = 0;
while (iter.hasNext()) {
child = (StudentsListAbsenceAdapter.MyViewHolder) iter.next();
if (child.abs.isChecked()) {
System.out.println("ETUDIANTS CHECKED " + child.title.getText().toString());
try {
students.put(i, child.idStudent.getText().toString());
i++;
} catch (JSONException e) {
e.printStackTrace();
}
}
}
CustomRequest jsonReq = new CustomRequest(Request.Method.POST, POST_ABSENCES, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
// try {
JSONObject absence = new JSONObject();
params.put("students", students.toString());
params.put("seance", idSeance);
params.put("date", thisdate);
return params;
}
};
App.getInstance().addToRequestQueue(jsonReq);
}
use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class TimeLineActivity method setDataListItemsTeacher.
public void setDataListItemsTeacher(final Itimeline callback) {
try {
CustomRequest jsonReq = new CustomRequest(Request.Method.GET, GET_TIME_TABLE_TEACHER + "/" + user.getString("_id"), null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
callback.onDataRecieved(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
App.getInstance().addToRequestQueue(jsonReq);
} catch (JSONException e) {
e.printStackTrace();
}
}
use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class RendezVousFragment method refuse.
public void refuse(JSONObject rdv, final String remarque) {
CustomRequest jsonReq = null;
try {
jsonReq = new CustomRequest(Request.Method.POST, REFUSE_RDV + "/" + rdv.getString("_id"), null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// hidepDialog();
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("remarque", remarque);
return params;
}
};
} catch (JSONException e) {
e.printStackTrace();
}
App.getInstance().addToRequestQueue(jsonReq);
}
Aggregations