Exemple #1
0
      @Override
      public void run() {
        // 检测更新
        Update update = new Update();
        update.start();

        Message msg = new Message();
        try {
          update.join();
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
        if (DownloadKey.version == null) {
          Log.i("UpdateFun TAG", "获取的应用信息为空,不更新,请确认网络是否畅通或者应用ID及API_TOKEN是否正确");
          msg.arg1 = 2;
          up_handler.sendMessage(msg);
        } else if (Integer.valueOf(DownloadKey.versioncode)
            > Handler_System.getVersionCode(MainActivity.this)) {
          Log.i("UpdateFun TAG", "需更新版本");
          msg.arg1 = 1;
          up_handler.sendMessage(msg);
        } else {
          Log.i("UpdateFun TAG", "版本已是最新");
          msg.arg1 = 2;
          up_handler.sendMessage(msg);
        }
      }
 /**
  * Set the target image width and height.
  *
  * @param width
  * @param height
  */
 public void setImageSize(int width, int height) {
   HashMap<String, Integer> data = Handler_System.getDisplayMetrics();
   if (width == 0) {
     width = data.get(Handler_System.systemWidth);
   }
   if (height == 0) {
     height = data.get(Handler_System.systemHeight);
   }
   mImageWidth = width;
   mImageHeight = height;
 }
Exemple #3
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("未开通账户余额");
      //            }

    }
  }