Esempio n. 1
0
  /** 验证是否check im */
  private void requestGetContact() {
    if (getMyApplication().isCheckIm) {
      requestContact();
      return;
    }
    RequestHelper.checkIm(
        this,
        new IResponseListener() {

          @Override
          public void onSuccess(Object o) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onReqStart() {
            // TODO Auto-generated method stub

          }

          @Override
          public void onFinish() {
            // TODO Auto-generated method stub
            getMyApplication().isCheckIm = true;
            requestContact();
          }

          @Override
          public void onFailure(Object o) {
            // TODO Auto-generated method stub

          }
        });
  }
Esempio n. 2
0
  private void requestContact() {

    if (isRefresh) {
      pageNum = 1;
    }

    Map<String, Object> params = new LinkedHashMap<String, Object>();
    params.put("page", pageNum++ + "");
    params.put("count", count + "");
    if (!StringUtils.isEmpty(fromUid)) {
      params.put("uid", fromUid);
    }

    RequestHelper.requestGetFans(
        this,
        params,
        page,
        new IResponseListener() {

          @Override
          public void onSuccess(Object o) {
            // TODO Auto-generated method stub
            fansBean = (FansBean) o;
            final LinkedList<FansData> list = fansBean.data.userlist;

            if (list != null && list.size() > 0) {
              if (isRefresh) {
                if (list.size() < 10) {
                  listview.setIsLoadFull(true);
                } else {
                  listview.setIsLoadFull(false);
                }

                adapter.clear();
                adapter.addAll(list);
                if (StringUtils.isEmpty(fromUid)) {

                  new Thread(
                          new Runnable() {

                            @Override
                            public void run() {
                              // TODO Auto-generated method stub
                              db.deleteByWhere(FansDao.class, "type=" + page + " and uid = " + uid);
                              FansDao dao = null;
                              for (FansData item : list) {
                                dao = new FansDao();
                                dao.setJson(gson.toJson(item));
                                dao.setType(page);
                                dao.setUid(uid);
                                db.save(dao);
                              }
                            }
                          })
                      .start();
                }
              } else {
                if (list.size() < 10) {
                  listview.setIsLoadFull(true);
                } else {
                  listview.setIsLoadFull(false);
                }
                adapter.addAll(list);
              }
              adapter.notifyDataSetChanged();
            }
          }

          @Override
          public void onReqStart() {
            // TODO Auto-generated method stub

          }

          @Override
          public void onFinish() {
            // TODO Auto-generated method stub
            listview.finishRefresh();
            listview.finishLoadMore();
          }

          @Override
          public void onFailure(Object o) {
            // TODO Auto-generated method stub

          }
        });
  }