예제 #1
0
파일: App.java 프로젝트: 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;
  }
예제 #2
0
파일: App.java 프로젝트: ndong211/bo
 public void releaseBMapManager() {
   if (mBMapInstanceCount.decrementAndGet() <= 0) {
     mBMapManager.destroy();
     App.debug(TAG, "releaseBMapManager");
     mBMapManager = null;
   }
   App.debug(TAG, "releaseBMapManager remain " + mBMapInstanceCount.get());
 }
예제 #3
0
파일: StringUtil.java 프로젝트: ndong211/bo
 /**
  * 验证字符串是否为空,若为空就弹出 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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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);
  }