|
|
@@ -13,12 +13,10 @@ import android.widget.Button;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.android.volley.Request;
|
|
|
import com.android.volley.toolbox.StringRequest;
|
|
|
import com.uas.equipment.R;
|
|
|
-import com.uas.equipment.bean.VersionUpgradeBean;
|
|
|
import com.uas.equipment.global.GloableParams;
|
|
|
import com.uas.equipment.util.AndroidUtil;
|
|
|
import com.uas.equipment.util.CommonUtil;
|
|
|
@@ -34,8 +32,6 @@ import com.uas.equipment.util.down.ProgressResponseBody;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
|
|
|
import static com.uas.equipment.util.Constants.CONSTANT.APK_FILE_NAME;
|
|
|
import static com.uas.equipment.util.Constants.CONSTANT.APK_FILE_PATH;
|
|
|
@@ -145,51 +141,67 @@ public class VersionUpgradeFragment extends BaseFragment implements ProgressResp
|
|
|
.url(GloableParams.ADDRESS_OUTMATERIAL_GETPDAVERSION)
|
|
|
// .url("http://usoft.f3322.net:11769/ERP/api/pda/outMaterial/getPdaVersion.action")
|
|
|
.method(Request.Method.GET)
|
|
|
- .addParam("code", "UAS_SMART")
|
|
|
+ .addParam("code", "UAS设备管理")
|
|
|
.build(), new HttpCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
+// String result = o.toString();
|
|
|
+// JSONObject resultObject = JSON.parseObject(result);
|
|
|
+// JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
+// List<VersionUpgradeBean> list=new ArrayList<>();
|
|
|
+// list.clear();
|
|
|
+// if (dataArray != null && dataArray.size() > 0) {
|
|
|
+// for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+// JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
+// if (dataObject != null) {
|
|
|
+// VersionUpgradeBean jltStorageInBean = new VersionUpgradeBean();
|
|
|
+// if (FastjsonUtil.getText(dataObject, "PP_PDACODE").equals("UAS设备管理")){
|
|
|
+// jltStorageInBean.setPP_PDACODE(FastjsonUtil.getText(dataObject, "PP_PDACODE"));
|
|
|
+// jltStorageInBean.setPP_VERSIONNUM(FastjsonUtil.getText(dataObject, "PP_VERSIONNUM"));
|
|
|
+// jltStorageInBean.setPP_ATTACH(FastjsonUtil.getText(dataObject, "PP_ATTACH"));
|
|
|
+// jltStorageInBean.setPP_REMARK(FastjsonUtil.getText(dataObject, "PP_REMARK"));
|
|
|
+// jltStorageInBean.setPP_VERSIONNAME(FastjsonUtil.getText(dataObject, "PP_VERSIONNAME"));
|
|
|
+// list.add(jltStorageInBean);
|
|
|
+// mUpgradeButton.setVisibility(View.VISIBLE);
|
|
|
+// }else {
|
|
|
+// mUpgradeButton.setVisibility(View.GONE);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (list == null || list.size() == 0){
|
|
|
+// mUpgradeButton.setVisibility(View.GONE);
|
|
|
+// }else {
|
|
|
+// for (int i=0;i<list.size();i++){
|
|
|
+// VersionUpgradeBean versionUpgradeBean = list.get(0);
|
|
|
+// mNewVersionTv.setText(versionUpgradeBean.getPP_VERSIONNAME());
|
|
|
+// mMsgTextView.setText(versionUpgradeBean.getPP_REMARK());
|
|
|
+// mAttachId = versionUpgradeBean.getPP_ATTACH();
|
|
|
+// if (!TextUtils.isEmpty(mAttachId)) {
|
|
|
+// mUpgradeButton.setVisibility(View.VISIBLE);
|
|
|
+// } else {
|
|
|
+// mUpgradeButton.setVisibility(View.VISIBLE);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
String result = o.toString();
|
|
|
JSONObject resultObject = JSON.parseObject(result);
|
|
|
- JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
- List<VersionUpgradeBean> list=new ArrayList<>();
|
|
|
- list.clear();
|
|
|
- if (dataArray != null && dataArray.size() > 0) {
|
|
|
- for (int i = 0; i < dataArray.size(); i++) {
|
|
|
- JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
- if (dataObject != null) {
|
|
|
- VersionUpgradeBean jltStorageInBean = new VersionUpgradeBean();
|
|
|
- if (FastjsonUtil.getText(dataObject, "PP_PDACODE").equals("UAS设备管理")){
|
|
|
- jltStorageInBean.setPP_PDACODE(FastjsonUtil.getText(dataObject, "PP_PDACODE"));
|
|
|
- jltStorageInBean.setPP_VERSIONNUM(FastjsonUtil.getText(dataObject, "PP_VERSIONNUM"));
|
|
|
- jltStorageInBean.setPP_ATTACH(FastjsonUtil.getText(dataObject, "PP_ATTACH"));
|
|
|
- jltStorageInBean.setPP_REMARK(FastjsonUtil.getText(dataObject, "PP_REMARK"));
|
|
|
- jltStorageInBean.setPP_VERSIONNAME(FastjsonUtil.getText(dataObject, "PP_VERSIONNAME"));
|
|
|
- list.add(jltStorageInBean);
|
|
|
- mUpgradeButton.setVisibility(View.VISIBLE);
|
|
|
- }else {
|
|
|
- mUpgradeButton.setVisibility(View.GONE);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (list == null || list.size() == 0){
|
|
|
- mUpgradeButton.setVisibility(View.GONE);
|
|
|
- }else {
|
|
|
- for (int i=0;i<list.size();i++){
|
|
|
- VersionUpgradeBean versionUpgradeBean = list.get(0);
|
|
|
- mNewVersionTv.setText(versionUpgradeBean.getPP_VERSIONNAME());
|
|
|
- mMsgTextView.setText(versionUpgradeBean.getPP_REMARK());
|
|
|
- mAttachId = versionUpgradeBean.getPP_ATTACH();
|
|
|
- if (!TextUtils.isEmpty(mAttachId)) {
|
|
|
- mUpgradeButton.setVisibility(View.VISIBLE);
|
|
|
- } else {
|
|
|
- mUpgradeButton.setVisibility(View.VISIBLE);
|
|
|
- }
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ mNewVersionTv.setText(FastjsonUtil.getText(dataObject, "pp_versionname"));
|
|
|
+ mMsgTextView.setText(FastjsonUtil.getText(dataObject, "pp_remark"));
|
|
|
+
|
|
|
+ mAttachId = FastjsonUtil.getText(dataObject, "pp_attach");
|
|
|
+ if (!TextUtils.isEmpty(mAttachId)) {
|
|
|
+ mUpgradeButton.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ mUpgradeButton.setVisibility(View.GONE);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|