use of com.funstill.kelefun.http.SignInterceptor in project keleFanfou by kelefun.
the class FavouriteStatusListFragment method loadMoreHomeLineStatus.
private void loadMoreHomeLineStatus(Map<String, String> param) {
StatusApi api = BaseRetrofit.retrofit(new SignInterceptor()).create(StatusApi.class);
Call<List<Status>> call = api.getFavourites(param);
call.enqueue(new Callback<List<Status>>() {
@Override
public void onResponse(Call<List<Status>> call, Response<List<Status>> response) {
if (response.code() == 200) {
List<Status> statusList = response.body();
if (statusList.size() > 0) {
data.addAll(statusList);
mAdapter.notifyDataSetChanged();
} else {
ToastUtil.showToast(getContext(), "没有更多了");
}
}
isLoadingMore = false;
}
@Override
public void onFailure(Call<List<Status>> call, Throwable t) {
t.printStackTrace();
LogHelper.e("请求失败", t.getMessage());
isLoadingMore = false;
}
});
}
use of com.funstill.kelefun.http.SignInterceptor in project keleFanfou by kelefun.
the class ImageListFragment method loadMoreMentions.
private void loadMoreMentions(Map<String, String> param) {
param.put("id", tuserId);
StatusApi api = BaseRetrofit.retrofit(new SignInterceptor()).create(StatusApi.class);
Call<List<Status>> call = api.getUserTimeLineWithPhoto(param);
call.enqueue(new Callback<List<Status>>() {
@Override
public void onResponse(Call<List<Status>> call, Response<List<Status>> response) {
if (response.code() == 200) {
List<Status> statusList = response.body();
if (statusList.size() > 0) {
data.addAll(statusList);
mAdapter.notifyItemRangeInserted(lastVisibleItemPosition + 1, statusList.size());
} else {
ToastUtil.showToast(getContext(), "没有更多了");
}
} else if (response.code() == 403) {
ToastUtil.showToast(getContext(), "对方设置了隐私,需先请求关注");
}
isLoadingMore = false;
}
@Override
public void onFailure(Call<List<Status>> call, Throwable t) {
t.printStackTrace();
LogHelper.e("请求失败", t.getMessage());
isLoadingMore = false;
}
});
}
use of com.funstill.kelefun.http.SignInterceptor in project keleFanfou by kelefun.
the class StatusListFragment method getUserTimeLineStatus.
private void getUserTimeLineStatus(Map<String, String> param) {
StatusApi api = BaseRetrofit.retrofit(new SignInterceptor()).create(StatusApi.class);
Call<List<Status>> call = api.getUserTimeLine(param);
call.enqueue(new Callback<List<Status>>() {
@Override
public void onResponse(Call<List<Status>> call, Response<List<Status>> response) {
if (response.code() == 200) {
List<Status> statusList = response.body();
if (statusList.size() > 0) {
if (data.size() > 0) {
// 让新增的数据在前面
List<Status> tempList = new ArrayList<>();
tempList.addAll(data);
data.clear();
data.addAll(statusList);
data.addAll(tempList);
} else {
data.addAll(statusList);
}
mAdapter.notifyDataSetChanged();
} else {
ToastUtil.showToast(getContext(), "没有更多了");
}
} else if (response.code() == 403) {
ToastUtil.showToast(getContext(), "对方设置了隐私,需先请求关注");
}
}
@Override
public void onFailure(Call<List<Status>> call, Throwable t) {
t.printStackTrace();
}
});
}
use of com.funstill.kelefun.http.SignInterceptor in project keleFanfou by kelefun.
the class AccountService method getUserInfo.
/**
* @param auth 用户 Id
*/
public UserInfo getUserInfo(OAuthToken auth) {
Retrofit retrofit = BaseRetrofit.retrofit(new SignInterceptor());
AccountApi api = retrofit.create(AccountApi.class);
Call<ResponseBody> call = api.verifyCred();
try {
Response<ResponseBody> response = call.execute();
// LogHelper.d(response.body().string());
} catch (Exception e) {
// TODO handle errors
e.printStackTrace();
LogHelper.e(e.getMessage());
}
return null;
}
use of com.funstill.kelefun.http.SignInterceptor in project keleFanfou by kelefun.
the class MentionsPagerFragment method loadMoreMentions.
private void loadMoreMentions(Map<String, String> param) {
StatusApi api = BaseRetrofit.retrofit(new SignInterceptor()).create(StatusApi.class);
Call<List<Status>> call = api.getMentions(param);
call.enqueue(new Callback<List<Status>>() {
@Override
public void onResponse(Call<List<Status>> call, Response<List<Status>> response) {
if (response.code() == 200) {
List<Status> statusList = response.body();
if (statusList.size() > 0) {
data.addAll(statusList);
mAdapter.notifyDataSetChanged();
} else {
ToastUtil.showToast(_mActivity, "没有更多了");
}
}
isLoadingMore = false;
}
@Override
public void onFailure(Call<List<Status>> call, Throwable t) {
t.printStackTrace();
LogHelper.e("请求失败", t.getMessage());
isLoadingMore = false;
}
});
}
Aggregations