/**
   * **********************************************
   *
   * @param r 设定文件
   * @return void 返回类型
   * @throws @Title: result @Description: (推荐房间返回)
   * @date 2014-11-19 ***********************************************
   */
  @InjectHttpOk(1)
  public void result(ResponseEntity r) {
    dismissDialog();
    switch (r.getStatus()) {
      case FastHttp.result_ok:
        ArrayList<HashMap<String, String>> list = null;
        try {
          // if (ResultParse.reservationIsResultOK(r, activity)) {
          String json = Handler_Json.getValue("list", r.getContentAsString()).toString();
          String s = Handler_Json.getValue("pageNo", r.getContentAsString()).toString();
          pageNo = Integer.valueOf(s) + 1;
          if (!"".equals(json)) { // 判断查询数据是否为空 ,
            list = Handler_Json.JsonToCollection(json);
            getList(list);
          } else { // 为空数据 初始化当前页数1 ,展示无数据图片
            // pageNo = 1;
            // dataList.clear();
            Toast.makeText(activity, "无数据", Toast.LENGTH_SHORT).show();
          }
          Ioc.getIoc().getLogger().i(" 完成 刷新");
          // }
        } catch (Exception e) {
          e.printStackTrace();
        }

        break;
      case FastHttp.result_net_err:
        Toast.makeText(activity, "请求错误", Toast.LENGTH_SHORT).show();
        break;
    }
    // 完成 加载更多
    PullToRefreshManager.getInstance().onFooterRefreshComplete();
    // 完成 刷新
    PullToRefreshManager.getInstance().onHeaderRefreshComplete();

    // 关闭顶部的下拉
    PullToRefreshManager.getInstance().headerUnable();
    // 打开顶部的下拉
    PullToRefreshManager.getInstance().headerEnable();
    // 关闭底部的加载
    PullToRefreshManager.getInstance().footerUnable();
    // 打开顶部的加载
    PullToRefreshManager.getInstance().footerEnable();
  }
 @InjectHttp
 private void imgListResult(ResponseEntity r) {
   Ioc.getIoc().getLogger().i("图片房间接口返回数据:【" + r + "】");
   switch (r.getStatus()) {
     case FastHttp.result_ok:
       if (ResultParse.isResultOK(r, this)) {
         ArrayList<HashMap<String, String>> list =
             (ArrayList<HashMap<String, String>>)
                 Handler_Json.JsonToCollection(r.getContentAsString());
         spa = new SamplePagerAdapter(this, list, R.layout.activity_img_page_item);
         mViewPager.setAdapter(spa);
       }
       break;
     case FastHttp.result_net_err:
       break;
     default:
       break;
   }
 }
  /**
   * **********************************************
   *
   * @param r 设定文件
   * @return void 返回类型
   * @throws @Title: fastResult @Description: (酒店楼宇接口 返回)
   * @date 2014-11-19 ***********************************************
   */
  @InjectHttpOk(value = {111})
  protected void fastResult(ResponseEntity r) {
    System.out.println(r.getStatus());
    switch (r.getStatus()) {
      case FastHttp.result_ok:
        if (ResultParse.reservationIsResultOK(r, activity)) {
          imgList = Handler_Json.JsonToCollection(r.getContentAsString());
          // InitFocusIndicatorContainer();
          // initGallery();
          ipaAdapter = new ImagePagerAdapter(activity, imgList, indicator_container);

          gallery_hotel.setAdapter(ipaAdapter);
          ipaAdapter.notifyDataSetChanged();
          gallery_hotel.setFocusable(true);
        }
        break;
      case FastHttp.result_net_err:
        Toast.makeText(activity, "网络异常 ,请检查您确保开启无线网络", Toast.LENGTH_SHORT).show();
        break;
    }
  }
Beispiel #4
0
  /**
   * *********************************************** @Title: success @Description: TODO(登录返回)
   *
   * @param entity 设定文件
   * @return void 返回类型
   * @throws
   * @date 2015-1-8 ***********************************************
   */
  @InjectHttpOk
  public void success(ResponseEntity entity) {
    Ioc.getIoc().getLogger().i("登录接口状态返回结果【" + entity.toString() + "】");

    // 获取头部信息
    Map<String, String> map = entity.getHeaders();

    // 登录成功 返回OK
    if (ResultParse.isResultOK(entity, this)) {
      // 获取返回内容 ticket
      String jsonString = entity.getContentAsString();

      Ioc.getIoc().getLogger().i("ticket数据【" + jsonString + "】");

      // 存放ticket
      MapVo.map = Handler_Json.JsonToCollection(jsonString); // 设置ticket
      // TODO
      MangrovePayApp.ticket = (String) MapVo.get("ticket");
      // 存储用户名密码到本地
      MangrovePayApp.app.setData("account", loginMap.get("account"));
      MangrovePayApp.app.setData("password", loginMap.get("password"));
      Ioc.getIoc().getLogger().i("登录成功");

      Intent intent = new Intent();
      intent.setClass(this, MainActivity.class);
      startActivity(intent);
      // startActivity(new Intent().setClass(this, CaptureActivity.class));
      this.finish();
    }
    // 登录失败
    else {
      Ioc.getIoc().getLogger().i("登录失败");
      Toast.makeText(this, "登录失败,请检查用户名密码是否正确", Toast.LENGTH_SHORT).show();
      dismissDialog();
    }
  }
Beispiel #5
0
  // 获取个人信息成功返回结果
  @InjectHttpOk({1, 13})
  public void resultOk(ResponseEntity r) {

    dismissDialog();
    // 获取个人信息成功 返回OK
    if (ResultParse.isResultOK(r, this)) {
      switch (r.getKey()) {
        case 1: // 获取个人信息
          personEntity = Handler_Json.JsonToBean(PersonalEntity.class, r.getContentAsString());
          personEntity.setId("2222");
          if (getPersonInfo() > 0) db.saveOrUpdate(personEntity);
          else db.save(personEntity);

          // 判断是否绑定手机,如果绑定手机,登陆的时候显示手机号,否则显示邮箱
          if (personEntity.getCallPhone() != null && !personEntity.getCallPhone().equals("")) {
            account_item_name.setText(personEntity.getCallPhone());
          } else {
            account_item_name.setText(personEntity.getEmail());
          }
          break;
        case 13: // 版本更新
          try {
            final Map<String, String> map = Handler_Json.JsonToCollection(r.getContentAsString());
            ////                       {
            //                        "name": "红树林管家",
            //                                "version": "10",
            //                                "changelog": "新版本更新\n1、增加新产品商城\n2、业态展示\n3、商品订单中心",
            //                                "updated_at": 1470668072,
            //                                "versionShort": "V 3.1.0",
            //                                "build": "10",
            //                                "installUrl":
            // "http://download.fir.im/v2/app/install/54c7076b64fa0433050049a8?download_token=1fbef156fe3a27ff2524cae445d06849",
            //                                "install_url":
            // "http://download.fir.im/v2/app/install/54c7076b64fa0433050049a8?download_token=1fbef156fe3a27ff2524cae445d06849",
            //                                "direct_install_url":
            // "http://download.fir.im/v2/app/install/54c7076b64fa0433050049a8?download_token=1fbef156fe3a27ff2524cae445d06849",
            //                                "update_url": "http://fir.im/mangrovetree",
            //                                "binary": {
            //                            "fsize": 60386833
            //                        }
            //                    }
            int version = Integer.valueOf(map.get("version"));
            Ioc.getIoc().getLogger().e(" 当前versionCode:" + Handler_System.getVersionCode(this));
            if (version > Handler_System.getVersionCode(this)) {
              onAlertVersion(map.get("changelog"), map.get("install_url"));
            }
          } catch (Exception e) {
          }
          break;
      }

      // 是否开通帐户余额,开通了获取余额值
      //            if(personEntity.getOpenBalance() == 1){
      //                internetConfig.setKey(3);
      //                //已开通余额帐户,取帐户余额
      //                FastHttpHander.ajaxString(Url.METHOD_MEMBERBALANCEINFO,new
      // JsonObject().toString(),internetConfig,this);
      //            }else{
      //                //设置帐户余额
      //                account_item_money.setText("未开通账户余额");
      //            }

    }
  }