示例#1
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.ps_back:
        hideSoftPad();
        close();
        break;
      case R.id.ps_search_delete:
        input.setText("");
        break;
      case R.id.search:
        String s = input.getText().toString();
        boolean isValid = isKeyWordValid(s);
        if (isValid) {
          hideSoftPad();
          mKeyWord = s;
          searchList.clear();
          search(0, LIST_COUNT, s, tempList, false);
        } else {
          DialogUtil.alertToast(getApplicationContext(), "请先输入关键字");
        }
        break;

      default:
        break;
    }
  }
示例#2
0
 @Override
 public void onNetEnd(int code, String msg, String method, boolean isLoadMore) {
   if (Constants.searchProgram.equals(method)) {
     switch (code) {
       case Constants.requestErr:
       case Constants.fail_no_net:
       case Constants.fail_server_err:
       case Constants.parseErr:
         if (!isLoadMore) {
           hideSearchResltLayout();
         }
         DialogUtil.alertToast(getApplicationContext(), "搜索失败");
         break;
       case Constants.sucess:
         if (isLoadMore) {
           showSearchResultLayout();
         }
         hidMErrorLayout();
         updateSearchList(isLoadMore);
         break;
       default:
         break;
     }
     searchTask = null;
   }
 }