|
|
@@ -5,7 +5,6 @@ import android.os.Bundle;
|
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
-import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
@@ -16,7 +15,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.common.data.JSONUtil;
|
|
|
import com.core.api.wxapi.ApiPlatform;
|
|
|
import com.core.api.wxapi.ApiUtils;
|
|
|
-import com.core.app.Constants;
|
|
|
import com.core.base.BaseActivity;
|
|
|
import com.core.utils.CommonUtil;
|
|
|
import com.core.utils.ToastUtil;
|
|
|
@@ -72,65 +70,65 @@ public class RealTimeFormActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
- final String realTimeCache = CommonUtil.getSharedPreferences(this, Constants.REAL_TIME_CACHE);
|
|
|
- if (!TextUtils.isEmpty(realTimeCache) && JSONUtil.validate(realTimeCache)) {
|
|
|
- JSONArray realTimeArray = JSON.parseArray(realTimeCache);
|
|
|
- if (realTimeArray != null && realTimeArray.size() > 0) {
|
|
|
- for (int i = 0; i < realTimeArray.size(); i++) {
|
|
|
- RealTimeFormMenuBean realTimeFormMenuBean = new RealTimeFormMenuBean();
|
|
|
- JSONObject realTimeObject = realTimeArray.getJSONObject(i);
|
|
|
- realTimeFormMenuBean.setId(JSONUtil.getInt(realTimeObject, "ID"));
|
|
|
- realTimeFormMenuBean.setTitle(JSONUtil.getText(realTimeObject, "TITLE"));
|
|
|
- realTimeFormMenuBean.setColor(mGridColors[(i) % mGridColors.length]);
|
|
|
-
|
|
|
- mRealTimeFormMenuBeen.add(realTimeFormMenuBean);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- mRealTimeFormMenuAdapter.notifyDataSetChanged();
|
|
|
- } else {
|
|
|
- progressDialog.show();
|
|
|
- HttpClient mHttpClient = new HttpClient.Builder(CommonUtil.getAppBaseUrl(RealTimeFormActivity.this)).build();
|
|
|
- mHttpClient.Api().send(new HttpClient.Builder()
|
|
|
- .url("mobile/getRealTimeSubs.action")
|
|
|
- .add("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"))
|
|
|
- .header("Cookie", CommonUtil.getErpCookie(ct))
|
|
|
- .method(Method.GET)
|
|
|
- .build(), new ResultSubscriber<Object>(new Result2Listener<Object>() {
|
|
|
- @Override
|
|
|
- public void onResponse(Object o) {
|
|
|
- progressDialog.dismiss();
|
|
|
- String result = o.toString();
|
|
|
- JSONObject object = JSON.parseObject(result);
|
|
|
+// final String realTimeCache = CommonUtil.getSharedPreferences(this, Constants.REAL_TIME_CACHE);
|
|
|
+// if (!TextUtils.isEmpty(realTimeCache) && JSONUtil.validate(realTimeCache)) {
|
|
|
+// JSONArray realTimeArray = JSON.parseArray(realTimeCache);
|
|
|
+// if (realTimeArray != null && realTimeArray.size() > 0) {
|
|
|
+// for (int i = 0; i < realTimeArray.size(); i++) {
|
|
|
+// RealTimeFormMenuBean realTimeFormMenuBean = new RealTimeFormMenuBean();
|
|
|
+// JSONObject realTimeObject = realTimeArray.getJSONObject(i);
|
|
|
+// realTimeFormMenuBean.setId(JSONUtil.getInt(realTimeObject, "ID"));
|
|
|
+// realTimeFormMenuBean.setTitle(JSONUtil.getText(realTimeObject, "TITLE"));
|
|
|
+// realTimeFormMenuBean.setColor(mGridColors[(i) % mGridColors.length]);
|
|
|
+//
|
|
|
+// mRealTimeFormMenuBeen.add(realTimeFormMenuBean);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// mRealTimeFormMenuAdapter.notifyDataSetChanged();
|
|
|
+// } else {
|
|
|
+ progressDialog.show();
|
|
|
+ HttpClient mHttpClient = new HttpClient.Builder(CommonUtil.getAppBaseUrl(RealTimeFormActivity.this)).build();
|
|
|
+ mHttpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("mobile/getRealTimeSubs.action")
|
|
|
+ .add("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"))
|
|
|
+ .header("Cookie", CommonUtil.getErpCookie(ct))
|
|
|
+ .method(Method.GET)
|
|
|
+ .build(), new ResultSubscriber<Object>(new Result2Listener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject object = JSON.parseObject(result);
|
|
|
|
|
|
- JSONArray subsArray = object.getJSONArray("subs");
|
|
|
- if (subsArray != null && subsArray.size() > 0) {
|
|
|
- for (int i = 0; i < subsArray.size(); i++) {
|
|
|
- RealTimeFormMenuBean realTimeFormMenuBean = new RealTimeFormMenuBean();
|
|
|
- JSONObject realTimeObject = subsArray.getJSONObject(i);
|
|
|
- realTimeFormMenuBean.setId(JSONUtil.getInt(realTimeObject, "ID"));
|
|
|
- realTimeFormMenuBean.setTitle(JSONUtil.getText(realTimeObject, "TITLE"));
|
|
|
- realTimeFormMenuBean.setColor(mGridColors[(i) % mGridColors.length]);
|
|
|
+ JSONArray subsArray = object.getJSONArray("subs");
|
|
|
+ if (subsArray != null && subsArray.size() > 0) {
|
|
|
+ for (int i = 0; i < subsArray.size(); i++) {
|
|
|
+ RealTimeFormMenuBean realTimeFormMenuBean = new RealTimeFormMenuBean();
|
|
|
+ JSONObject realTimeObject = subsArray.getJSONObject(i);
|
|
|
+ realTimeFormMenuBean.setId(JSONUtil.getInt(realTimeObject, "ID"));
|
|
|
+ realTimeFormMenuBean.setTitle(JSONUtil.getText(realTimeObject, "TITLE"));
|
|
|
+ realTimeFormMenuBean.setColor(mGridColors[(i) % mGridColors.length]);
|
|
|
|
|
|
- mRealTimeFormMenuBeen.add(realTimeFormMenuBean);
|
|
|
- }
|
|
|
- mRealTimeFormMenuAdapter.notifyDataSetChanged();
|
|
|
- } else {
|
|
|
- ToastUtil.showToast(RealTimeFormActivity.this, "看板数据为空");
|
|
|
- mEmptyLayout.setVisibility(View.VISIBLE);
|
|
|
- mEmptyTextView.setText("看板数据为空");
|
|
|
+ mRealTimeFormMenuBeen.add(realTimeFormMenuBean);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onFailure(Object t) {
|
|
|
- progressDialog.dismiss();
|
|
|
- ToastUtil.showToast(RealTimeFormActivity.this, "看板数据获取失败");
|
|
|
+ mRealTimeFormMenuAdapter.notifyDataSetChanged();
|
|
|
+ } else {
|
|
|
+ ToastUtil.showToast(RealTimeFormActivity.this, "看板数据为空");
|
|
|
mEmptyLayout.setVisibility(View.VISIBLE);
|
|
|
- mEmptyTextView.setText("看板数据获取失败");
|
|
|
+ mEmptyTextView.setText("看板数据为空");
|
|
|
}
|
|
|
- }));
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(Object t) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ ToastUtil.showToast(RealTimeFormActivity.this, "看板数据获取失败");
|
|
|
+ mEmptyLayout.setVisibility(View.VISIBLE);
|
|
|
+ mEmptyTextView.setText("看板数据获取失败");
|
|
|
+ }
|
|
|
+ }));
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
private void initView() {
|