Jelajahi Sumber

[컨텐츠][New] 상세 - 디스크립션 스트링 파싱 처리
- \n\n 으로 구분(split)해서 처리

hyodong.min 7 tahun lalu
induk
melakukan
a059cf39ae

+ 1 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/bean/api/ContentsDescriptionBean.java

@@ -6,7 +6,6 @@ package kr.co.zumo.app.lifeplus.bean.api;
 import com.google.gson.annotations.SerializedName;
 
 import kr.co.zumo.app.lifeplus.bean.JsonBeanBase;
-import kr.co.zumo.app.lifeplus.util.StringUtil;
 
 /**
  * ContentsDescriptionBean
@@ -33,7 +32,7 @@ public class ContentsDescriptionBean extends JsonBeanBase {
   }
 
   public String getDescription() {
-    return StringUtil.stripHtml(description);
+    return description; //StringUtil.stripHtml(description);
   }
 
   public void setDescription(String description) {

+ 20 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/contents/ContentsListicleHolder.java

@@ -4,6 +4,7 @@ import android.support.constraint.ConstraintLayout;
 import android.view.View;
 import android.widget.LinearLayout;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import kr.co.zumo.app.R;
@@ -52,6 +53,25 @@ public class ContentsListicleHolder extends ContentsHolder<ContentsItemBean> {
     if (null != layoutContainer) {
       layoutContainer.removeAllViews();
     }
+    if (null != bean.getDescriptionList() && bean.getDescriptionList().size() > 0) {
+      // 첫 번째 항목에 모든 데이터가 들어있다.
+      List<ContentsDescriptionBean> list = new ArrayList<>();
+      ContentsDescriptionBean descriptionBean = bean.getDescriptionList().get(0);
+      if (null != descriptionBean) {
+        String description = descriptionBean.getDescription();
+
+        // "ㄹㅇㄴㅁㄹㅇㄴ\nㄹㅇㄴㅁㄹㅇ\n\nㄹㅇㄴㅁ\n\nㄹㅇㄴㅁ\n\n\nㄹㅇㄴㅁㄹㅇ"
+        String[] strs = description.split("\n\n");
+        int len = strs.length;
+        for (int i = 0; i < len; ++i) {
+          ContentsDescriptionBean contentsDescriptionBean = new ContentsDescriptionBean();
+          contentsDescriptionBean.setDescription(strs[i]);
+          list.add(contentsDescriptionBean);
+        }
+
+        bean.setDescriptionList(list);
+      }                                                                                                                                                                                                                                                            
+    }
 
     for (int i = 0; i < bean.getDescriptionList().size(); i++) {
       ContentsDescriptionBean contentsDescriptionBean = bean.getDescriptionList().get(i);