示例#1
0
    @Override
    protected void onPostExecute(String json) {
      super.onPostExecute(json);
      viewRefreshMessage.onHeaderRefreshComplete();
      dismissProgress();
      if (json == null) {
        showFail();
      } else {
        JsonAnalyse analyse = new JsonAnalyse();
        String status = analyse.getStatus(json);
        if (status.equals("200")) {
          if (isRefresh) {
            titleData.clear();
            messageData.clear();
            isRefresh = false;
          }

          messageListView.setVisibility(View.VISIBLE);

          String data = analyse.getData(json, "response_data");
          if (data.equals("[]") == false) {
            int lastSize = titleData.size();
            messageResponseData(data);
            int preSize = titleData.size();
            if (preSize - lastSize < 10) {
              messageListView.loadNoMoreData();
            } else {
              messageListView.readyToLoad();
            }
            pageMessage++;
            messageAdapter.notifyDataSetChanged();
          } else {
            showNoData();
          }
        } else if (status.equals("302")) {
          OperateInfUtils.clearSessionId(MessageCenter.this);
          showLoginAgainDialog(getResources().getString(R.string.login_timeout));
        } else if (status.equals("304")) {
          OperateInfUtils.clearSessionId(MessageCenter.this);
          showLoginAgainDialog(getResources().getString(R.string.login_again));
        } else {
          showFail();
        }
      }
    }
示例#2
0
    @Override
    protected void onPostExecute(String json) {
      super.onPostExecute(json);
      viewRefreshNotice.onHeaderRefreshComplete();
      dismissProgress();

      if (json != null) {
        JsonAnalyse analyse = new JsonAnalyse();
        String status = analyse.getStatus(json);
        if (status.equals("200")) {
          if (isRefresh) {
            noticeData.clear();
            isRefresh = false;
          }
          String response_data = analyse.getData(json, "response_data");
          JSONArray jsonArray = null;
          try {
            jsonArray = new JSONArray(response_data);
          } catch (JSONException e) {
            e.printStackTrace();
          }
          if (response_data.equals("[]") == false) {
            int lastSize = noticeData.size();
            noticeListResponseData(jsonArray);
            int preSize = noticeData.size();
            if (preSize - lastSize < 10) {
              noticeListView.loadNoMoreData();
            } else {
              noticeListView.readyToLoad();
            }
            pageNotice++;
            noticeAdapter.notifyDataSetChanged();

            noticeListView.setVisibility(View.VISIBLE);
          } else {
            showNoData();
          }
        } else {
          showFail();
        }
      } else {
        showFail();
      }
    }