|
|
@@ -30,6 +30,7 @@ import com.core.widget.MyListView;
|
|
|
import com.core.xmpp.CoreService;
|
|
|
import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
|
+import com.me.network.app.http.rx.Result2Listener;
|
|
|
import com.me.network.app.http.rx.ResultListener;
|
|
|
import com.me.network.app.http.rx.ResultSubscriber;
|
|
|
import com.uas.appcontact.model.contacts.ContactsModel;
|
|
|
@@ -188,7 +189,7 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ private int Timeout = 0;
|
|
|
private void initData() {
|
|
|
if (!CommonUtil.isNetWorkConnected(this)) {
|
|
|
ToastMessage(getString(R.string.common_notlinknet));
|
|
|
@@ -202,12 +203,13 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
|
|
|
.url("appStepsrank")
|
|
|
.add("userid",MyApplication.getInstance().mLoginUser.getUserId())
|
|
|
.add("token",MyApplication.getInstance().mAccessToken)
|
|
|
+ .connectTimeout(10000)
|
|
|
.method(Method.POST)
|
|
|
- .build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ .build(),new ResultSubscriber<>(new Result2Listener<Object>() {
|
|
|
@Override
|
|
|
public void onResponse(Object o) {
|
|
|
if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
- LogUtil.prinlnLongMsg("appStepsrank", o.toString()+"");
|
|
|
+ LogUtil.prinlnLongMsg("appStepsrankflh", Timeout+"-"+o.toString()+"");
|
|
|
|
|
|
if (o.toString().contains("resultCode") && o.toString().contains("resultMsg")){
|
|
|
progressDialog.dismiss();
|
|
|
@@ -216,6 +218,16 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
|
|
|
}else
|
|
|
handleData(o.toString());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(Object t) {
|
|
|
+ Timeout++; // 请求超时后再请求再次请求直到拿到数据,最多3次请求
|
|
|
+ LogUtil.prinlnLongMsg("appStepsrankflh", Timeout+"");
|
|
|
+ if (Timeout == 3) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ ToastMessage(getString(R.string.too_long_to_http));
|
|
|
+ }
|
|
|
+ }
|
|
|
}));
|
|
|
|
|
|
|