private List<MessageArticlePageInfo> convertJSobjToList( JSONObject rowMap, JSONObject userInfoMap, int page) { List<MessageArticlePageInfo> __R = new ArrayList<MessageArticlePageInfo>(); if (rowMap == null) return null; JSONObject rowObj = (JSONObject) rowMap.get("0"); for (int i = 1; rowObj != null; i++) { MessageArticlePageInfo row = new MessageArticlePageInfo(); row.setContent(rowObj.getString("content")); row.setLou(20 * (page - 1) + i); row.setSubject(rowObj.getString("subject")); int time = rowObj.getIntValue("time"); if (time > 0) { row.setTime(StringUtil.TimeStamp2Date(String.valueOf(time))); } else { row.setTime(""); } row.setFrom(rowObj.getString("from")); fillUserInfo(row, userInfoMap); fillFormated_html_data(row, i); __R.add(row); rowObj = (JSONObject) rowMap.get(String.valueOf(i)); } return __R; }
private void fillFormated_html_data(MessageArticlePageInfo row, int i) { ThemeManager theme = ThemeManager.getInstance(); if (row.getContent() == null) { row.setContent(row.getSubject()); row.setSubject(null); } int bgColor = context.getResources().getColor(theme.getBackgroundColor(i)); int fgColor = context.getResources().getColor(theme.getForegroundColor()); bgColor = bgColor & 0xffffff; final String bgcolorStr = String.format("%06x", bgColor); int htmlfgColor = fgColor & 0xffffff; final String fgColorStr = String.format("%06x", htmlfgColor); String formated_html_data = MessageDetialAdapter.convertToHtmlText( row, isShowImage(), showImageQuality(), fgColorStr, bgcolorStr); row.setFormated_html_data(formated_html_data); }
private void fillUserInfo(MessageArticlePageInfo row, JSONObject userInfoMap) { JSONObject userInfo = (JSONObject) userInfoMap.get(row.getFrom()); if (userInfo == null) { return; } row.setAuthor(userInfo.getString("username")); row.setJs_escap_avatar(userInfo.getString("avatar")); row.setYz(userInfo.getString("yz")); row.setMute_time(userInfo.getString("mute_time")); row.setSignature(userInfo.getString("signature")); }