コード例 #1
0
  private void getdata() {
    if (WebIsConnectUtil.showNetState(context)) {
      productsManager.GetProductsLeaveWords(
          ShoujiLeaveWordsListActivity.this, productid, page_down, "0");
      productsManager.getCommentInfoIml(
          new IGetCommentInfo() {
            @Override
            public void getCommentInfo(List<ProductCommentBean> productCommentBeans) {
              ListView actualListView = mPullRefreshListView.getRefreshableView();
              if (productCommentBeans != null) {
                mLinkedList.addAll(productCommentBeans);
                no_leavewords.setVisibility(View.GONE);

                MyUtlis.sortListProductCommentBeanOrder(mLinkedList);
                uptime = mLinkedList.get(0).getCtime();
                actualListView.setAdapter(mAdapter);
              } else {
                uptime = new String("11");
                actualListView.setAdapter(mAdapter);
              }
            }
          });
    }
    mPullRefreshListView.setOnRefreshListener(
        new OnRefreshListener2<ListView>() {

          @Override
          public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
            if (WebIsConnectUtil.showNetState(context)) {
              productsManager.GetProductsLeaveWords(
                  ShoujiLeaveWordsListActivity.this, productid, 1, uptime);
              productsManager.getCommentInfoIml(
                  new IGetCommentInfo() {
                    @Override
                    public void getCommentInfo(List<ProductCommentBean> productCommentBeans) {
                      if (productCommentBeans != null) {
                        for (ProductCommentBean productCommentBean : productCommentBeans) {
                          mLinkedList.addFirst(productCommentBean);
                        }
                        MyUtlis.sortListProductCommentBeanOrder(mLinkedList);
                        uptime = mLinkedList.get(0).getCtime();
                        mAdapter.notifyDataSetChanged();
                        mPullRefreshListView.onRefreshComplete();
                        no_leavewords.setVisibility(View.GONE);
                      } else {
                        mPullRefreshListView.onRefreshComplete();
                      }
                    }
                  });

            } else {
              mPullRefreshListView.onRefreshComplete();
            }
          }

          @Override
          public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            String label =
                DateUtils.formatDateTime(
                    getBaseContext(),
                    System.currentTimeMillis(),
                    DateUtils.FORMAT_SHOW_TIME
                        | DateUtils.FORMAT_SHOW_DATE
                        | DateUtils.FORMAT_ABBREV_ALL);
            refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
            if (WebIsConnectUtil.showNetState(context)) {
              productsManager.GetProductsLeaveWords(
                  ShoujiLeaveWordsListActivity.this, productid, page_up, "0");
              productsManager.getCommentInfoIml(
                  new IGetCommentInfo() {
                    @Override
                    public void getCommentInfo(List<ProductCommentBean> productCommentBeans) {
                      if (productCommentBeans != null) {
                        for (ProductCommentBean productCommentBean : productCommentBeans) {
                          mLinkedList.addLast(productCommentBean);
                        }
                        MyUtlis.sortListProductCommentBeanOrder(mLinkedList);
                        page_up++;
                        mAdapter.notifyDataSetChanged();
                        mPullRefreshListView.onRefreshComplete();
                      } else {
                        mPullRefreshListView.onRefreshComplete();
                      }
                    }
                  });

            } else {
              mPullRefreshListView.onRefreshComplete();
            }
          }
        });
  }
コード例 #2
0
  private void save2Server() {
    if (WebIsConnectUtil.showNetState(UserControlCommonActivity.this)) {

      String nickname = nicknameTextView.getText().toString();
      String phonenub = user_manager_tv_phonnumber.getText().toString();
      String net = user_manager_tv_net.getText().toString();
      final String pw = user_manager_alter_passwd_stub.getText().toString();
      String email = user_manager_tv_qq.getText().toString();
      String company = user_manager_tv_company.getText().toString();
      String address = user_manager_tv_address.getText().toString();
      String contact = user_manager_tv_name.getText().toString();
      String category = user_manager_category_stub.getText().toString();

      String[] array = (String[]) mList.toArray(new String[mList.size()]);
      Map<String, String> params = new HashMap<String, String>();

      String uid = dbUserManager.getLogingUserInfo().getUid();
      if (uid == null) {
        Toast.makeText(context, "保存用户失败", Toast.LENGTH_LONG).show();
        return;
      }
      if (!uid.equals("") && !uid.equals("null")) {
        params.put("uid", dbUserManager.getLogingUserInfo().getUid());
      } else {
        Toast.makeText(context, "保存用户失败", Toast.LENGTH_LONG).show();
        return;
      }
      params.put("subject", "edit");
      params.put("data[category]", category);
      params.put("data[nickname]", nickname);
      params.put("data[contact]", contact);
      if (pwchange) {
        params.put("data[pw]", pw);
      }
      params.put("data[phonenub]", phonenub);
      params.put("data[email]", email);
      params.put("data[company]", company);
      params.put("data[address]", address);
      params.put("data[net]", net);
      Log.i("print", "params--------->" + params.toString());
      HttpMultipartPost task = new HttpMultipartPost(context, MyConstants.LOGIN_URL, array, params);
      task.execute();
      task.getBackInfoIml(
          new IUploadBackInfo() {

            @Override
            public void getBackAttactInfo(String json) {

              AllBean allBean = JsonParse.parseUserJson(json);
              if (allBean != null && allBean.getStatus().equals("true")) {
                Log.i("print", "userbing--------->" + allBean.toString());
                System.out.println("修改用户信息成功");
                if (fromqq) { // 如果是从qq那边过来的,将保存设置未已经保存
                  isSave = true;
                }
                // 更新登录信息
                LoginUserBean loginUserBean = new LoginUserBean();
                loginUserBean.setPassword(pw);
                loginUserBean.setUsername(user_manager_alter_count.getText().toString());
                loginUserBean.setUsertype("0");
                loginUserBean.setLastlogin("1");
                loginUserBean.setStatus("1");

                dbLoginManager.updateByUserNameAndUserType(loginUserBean);
                System.out.println("更新用户信息");
                // 更新用户信息
                //							UserInfoBean userInfoBean = new UserInfoBean();
                UserInfoBean userInfoBean = allBean.getInfo();
                userInfoBean.setNickname(allBean.getInfo().getNickname());
                //							userInfoBean.setUsername(user_manager_alter_count.getText().toString());
                if (pwchange) {
                  userInfoBean.setPassword(pw);
                }
                //							userInfoBean.setContact( allBean.getInfo()
                //									.getContact());
                //							userInfoBean.setPhonenub(allBean.getInfo().getPhonenub());
                //							userInfoBean.setEmail(allBean.getInfo().getEmail());
                //							userInfoBean.setCompany(allBean.getInfo().getCompany());
                //							userInfoBean.setAddress(allBean.getInfo().getAddress());
                //							userInfoBean.setNet(allBean.getInfo().getNet());
                userInfoBean.setHeadurl(MyConstants.PICTURE_URL + allBean.getInfo().getHeadurl());
                //							userInfoBean.setCategory(allBean.getInfo().getCategory());
                userInfoBean.setUsertype("0");
                userInfoBean.setStatus("1");

                dbUserManager.insertData(userInfoBean);
                System.out.println("更新登录信息");
              }
              if (allBean != null && allBean.getMsg() != null) {
                MyUtlis.toastInfo(getBaseContext(), allBean.getMsg());
              }
            }
          });
    }
  }