Просмотр исходного кода

游戏信息扩展字段结构变化,所以解析也做相应变化

zengjiebin лет назад: 7
Родитель
Сommit
099b424386

+ 36 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/AppInfoExtDetail.java

@@ -0,0 +1,36 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by realicing on 2018/11/15.
+ * realicing@sina.com
+ * 游戏信息中的扩展字段
+ */
+public class AppInfoExtDetail {
+    private String title;
+    private String kay;
+    private String value;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getKay() {
+        return kay;
+    }
+
+    public void setKay(String kay) {
+        this.kay = kay;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

+ 6 - 4
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtGcGameAppDetail.java

@@ -7,11 +7,13 @@ import android.text.TextUtils;
 import android.view.View;
 import android.widget.TextView;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
 import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
 import com.sheep.gamegroup.absBase.BaseRefreshLoadMoreFragment;
 import com.sheep.gamegroup.helper.ImageListHelper;
+import com.sheep.gamegroup.model.entity.AppInfoExtDetail;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.Entry;
 import com.sheep.gamegroup.model.entity.Applications;
@@ -134,11 +136,11 @@ public class FgtGcGameAppDetail extends BaseRefreshLoadMoreFragment implements A
 
         if(gameApp.getExt_detail() != null) {
             try {
-                JSONObject jsonObject = JSONObject.parseObject(gameApp.getExt_detail());
-                if (jsonObject != null) {
-                    for (Map.Entry<String, Object> item : jsonObject.entrySet()) {
+                List<AppInfoExtDetail> list = JSONObject.parseArray(gameApp.getExt_detail(), AppInfoExtDetail.class);
+                if (!ListUtil.isEmpty(list)) {
+                    for (AppInfoExtDetail item : list) {
                         try {
-                            entryList.add(new Entry<>(item.getKey(), item.getValue().toString()));
+                            entryList.add(new Entry<>(item.getTitle(), item.getValue()));
                         } catch (Exception e) {
                             e.printStackTrace();
                             if(TestUtil.isDev())