/** * 当前里程是否小于等于 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; }
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; }
/** * 验证字符串是否为空,若为空就弹出 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; }
@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); }