Ejemplo n.º 1
0
 @Override
 public boolean onKey(View v, int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_ENTER) {
     switch (event.getAction()) {
       case KeyEvent.ACTION_UP: // 键盘松开
         presenter.loadDetailCargo(customerId, unRemoveEt.getText().toString());
         unRemoveEt.requestFocus();
         break;
       case KeyEvent.ACTION_DOWN: // 键盘按下
         break;
     }
     return true;
   }
   return false;
 }
 /** @Description: 发布闲置物品 */
 private void sendSecondHand() {
   title = titleET.getText().toString();
   type = typeSp.getText().toString();
   price = priceET.getText().toString();
   describe = describeET.getText().toString();
   bargain = bargainSp.getText().toString();
   qq = qqET.getText().toString();
   phone = phoneET.getText().toString();
   if (null == title || "".equals(title)) {
     ToastUtils.showToast("请输入标题~");
     openLinearLayoutByNull(false);
     titleET.requestFocus();
     return;
   }
   if (null == type || "".equals(type)) {
     openLinearLayoutByNull(false);
     ToastUtils.showToast("请选择类型~");
     return;
   }
   if (null == price || "".equals(price)) {
     openLinearLayoutByNull(false);
     ToastUtils.showToast("请输入价格~");
     priceET.requestFocus();
     return;
   }
   if (null == describe || "".equals(describe)) {
     openLinearLayoutByNull(false);
     ToastUtils.showToast("请输入详细描述~");
     describeET.requestFocus();
     return;
   }
   if (null == bargain || "".equals(bargain)) {
     openLinearLayoutByNull(true);
     ToastUtils.showToast("请选择可否议价~");
     return;
   }
   if ((null == qq || "".equals(qq)) && (null == phone || "".equals(phone))) {
     ToastUtils.showToast("请输入联系qq或号码其中一种~");
     openLinearLayoutByNull(true);
     if ((null == qq || "".equals(qq))) {
       qqET.requestFocus();
     } else {
       phoneET.requestFocus();
     }
     return;
   }
   if (!"".equals(phone) && !VerifyUtils.checkPhone(phone)) {
     ToastUtils.showToast("请输入正确的联系号码格式~");
     openLinearLayoutByNull(true);
     phoneET.requestFocus();
     return;
   }
   send();
 }
Ejemplo n.º 3
0
  private void initView() {
    context = (BaseActivity) getActivity();
    imgLeftCorner = (ImageView) ret.findViewById(R.id.img_left_corner);
    et_searchkey = (MaterialEditText) ret.findViewById(R.id.et_searchkey);
    mListView = (XListView) ret.findViewById(R.id.list_search_fans);
    mListView.setPullRefreshEnable(false);
    mListView.setPullLoadEnable(false);
    mNoContentHint = (TextView) ret.findViewById(R.id.no_content_hint);

    imgLeftCorner.setOnClickListener(this);
    mListView.setOnItemClickListener(this);
    et_searchkey.addTextChangedListener(this);

    et_searchkey.setFocusable(true);
    et_searchkey.setFocusableInTouchMode(true);
    et_searchkey.requestFocus();

    adapter = new SearchAdapter(context, R.layout.item_group_member2, cursor);
    mListView.setAdapter(adapter);
  }
  /** @Description: 按键监听 */
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.top_back_btn:
        { // 返回
          finish();
          break;
        }
      case R.id.set_alimony_commit_btn:
        { // 提交
          String content = alimonyET.getText().toString().replace(" ", "");
          if (VerifyUtils.isDigit(content)) {
            dialog.show();
            Integer alimony = Integer.parseInt(content);
            GlobalParams.userInfo.setAlimony(alimony);
            GlobalParams.userInfo.update(
                this,
                new UpdateListener() {

                  @Override
                  public void onSuccess() { // 成功
                    LogcatUtils.i("设置生活费指标成功");
                    dialog.dismiss();
                    setResult(CommonConstant.RESULTCODE_SET_ALIMONY_SUCCESS);
                    finish();
                  }

                  @Override
                  public void onFailure(int code, String message) { // 失败
                    LogcatUtils.e("设置生活费指标失败:" + code + " " + message);
                    dialog.dismiss();
                    GlobalParams.userInfo.setAlimony(alimonyLast);
                    switch (code) {
                      case 9010:
                        { // 网络超时
                          ToastUtils.showToast("网络超时,请检查您的手机网络~");
                          break;
                        }
                      case 9016:
                        { // 无网络连接,请检查您的手机网络
                          ToastUtils.showToast("无网络连接,请检查您的手机网络~");
                          break;
                        }
                      default:
                        {
                          ToastUtils.showToast("提交失败,请重试~");
                          break;
                        }
                    }
                  }
                });
          } else {
            ToastUtils.showToast("请输入整数~");
            alimonyET.requestFocus();
          }
          break;
        }
      default:
        break;
    }
  }