|
|
@@ -118,48 +118,93 @@ public class LifeplusContentsBean extends JsonBeanBase {
|
|
|
this.pageIndex = pageIndex;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Web View 에서 표시할 url
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public String getContentsUrlWithParam() {
|
|
|
return contentsUrl + "?itemNo=" + itemNumber + "&headerVisible=n";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 공유 형식에 맞게 변형된 contents url
|
|
|
+ *
|
|
|
+ * @param pageIndex
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public String getContentsUrlWithParamForShare(int pageIndex) {
|
|
|
return contentsUrl + "?itemNo=" + itemNumber + "&headerVisible=y" + "&visiblePage=" + String.valueOf(pageIndex);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 좌우 공백 및 개행 문자, 이중 공백 등 제거된 title
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public String getTitleWithTrim() {
|
|
|
return trim(title);
|
|
|
}
|
|
|
|
|
|
private String trim(String str) {
|
|
|
- return StringUtil.isEmpty(str) ? "" : str.trim().replace("\n", " ").replace(" \n", " ").replace("\n ", " ");
|
|
|
+ return StringUtil.isEmpty(str) ? "" : str.trim().replace("\n", " ").replace(" ", " ");
|
|
|
}
|
|
|
|
|
|
- public String getSubtitleWithTrim() {
|
|
|
+ /**
|
|
|
+ * 좌우 공백 및 개행 문자, 이중 공백 등 제거된 sub title
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getSubTitleWithTrim() {
|
|
|
return trim(subTitle);
|
|
|
}
|
|
|
|
|
|
+// public String getSubTitleForWordWrap() {
|
|
|
+ // 워드랩을 방해하는 특수 문자
|
|
|
+// return subTitle.replace("\u00A0", " ");
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 2줄로 개행한 타이틀
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public String getTwoLineTitle() {
|
|
|
// 타이틀 줄바꿈이 사라져서 강제로 줄바꿈 해줌
|
|
|
String twoLineTitle = this.title;
|
|
|
+
|
|
|
+ // \\n 문자를 줄바꿈 문자로 변경
|
|
|
+ twoLineTitle = twoLineTitle.replaceAll("\\\\n", "\n");
|
|
|
+
|
|
|
+ // 줄바꿈이 있으면 그대로 전달
|
|
|
if (twoLineTitle.contains("\n")) {
|
|
|
return twoLineTitle;
|
|
|
}
|
|
|
else {
|
|
|
-// twoLineTitle = twoLineTitle.replace("\n", " ").replace(" ", " ");
|
|
|
String[] titles = twoLineTitle.split(" ");
|
|
|
int len = titles.length;
|
|
|
- int target = len > 5 ? 2 : 1;
|
|
|
+ // 줄바꿈 위치 지정 6단어 이상이면 4번째부터, 그 이하는 3번째 단어에서 줄바꿈 해줌
|
|
|
+ int target = len > 5 ? 3 : 2;
|
|
|
+ // 줄바꿈 할 위치보다 단어가 적으면 하지 않음
|
|
|
+ if (target >= len) {
|
|
|
+ target = -1;
|
|
|
+ }
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
- stringBuilder.append(titles[i]).append(" ");
|
|
|
if (i == target) {
|
|
|
stringBuilder.append("\n");
|
|
|
}
|
|
|
+ stringBuilder.append(titles[i]).append(" ");
|
|
|
}
|
|
|
return stringBuilder.toString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * clone
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public LifeplusContentsBean clone() {
|
|
|
LifeplusContentsBean bean = new LifeplusContentsBean();
|
|
|
bean.setItemNumber(getItemNumber());
|