Esempio n. 1
0
File: App.java Progetto: ndong211/bo
  public BMapManager initBMapManager() {
    if (mBMapManager == null) {
      mBMapInstanceCount = new AtomicInteger(0);
      mBMapManager = new BMapManager(App.getInstance());
      mBMapManager.init(
          Constants.BMAP_KEY,
          new MKGeneralListener() {

            @Override
            public void onGetNetworkState(int iError) {
              if (iError == MKEvent.ERROR_NETWORK_CONNECT) {
                App.debug("BMap ERROR_NETWORK_CONNECT");
              }
            }

            @Override
            public void onGetPermissionState(int iError) {
              if (iError == MKEvent.ERROR_PERMISSION_DENIED) {
                App.debug("BMap ERROR_PERMISSION_DENIED");
              }
            }
          });
    }
    mBMapInstanceCount.incrementAndGet();
    App.debug(TAG, "initBMapManager  " + mBMapInstanceCount.get());
    return mBMapManager;
  }
Esempio n. 2
0
File: App.java Progetto: ndong211/bo
 public void releaseBMapManager() {
   if (mBMapInstanceCount.decrementAndGet() <= 0) {
     mBMapManager.destroy();
     App.debug(TAG, "releaseBMapManager");
     mBMapManager = null;
   }
   App.debug(TAG, "releaseBMapManager remain " + mBMapInstanceCount.get());
 }
Esempio n. 3
0
 /**
  * 验证字符串是否为空,若为空就弹出 Toast,内容为 errorStringRes
  *
  * @param content
  * @param errorStringRes
  * @return true 验证未通过,false 验证通过
  */
 public static boolean invalidateContent(String content, int errorStringRes) {
   if (TextUtils.isEmpty(content)) {
     if (errorStringRes > 0) {
       App.showShortToast(App.getInstance().getString(errorStringRes));
     }
     return true;
   }
   return false;
 }
Esempio n. 4
0
 /**
  * 当前里程是否小于等于 0
  *
  * @return
  */
 private boolean isCurrentMileageLessEqualZero() {
   String currentMileageStr = mCurrentMileageIndicatorEdit.getEditTextValue();
   if (Integer.valueOf(currentMileageStr) <= 0) {
     App.showShortToast(getString(R.string.txt_info_current_mileage_too_low));
     return true;
   }
   return false;
 }
Esempio n. 5
0
 private boolean invalidateOilPriceRange() {
   boolean flag =
       StringUtil.validateOilPrice(
           mOilPriceIndicatorEdit.getEditTextValue(), mOilpriceMinValue, mOilpriceMaxValue);
   if (!flag) {
     App.showShortToast(getString(R.string.txt_info_oil_price_out_of_range));
   }
   return !flag;
 }
Esempio n. 6
0
  @Override
  void onScanSuccess(String result) {
    App.showShortToast(result);

    Intent data = new Intent();
    data.putExtra(EXTRA_SCAN_RESULT_STR, result);
    setResult(RESULT_OK, data);
    finish();
    // 模拟扫描不成功的情况
    //		new Handler().postDelayed(new Runnable() {
    //
    //			@Override
    //			public void run() {
    //				rescan();
    //			}
    //		}, 2000);
  }