use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class ReplyCzActivity method replyCz.
// 回复层主
private void replyCz(String url) {
String inputStr = PostActivity.getPreparedReply(this, input.getText().toString());
params.put("message", inputStr);
HttpUtil.post(url, params, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
String res = new String(response);
handleReply(true, res + "层主");
}
@Override
public void onFailure(Throwable e) {
e.printStackTrace();
handleReply(false, e.getMessage());
}
@Override
public void onFinish() {
super.onFinish();
dialog.dismiss();
}
});
}
use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class SignActivity method startDaka.
// 点击签到按钮
private void startDaka() {
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setMessage("正在签到...");
dialog.show();
String xinqin = getGroup1_select();
// String formhash = hash;
String qdmode;
String todaysay = "";
EditText input = findViewById(R.id.input);
if (!TextUtils.isEmpty(input.getText().toString())) {
qdmode = "1";
todaysay = input.getText().toString() + " --来自睿思手机客户端";
} else {
qdmode = "3";
}
Map<String, String> params = new HashMap<>();
// params.put("formhash", formhash);
params.put("qdxq", xinqin);
params.put("qdmode", qdmode);
params.put("todaysay", todaysay);
params.put("fastreplay", "0");
String url = UrlUtils.getSignUrl();
HttpUtil.post(url, params, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
String res = new String(response);
int start = res.indexOf("恭喜你签到成功");
if (start > 0) {
int end = res.indexOf("</div>", start);
showNtice(res.substring(start, end));
signNo.setVisibility(View.GONE);
checkState();
} else {
showNtice("未知错误,签到失败");
}
}
@Override
public void onFailure(Throwable e) {
showNtice("网络错误!!!!!");
}
@Override
public void onFinish() {
super.onFinish();
dialog.dismiss();
}
});
}
use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class SignActivity method checkState.
// 看看是否已经签到
private void checkState() {
progressBar.setVisibility(View.VISIBLE);
Calendar c = Calendar.getInstance();
int HOUR_OF_DAY = c.get(Calendar.HOUR_OF_DAY);
if (!(7 <= HOUR_OF_DAY && HOUR_OF_DAY < 24)) {
sign_error();
return;
}
String urlget = "plugin.php?id=dsu_paulsign:sign";
HttpUtil.get(urlget, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
String res = new String(response);
// // TODO: 16-8-26
Document doc = Jsoup.parse(res);
if (res.contains("您今天已经签到过了或者签到时间还未开始")) {
String daytxt = "0";
String monthtxt = "0";
for (Element temp : doc.select(".mn").select("p")) {
String temptext = temp.text();
if (temptext.contains("您累计已签到")) {
int pos = temptext.indexOf("您累计已签到");
daytxt = temptext.substring(pos);
} else if (temptext.contains("您本月已累计签到")) {
monthtxt = temptext;
}
}
sign_yes(daytxt, monthtxt);
} else {
sign_no();
}
}
@Override
public void onFailure(Throwable e) {
showNtice("网络错误");
}
});
}
use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class EditActivity method start_edit.
private void start_edit() {
String url = "forum.php?mod=post&action=edit&tid=" + tid + "&pid=" + pid + "&mobile=2";
HttpUtil.get(url, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
Document document = Jsoup.parse(new String(response));
params = RuisUtils.getForms(document, "postform");
String title = params.get("subject");
if (TextUtils.isEmpty(title)) {
edTitle.setVisibility(View.GONE);
} else {
edTitle.setText(title);
}
if (TextUtils.isEmpty(params.get("message"))) {
showToast("本贴不支持编辑!");
finish();
}
edContent.setText(params.get("message"));
Elements types = document.select("#typeid").select("option");
for (Element e : types) {
typeiddatas.add(new Forum(Integer.parseInt(e.attr("value")), e.text()));
}
if (typeiddatas.size() > 0) {
typeIdContainer.setVisibility(View.VISIBLE);
tvSelectType.setText(typeiddatas.get(0).name);
typeId = typeiddatas.get(0).fid;
} else {
typeIdContainer.setVisibility(View.GONE);
}
}
@Override
public void onFailure(Throwable e) {
super.onFailure(e);
showToast("网络错误");
}
});
}
use of me.yluo.ruisiapp.myhttp.ResponseHandler in project Ruisi by freedom10086.
the class LoginActivity method loadData.
private void loadData() {
String url = UrlUtils.getLoginUrl();
HttpUtil.get(url, new ResponseHandler() {
@Override
public void onSuccess(byte[] response) {
String res = new String(response);
Document doc = Jsoup.parse(res);
// 判断是否有验证码
Element element = doc.select("#loginform .sec_code").first();
if (element != null) {
haveValid = true;
seccodehash = element.select("input[name=seccodehash]").attr("value");
validImageSrc = element.select("img").attr("src");
}
loginUrl = doc.select("form#loginform").attr("action");
String hash = doc.select("input#formhash").attr("value");
App.setHash(LoginActivity.this, hash);
}
@Override
public void onFailure(Throwable e) {
AlertDialog dialog = new AlertDialog.Builder(LoginActivity.this).setTitle("加载失败").setMessage("是否重新加载").setPositiveButton("重新加载", (dialogInterface, i) -> loadData()).setNegativeButton("关闭", (dialogInterface, i) -> finish()).create();
dialog.show();
}
});
}
Aggregations