use of dz.easy.androidclient.Adapters.NoteAdapter in project easy by MehdiBenmesa.
the class NoteFragment method onReceiveResult.
@Override
public void onReceiveResult(int resultCode, Bundle resultData) {
switch(resultCode) {
case STATUS_RUNNING:
dialogListner.showDialog();
break;
case STATUS_FINISHED:
/* Hide progress & extract result from bundle */
dialogListner.hideDialog();
switch(resultData.getString("action")) {
case GET_NOTE_STUDENT_MODULE:
String jsonString = resultData.getString("result");
JSONArray response = null;
try {
response = new JSONArray(jsonString);
mRecyclerView.setAdapter(new NoteAdapter(response));
} catch (JSONException e) {
e.printStackTrace();
}
break;
}
break;
case STATUS_ERROR:
/* Handle the error */
String error = resultData.getString(Intent.EXTRA_TEXT);
Toast.makeText(getContext(), error, Toast.LENGTH_LONG).show();
break;
}
}
use of dz.easy.androidclient.Adapters.NoteAdapter 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();
}
}
Aggregations