コード例 #1
0
  private void loadData() {
    showProgressDialog("加载行业标签");
    AsyncRequest.Builder buider = new Builder();
    buider.setModule(AsyncRequest.MODULE_INDUSTRYTAGS);
    Type responseType = new TypeToken<Response<List<IndustryTagGroupInfo>>>() {}.getType();
    buider.setResponseType(responseType);
    buider.setResponseListener(
        new Listener<Response<List<IndustryTagGroupInfo>>>() {

          @Override
          public void onErrorResponse(InvocationError arg0) {
            dismissDialog();
          }

          @Override
          public void onResponse(Response<List<IndustryTagGroupInfo>> arg0) {
            dismissDialog();
            if (arg0.getCode() == 0) {
              industryTagGroupInfoList = arg0.getPayload();
              industryAdapter.setIndustryTagGroupList(industryTagGroupInfoList);
              industryAdapter.notifyDataSetChanged();
              for (int i = 0; i < industryTagGroupInfoList.size(); i++) {
                industryListview.expandGroup(i);
              }
            } else {
              Toast.makeText(getApplicationContext(), arg0.getDescription(), Toast.LENGTH_LONG)
                  .show();
            }
          }
        });
    buider.build().get();
  }
コード例 #2
0
  private void updateData() {

    showProgressDialog("修改行业标签");
    AsyncRequest.Builder buider = new Builder();
    buider.setModule(AsyncRequest.MODULE_INDUSTRYTAGS);
    buider.setRequestBody(getSelctedIndustryTag());
    Type responseType = new TypeToken<Response<String>>() {}.getType();
    buider.setResponseType(responseType);
    buider.setResponseListener(
        new Listener<Response<String>>() {

          @Override
          public void onErrorResponse(InvocationError arg0) {
            dismissDialog();
          }

          @Override
          public void onResponse(Response<String> arg0) {
            dismissDialog();
            if (arg0.getCode() == 0) {
              toast("行业标签修改成功");
              setResult(RESULT_OK);
              finish();
            } else {
              toast("行业标签修改失败,请重新提交");
            }
          }
        });
    buider.build().put();
  }