use of com.android.volley.VolleyError in project SwipeToLoadLayout by Aspsine.
the class TwitterScrollViewFragment method onRefresh.
@Override
public void onRefresh() {
GsonRequest request = new GsonRequest<SectionCharacters>(Constants.API.CHARACTERS, SectionCharacters.class, new Response.Listener<SectionCharacters>() {
@Override
public void onResponse(SectionCharacters sectionCharacters) {
List<Character> characters = sectionCharacters.getCharacters();
for (int i = 0; i < characters.size(); i++) {
String img = characters.get(i).getAvatar();
if (i < ivArray.length) {
Picasso.with(getActivity()).load(img).into(ivArray[i]);
}
}
swipeToLoadLayout.setRefreshing(false);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
swipeToLoadLayout.setRefreshing(false);
volleyError.printStackTrace();
}
});
App.getRequestQueue().add(request).setTag(TAG);
}
use of com.android.volley.VolleyError in project SwipeToLoadLayout by Aspsine.
the class GoogleStyleFragment method onLoadMore.
@Override
public void onLoadMore() {
GsonRequest request = new GsonRequest<SectionCharacters>(Constants.API.CHARACTERS, SectionCharacters.class, new Response.Listener<SectionCharacters>() {
@Override
public void onResponse(final SectionCharacters characters) {
// here, I use post delay to show more animation, you don't have to.
swipeToLoadLayout.postDelayed(new Runnable() {
@Override
public void run() {
if (mPageNum < 3) {
mPageNum++;
mAdapter.append(characters.getSections().subList(mPageNum, mPageNum + 1));
} else {
Toast.makeText(getContext(), "Done", Toast.LENGTH_SHORT).show();
}
swipeToLoadLayout.setLoadingMore(false);
}
}, 2000);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
swipeToLoadLayout.setLoadingMore(false);
volleyError.printStackTrace();
}
});
App.getRequestQueue().add(request).setTag(TAG + "loadmore" + mType);
}
use of com.android.volley.VolleyError in project SwipeToLoadLayout by Aspsine.
the class TwitterGridViewFragment method onLoadMore.
@Override
public void onLoadMore() {
GsonRequest request = new GsonRequest<SectionCharacters>(Constants.API.CHARACTERS, SectionCharacters.class, new Response.Listener<SectionCharacters>() {
@Override
public void onResponse(SectionCharacters characters) {
if (mPageNum < 3) {
mPageNum++;
mAdapter.append(characters.getSections().get(mPageNum).getCharacters());
} else {
Toast.makeText(getContext(), "Done", Toast.LENGTH_SHORT).show();
}
swipeToLoadLayout.setLoadingMore(false);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
swipeToLoadLayout.setLoadingMore(false);
volleyError.printStackTrace();
}
});
App.getRequestQueue().add(request).setTag(TAG + "loadmore");
}
use of com.android.volley.VolleyError 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);
}
use of com.android.volley.VolleyError 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();
}
}
Aggregations