@Override public View getView(int arg0, View convertView, ViewGroup arg2) { ChildViewHolder cvh = null; if (convertView == null) { convertView = LayoutInflater.from(getActivity()).inflate(R.layout.doc_list_item_message, null); cvh = new ChildViewHolder(convertView); convertView.setTag(cvh); } else { cvh = (ChildViewHolder) convertView.getTag(); } if (arg0 % 2 == 0) { convertView.setBackgroundResource(R.drawable.listview_001); } else { convertView.setBackgroundResource(R.drawable.listview_002); } DocMessageBean msg = messageList.get(arg0); if (msg.getIsRead().equals("1")) { cvh.imageIcon.setImageResource(R.drawable.icon_massge2); } else { cvh.imageIcon.setImageResource(R.drawable.icon_massge); } cvh.msgText.setText(msg.getMessage()); cvh.timeText.setText(msg.getPushTime()); return convertView; }
private void redirect(DocMessageBean msg) { boolean hit = false; DocumentListItem document = null; if (mDocList != null && mDocList.size() > 0) { for (DocumentListItem item : mDocList) { if (item.getDocumentId().equals(msg.getDocID())) { hit = true; document = item; break; } } } if (hit) { // 跳转公文详情 Intent intent = new Intent(); intent.putExtra(DocConstants.KEY_DOCUMENT_LIST_ITEM, document); intent.setClass(getActivity(), DocDetailActivity.class); getActivity().startActivity(intent); } else { if (isConsult(msg)) { DocUtils.requestGetConsultationFile(getActivity(), this, msg.getDocID()); } else { Intent intent = new Intent(getActivity(), DocTraceDetailActivity.class); intent.putExtra(DocConstants.KEY_COMMON_ID, msg.getDocID()); intent.putExtra(DocConstants.KEY_DOC_NAME, ""); getActivity().startActivity(intent); } } }
private boolean isConsult(DocMessageBean msg) { boolean ret = false; if (msg.getMsgType().equals("5")) { ret = true; } return ret; }
@Override public void onGetResult(DocAbstractRequest request) { DocGlobalVars.getInstance().dismissProgressDialog(); if (request instanceof DocSignForMessageCenterRequest) { DocMessageBean msg = ((DocSignForMessageCenterRequest) request).msg; String docId = msg.getDocID(); String decrptResult = request.getDecryptedResult(); if (DocStringUtils.isEmpty(decrptResult)) { return; } String replaceResult = decrptResult.replace("\n\\MobileOA", ""); replaceResult = replaceResult.replace("\\MobileOA", ""); replaceResult = DocProjectUtil.replacePoint(replaceResult); if (replaceResult.equals("NoData")) { // DocAndroidUtils.Alert(getActivity(), "温馨提示", "未查到任何数据", // "确定"); } else if (replaceResult.equals("Failed")) { // DocAndroidUtils.Alert(getActivity(), "温馨提示", "查询失败", "确定"); } else { String[] docs = replaceResult.split("\n"); Log.d("", docs.toString()); if (docs.length > 0) { if (mDocList != null) { mDocList.clear(); } else { mDocList = new ArrayList<DocumentListItem>(); } DocumentListItem document = null; String[] temparray = null; for (int i = 0; i < docs.length; i++) { try { document = new DocumentListItem(); document.setIsNewDoc(false); temparray = docs[i].split("\t"); if (temparray.length >= 5) { document.setDocumentId(temparray[0]); document.setLitmitTime(temparray[1]); document.setUrgencyLevel(temparray[2]); document.setDocumentTitle(DocProjectUtil.replacePoint(temparray[3])); document.setUniteSignType(temparray[4].replace("\r", "")); document.setUserId(temparray[5]); document.setUserName(temparray[6]); mDocList.add(document); } } catch (Exception e) { e.printStackTrace(); } } } } redirect(msg); } else if (request instanceof DocConsultationFileListRequest) { String docId = ((DocConsultationFileListRequest) request).docId; List<DocConsultationFile> list = ((DocConsultationFileListRequest) request).consultationFiles; if (list == null) { Toast.makeText(getActivity(), "无此公文信息", Toast.LENGTH_SHORT).show(); return; } DocConsultationFile cons = null; for (DocConsultationFile con : list) { if (docId.equals(con.getCniCommonPartId())) { cons = con; break; } } if (cons == null) { Toast.makeText(getActivity(), "无此公文信息", Toast.LENGTH_SHORT).show(); return; } else { Intent intent = new Intent(); intent.setClass(getActivity(), DocFeedbackActivity.class); intent.putExtra(DocConstants.KEY_CONSULTATION, cons); getActivity().startActivity(intent); } } }