use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class TimeLineActivity method setDataListItemsStudent.
public void setDataListItemsStudent(final Itimeline callback) {
try {
CustomRequest jsonReq = new CustomRequest(Request.Method.GET, GET_TIME_TABLE_STUDENT + "/" + user.getString("section") + "/" + user.getString("groupe"), 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 StartActivity method handleSignInResult.
// [END onActivityResult]
// 1D:80:89:02:65:1A:38:03:60:08:D1:38:24:EA:CA:C0:F9:59:48:AC
// [START handleSignInResult]
private void handleSignInResult(GoogleSignInResult result) {
Log.d(TAG, "handleSignInResult:" + result.isSuccess());
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
updateUI(true);
App.getInstance().setAccessToken(acct.getIdToken());
App.getInstance().setEmail(acct.getEmail());
if (acct.getEmail().substring(acct.getEmail().length() - 6, acct.getEmail().length()).equals("esi.dz")) {
CustomRequest jsonReq = new CustomRequest(Request.Method.POST, APP_LOGIN, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONObject user = response.getJSONObject("user");
Log.i(TAG, "Signed in as: " + user.getString("name"));
// JSONArray resp = responseBody.to;
if (user.getString("mail").equals(App.getInstance().getEmail())) {
startUserActivity(user);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, 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("email", App.getInstance().getEmail());
params.put("idToken", App.getInstance().getAccessToken());
return params;
}
};
App.getInstance().addToRequestQueue(jsonReq);
} else {
String msg = "c'est pas un compte ESI ";
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
}
} else {
// Signed out, show unauthenticated UI.
updateUI(false);
}
}
use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class AbsenceService method getSeanceByTeacher.
public void getSeanceByTeacher(final IAbsence callBack) throws JSONException {
CustomRequest jsonReq = new CustomRequest(Request.Method.GET, GET_TIME_TABLE_TEACHER + "/" + App.getInstance().getUser().getString("_id"), null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
callBack.onDataReceived(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
App.getInstance().addToRequestQueue(jsonReq);
}
use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class StudentsListNoteAdapter method updateNotes.
public void updateNotes(Context c, String idModule) {
StudentsListNoteAdapter.MyViewHolder child;
final JSONArray students = new JSONArray();
Iterator iter = myList.iterator();
while (iter.hasNext()) {
child = (MyViewHolder) iter.next();
while (Float.parseFloat(child.note.getText().toString()) > 20) iter.next();
JSONObject student = new JSONObject();
try {
student.put("reason", Examnote);
student.put("value", child.note.getText().toString());
student.put("student", child.idStudent.getText().toString());
student.put("module", moduleid);
students.put(student);
} catch (JSONException e) {
e.printStackTrace();
}
}
CustomRequest jsonReq = new CustomRequest(Request.Method.POST, POST_NOTES, 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("students", students.toString());
return params;
}
};
App.getInstance().addToRequestQueue(jsonReq);
}
use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.
the class RendezVousActivity method ajouterRdv.
public void ajouterRdv(final String idTeacher, final String date, final String remarque) {
CustomRequest jsonReq = null;
jsonReq = new CustomRequest(Request.Method.POST, POST_RDV, 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("teacher", idTeacher);
params.put("date", date);
params.put("reason", remarque);
try {
params.put("student", user.getString("_id"));
} catch (JSONException e) {
e.printStackTrace();
}
return params;
}
};
App.getInstance().addToRequestQueue(jsonReq);
}
Aggregations