コード例 #1
0
    @Override
    protected Object doInBackground(String... params) {
      type = params[0];
      page = Integer.valueOf(params[1]);
      try {
        DocNotEncrySoapBody soap = new DocNotEncrySoapBody();
        soap.setMethod("getPushHistoryByIsRead");
        soap.putValues("account", DocGlobalVars.getInstance().me.name);
        soap.putValues("isRead", params[0]);
        soap.putValues("pageIndex", params[1]);
        soap.putValues("pageSize", "20");
        String xmlString =
            DocHttpUtils.getInst()
                .getStringBySoap(
                    getActivity(),
                    DocGlobalVars.getInstance().URL_DOC_MESSAGE_CENTER_SETTING,
                    soap,
                    "utf-8");

        if (xmlString == null) {
          return null;
        }
        Log.d("", xmlString);

        ArrayList<DocMessageBean> messageBeans = DocPushMessageParser.parser(xmlString);

        return messageBeans;

      } catch (DocErrorMsg e) {
        e.printStackTrace();
      }
      return null;
    }
コード例 #2
0
 private void requestDocList(DocMessageBean msg) {
   DocGlobalVars.getInstance().showProgressDialog(getActivity(), "进度提示", "下载数据中,请耐心等待...");
   DocSignForMessageCenterRequest request =
       new DocSignForMessageCenterRequest(
           "doc.zip",
           DocGlobalVars.getInstance().me.name,
           DocGlobalVars.getInstance().me.pwd,
           msg);
   new DocStreamToStringAsyncTask(getActivity(), this, request.fileName).execute(request);
 }
コード例 #3
0
    @Override
    protected void onPostExecute(Object result) {
      super.onPostExecute(result);
      DocGlobalVars.getInstance().dismissProgressDialog();
      listView.onRefreshComplete();

      if (result != null) {
        ArrayList<DocMessageBean> messageBeans = (ArrayList<DocMessageBean>) result;
        if (page == 0) {
          if (type.equals("1")) {
            mLeftList.clear();
            mLeftList.addAll(messageBeans);
            listView.setAdapter(new MessageAdapter(mLeftList));
          } else {
            mRightList.clear();
            mRightList.addAll(messageBeans);
            listView.setAdapter(new MessageAdapter(mRightList));
          }
        } else if (page == curPage + 1) {
          curPage = page;
          if (type.equals("1")) {
            mLeftList.addAll(messageBeans);
          } else {
            mRightList.addAll(messageBeans);
          }
          adapter.notifyDataSetChanged();
        }
      } else {
        Toast.makeText(getActivity(), "获取消息失败!", Toast.LENGTH_SHORT).show();
      }
    }
コード例 #4
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mRootView == null) {
      mRootView = inflater.inflate(R.layout.doc_fragment_message, container, false);
      curPage = 0;
      initViews(mRootView);
    } else {
      ((ViewGroup) mRootView.getParent()).removeView(mRootView);
    }
    if (DocGlobalVars.getInstance().me != null) {
      // // 每次请求。
      // DocGlobalVars.getInstance().showProgressDialog(getActivity(), "",
      // "正在获取消息,请稍后...");
      // // new GetAccountPushHistoryTask().execute();
      // new GetAccountPushHistoryByIsReadTask().execute("1");
    } else {
      DocUtils.verifyLoginState(getActivity());
    }

    return mRootView;
  }
コード例 #5
0
    @Override
    protected Object doInBackground(String... params) {

      try {
        if (getActivity() == null) {
          return null;
        }
        DocNotEncrySoapBody soap = new DocNotEncrySoapBody();
        soap.setMethod("readMessageById");
        soap.putValues("id", params[0]);
        String xmlString =
            DocHttpUtils.getInst()
                .getStringBySoap(
                    getActivity(), DocGlobalVars.getInstance().URL_SETTING, soap, "utf-8");

        if (xmlString != null) {
          Log.d("", xmlString);
        }

      } catch (DocErrorMsg e) {
        e.printStackTrace();
      }
      return null;
    }
コード例 #6
0
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   DocGlobalVars.getInstance().showProgressDialog(getActivity(), "进度提示", "加载中,请耐心等待...");
 }
コード例 #7
0
 @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);
     }
   }
 }