コード例 #1
0
 @Override
 protected void callBackForServerSuccess(int taskID, XtomNetTask netTask, BaseResult result) {
   switch (netTask.getId()) {
     case TaskConstant.GET_ACCOUNT_DETAIL:
       @SuppressWarnings("unchecked")
       MResult<AccountDetailInfor> base = (MResult<AccountDetailInfor>) result;
       layout.refreshSuccess();
       infor = base.getObjects().get(0);
       mClient.insertOrUpdate(infor);
       managedata();
       break;
     case TaskConstant.ADD_WITHDRAW:
       XtomToastUtil.showShortToast(mContext, result.getMsg());
       switch (result.getStatus()) {
         case ServiceConstant.STATUS_SUCCESS:
           XtomToastUtil.showShortToast(mContext, result.getMsg());
           finish();
           break;
         case ServiceConstant.STATUS_FAILED:
           XtomToastUtil.showShortToast(mContext, result.getMsg());
           break;
       }
       break;
   }
   super.callBackForServerSuccess(taskID, netTask, result);
 }
コード例 #2
0
 @Override
 protected void callBackForServerSuccess(int taskID, XtomNetTask netTask, BaseResult result) {
   switch (taskID) {
     case TaskConstant.ADD_SUGGESTION:
       switch (result.getStatus()) {
         case ServiceConstant.STATUS_SUCCESS:
           XtomToastUtil.showShortToast(mContext, result.getMsg());
           finish();
           break;
         case ServiceConstant.STATUS_FAILED:
           XtomToastUtil.showShortToast(mContext, result.getMsg());
           break;
       }
       break;
   }
   super.callBackForServerSuccess(taskID, netTask, result);
 }
コード例 #3
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   setContentView(R.layout.activity_projectaccountdetail);
   super.onCreate(savedInstanceState);
   mClient = ProjectAccount_Detail_DBClient.get(mContext);
   if (mClient.isExist(pid)) getDataFromCache();
   else {
     if (hasNetWork()) getDetailInfor();
     else {
       XtomToastUtil.showShortToast(mContext, R.string.nonetwork);
       return;
     }
   }
 }
コード例 #4
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   setContentView(R.layout.activity_projectaccount);
   super.onCreate(savedInstanceState);
   mClient = ProjectAccount_DBClient.get(mContext);
   if (!mClient.isEmpty()) getDataFromCache();
   else {
     if (hasNetWork()) getInfor(0, "刷新");
     else {
       layout.setVisibility(View.VISIBLE);
       progressBar.setVisibility(View.GONE);
       adapter = new ProjectAccountAdapter(mContext, this.infors);
       adapter.setEmptyString(getEmptyString());
       mListView.setAdapter(adapter);
       XtomToastUtil.showShortToast(mContext, R.string.nonetwork);
       return;
     }
   }
 }
コード例 #5
0
 @Override
 protected void callBackForServerSuccess(int taskID, XtomNetTask task, BaseResult result) {
   switch (taskID) {
     case TaskConstant.GET_ACCOUNT_LIST:
       @SuppressWarnings("unchecked")
       MResult<AccountListInfor> base = (MResult<AccountListInfor>) result;
       ArrayList<AccountListInfor> users = base.getObjects();
       if ("刷新".equals(task.getDescription())) {
         layout.refreshSuccess();
         this.infors.clear();
         this.infors.addAll(users);
         if (infors.size() > 0) mClient.clear(SysCache.getUser().getUid());
         mClient.insertOrUpdate(infors);
         if (users.size() >= Integer.parseInt(SysCache.getSysInfo().getSys_pagesize())) {
           layout.setLoadmoreable(true);
         } else {
           layout.setLoadmoreable(false);
         }
       }
       if ("加载".equals(task.getDescription())) {
         layout.loadmoreSuccess();
         if (users.size() > 0) {
           this.infors.addAll(users);
         } else {
           layout.setLoadmoreable(false);
           XtomToastUtil.showShortToast(this, "已经到最后啦");
         }
       }
       if (adapter == null) {
         adapter = new ProjectAccountAdapter(mContext, this.infors);
         adapter.setEmptyString(getEmptyString());
         mListView.setAdapter(adapter);
       } else {
         adapter.setEmptyString(getEmptyString());
         adapter.notifyDataSetChanged();
       }
       break;
     default:
       break;
   }
 }
コード例 #6
0
  private void save() {
    String suggestion = editText.getText().toString();
    String value = suggestion.replace(" ", "");
    if (isNull(value)) {
      XtomToastUtil.showShortToast(mContext, "反馈意见不能为空,请重新填写");
      return;
    }

    HashMap<String, String> params = new HashMap<String, String>();
    params.put("token", SysCache.getUser().getToken());
    params.put("nickname", SysCache.getUser().getNickname());
    params.put("content", suggestion);

    RequestInformation infor = RequestInformation.ADD_SUGGESTION;
    getDataFromServer(
        new XtomNetTask(infor.getTaskID(), infor.getUrlPath(), params) {

          @Override
          public Object parse(JSONObject jsonObject) throws DataParseException {
            return new BaseResult(jsonObject);
          }
        });
  }