use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class PostActivity method startBlock.
private void startBlock(int position) {
String url = "forum.php?mod=topicadmin&action=banpost" + "&fid=" + fid + "&tid=" + tid + "&topiclist[]=" + datas.get(position).pid + "&mobile=2&inajax=1";
params = null;
HttpUtil.get(url, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
Document document = RuisUtils.getManageContent(response);
params = RuisUtils.getForms(document, "topicadminform");
}
@Override
public void onFailure(Throwable e) {
super.onFailure(e);
showToast("网络错误!请重试");
}
});
}
use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class PostActivity method closeArticle.
// 打开或者关闭帖子
private void closeArticle(String[] str) {
if (str.length == 3) {
params.put("expirationclose", str[1] + " " + str[2]);
} else {
params.put("expirationclose", "");
}
if (str[0].equals("打开")) {
params.put("operations[]", "open");
} else if (str[0].equals("关闭")) {
params.put("operations[]", "close");
}
params.put("reason", "手机版主题操作");
HttpUtil.post(UrlUtils.getCloseArticleUrl(), params, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
String res = new String(response);
if (res.contains("成功")) {
showToast(str[0] + "帖子操作成功,刷新帖子即可看到效果");
} else {
showToast("管理操作失败,我也不知道哪里有问题");
}
}
@Override
public void onFailure(Throwable e) {
super.onFailure(e);
showToast("网络错误," + str[0] + "帖子失败!");
}
});
}
use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class PostActivity method getArticleData.
// 文章一页的html 根据页数 tid
private void getArticleData(final int page) {
String url;
final boolean api = App.IS_SCHOOL_NET;
if (App.IS_SCHOOL_NET) {
url = UrlUtils.getArticleApiUrl(tid, currentPage, 20);
} else {
url = UrlUtils.getSingleArticleUrl(tid, page, false);
}
HttpUtil.get(url, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
// if (api) {
// new DealWithArticleDataApi(PostActivity.this).execute(response);
// } else {
new DealWithArticleData(PostActivity.this).execute(new String(response));
// }
}
@Override
public void onFailure(Throwable e) {
if (e != null && e == SyncHttpClient.NeedLoginError) {
isLogin();
showToast("此贴需要登录才能查看");
return;
}
enableLoadMore = true;
adapter.changeLoadMoreState(BaseAdapter.STATE_LOAD_FAIL);
showToast("加载失败(Error -1)");
}
});
}
use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class PostActivity method startWarn.
private void startWarn(int position) {
if (App.IS_SCHOOL_NET) {
// computer
params = new HashMap<>();
params.put("fid", fid);
params.put("page", "1");
params.put("tid", tid);
params.put("handlekey", "mods");
params.put("topiclist[]", datas.get(position).pid);
params.put("reason", " 手机版主题操作");
} else {
String url = "forum.php?mod=topicadmin&action=warn&fid=" + fid + "&tid=" + tid + "&operation=&optgroup=&page=&topiclist[]=" + datas.get(position).pid + "&mobile=2&inajax=1";
// url = forum.php?mod=topicadmin&action=warn&fid=72&tid=922824&handlekey=mods&infloat=yes&nopost=yes&r0.8544855790245922&inajax=1
params = null;
HttpUtil.get(url, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
Document document = getManageContent(response);
params = RuisUtils.getForms(document, "topicadminform");
}
@Override
public void onFailure(Throwable e) {
super.onFailure(e);
}
});
}
}
use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class PostsActivity method getData.
private void getData() {
adapter.changeLoadMoreState(BaseAdapter.STATE_LOADING);
String url;
if (!App.IS_SCHOOL_NET) {
url = UrlUtils.getArticleListUrl(FID, currentPage, false);
} else if (getType() == PostListAdapter.TYPE_IMAGE) {
url = UrlUtils.getArticleListUrl(FID, currentPage, true);
} else {
url = UrlUtils.getArticleListApiUrl(FID, currentPage);
}
url = url + orders[currentTabindex];
HttpUtil.get(url, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
switch(getType()) {
case PostListAdapter.TYPE_IMAGE:
new getImagePosts().execute(new String(response));
break;
case PostListAdapter.TYPE_NORMAL:
new getPostsApi().execute(response);
break;
case PostListAdapter.TYPE_NORMAL_MOBILE:
// 外网
new getPostsMe().execute(new String(response));
break;
}
}
@Override
public void onFailure(Throwable e) {
refreshLayout.postDelayed(() -> refreshLayout.setRefreshing(false), 500);
adapter.changeLoadMoreState(BaseAdapter.STATE_LOAD_FAIL);
}
});
}
Aggregations