本文整理汇总了Java中com.google.zxing.client.android.result.ResultHandler类的典型用法代码示例。如果您正苦于以下问题:Java ResultHandler类的具体用法?Java ResultHandler怎么用?Java ResultHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResultHandler类属于com.google.zxing.client.android.result包,在下文中一共展示了ResultHandler类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleDecode
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
/**
* A valid barcode has been found, so give an indication of success and show the results.
*
* @param rawResult The contents of the barcode.
* @param barcode A greyscale bitmap of the camera data which was decoded.
*/
public void handleDecode(Result rawResult, Bitmap barcode) {
lastResult = rawResult;
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
boolean fromLiveScan = barcode != null;
if (fromLiveScan) {
drawResultPoints(barcode, rawResult);
}
switch (source) {
case NATIVE_APP_INTENT:
case PRODUCT_SEARCH_LINK:
handleDecodeExternally(rawResult, resultHandler, barcode);
break;
case NONE:
if (fromLiveScan) {
String message = " (bulk scan)";
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
// Wait a moment or else it will scan the same barcode continuously about 3 times
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
} else {
}
break;
}
}
示例2: handleDecode
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
/**
* A valid barcode has been found, so give an indication of success and show the results.
*
* @param rawResult The contents of the barcode.
* @param scaleFactor amount by which thumbnail was scaled
* @param barcode A greyscale bitmap of the camera data which was decoded.
*/
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
inactivityTimer.onActivity();
lastResult = rawResult;
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
boolean fromLiveScan = barcode != null;
if (fromLiveScan) {
// Then not from history, so beep/vibrate and we have an image to draw on
beepManager.playBeepSoundAndVibrate();
drawResultPoints(barcode, scaleFactor, rawResult);
}
switch (source) {
case NATIVE_APP_INTENT:
case PRODUCT_SEARCH_LINK:
handleDecodeExternally(rawResult, resultHandler, barcode);
break;
case ZXING_LINK:
if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
handleDecodeInternally(rawResult, resultHandler, barcode);
} else {
handleDecodeExternally(rawResult, resultHandler, barcode);
}
break;
case NONE:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
Toast.makeText(getApplicationContext(),
getResources().getString(R.string.msg_bulk_mode_scanned) + " (" + rawResult.getText() + ')',
Toast.LENGTH_SHORT).show();
// Wait a moment or else it will scan the same barcode continuously about 3 times
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
} else {
handleDecodeInternally(rawResult, resultHandler, barcode);
}
break;
}
}
示例3: buildReplyURL
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
String buildReplyURL(Result rawResult, ResultHandler resultHandler) {
String result = returnUrlTemplate;
result = replace(CODE_PLACEHOLDER,
returnRaw ? rawResult.getText() : resultHandler.getDisplayContents(), result);
result = replace(RAW_CODE_PLACEHOLDER, rawResult.getText(), result);
result = replace(FORMAT_PLACEHOLDER, rawResult.getBarcodeFormat().toString(), result);
result = replace(TYPE_PLACEHOLDER, resultHandler.getType().toString(), result);
result = replace(META_PLACEHOLDER, String.valueOf(rawResult.getResultMetadata()), result);
return result;
}
示例4: addHistoryItem
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
public void addHistoryItem(Result result, ResultHandler handler) {
// Do not save this item to the history if the preference is turned off, or the contents are
// considered secure.
if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
handler.areContentsSecure() || !enableHistory) {
return;
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
deletePrevious(result.getText());
}
ContentValues values = new ContentValues();
values.put(DBHelper.TEXT_COL, result.getText());
values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());
SQLiteOpenHelper helper = new DBHelper(activity);
SQLiteDatabase db = null;
try {
db = helper.getWritableDatabase();
// Insert the new entry into the DB.
db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
} finally {
close(null, db);
}
}
示例5: buildReplyURL
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
String buildReplyURL(Result rawResult, ResultHandler resultHandler) {
String result = returnUrlTemplate;
result = replace(CODE_PLACEHOLDER, returnRaw ? rawResult.getText() : resultHandler.getDisplayContents(),
result);
result = replace(RAW_CODE_PLACEHOLDER, rawResult.getText(), result);
result = replace(FORMAT_PLACEHOLDER, rawResult.getBarcodeFormat().toString(), result);
result = replace(TYPE_PLACEHOLDER, resultHandler.getType().toString(), result);
result = replace(META_PLACEHOLDER, String.valueOf(rawResult.getResultMetadata()), result);
return result;
}
示例6: addHistoryItem
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
public void addHistoryItem(Result result, ResultHandler handler) {
// Do not save this item to the history if the preference is turned off,
// or the contents are
// considered secure.
if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) || handler.areContentsSecure()
|| !enableHistory) {
return;
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
deletePrevious(result.getText());
}
ContentValues values = new ContentValues();
values.put(DBHelper.TEXT_COL, result.getText());
values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());
SQLiteOpenHelper helper = new DBHelper(activity);
SQLiteDatabase db = null;
try {
db = helper.getWritableDatabase();
// Insert the new entry into the DB.
db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
} finally {
close(null, db);
}
}
示例7: handleDecodeInternally
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
private void handleDecodeInternally(Result rawResult,
ResultHandler resultHandler, Bitmap barcode) {
String code = rawResult.getText();
if (!TextUtils.isEmpty(code)) {
Uri uri = Uri.parse(code);
if (uri.getQueryParameterNames().contains("bundle")) {
WXEnvironment.sDynamicMode = uri.getBooleanQueryParameter("debug", false);
WXEnvironment.sDynamicUrl = uri.getQueryParameter("bundle");
String tip=WXEnvironment.sDynamicMode?"Has switched to Dynamic Mode":"Has switched to Normal Mode";
Toast.makeText(this,tip,Toast.LENGTH_SHORT).show();
finish();
return;
} else if (uri.getQueryParameterNames().contains("_wx_devtool")) {
WXEnvironment.sRemoteDebugProxyUrl=uri.getQueryParameter("_wx_devtool");
WXSDKEngine.reload();
Toast.makeText(this,"devtool",Toast.LENGTH_SHORT).show();
finish();
return;
}
if (code.contains("_wx_debug")) {
uri = Uri.parse(code);
String debug_url = uri.getQueryParameter("_wx_debug");
WXSDKEngine.switchDebugModel(true,debug_url);
finish();
} else {
Toast.makeText(this, rawResult.getText(), Toast.LENGTH_SHORT)
.show();
Intent intent;
intent = new Intent(CaptureActivity.this, WXPageActivity.class);
intent.setData(Uri.parse(code));
startActivity(intent);
}
}
}
示例8: handleDecodeInternally
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
private void handleDecodeInternally(Result rawResult,
ResultHandler resultHandler, Bitmap barcode) {
String code = rawResult.getText();
if (!TextUtils.isEmpty(code)) {
Uri uri = Uri.parse(code);
if (uri.getPath().contains("bundle")) {
WXEnvironment.sDynamicMode = uri.getBooleanQueryParameter("debug", false);
WXEnvironment.sDynamicUrl = uri.getQueryParameter("bundle");
String tip=WXEnvironment.sDynamicMode?"Has switched to Dynamic Mode":"Has switched to Normal Mode";
Toast.makeText(this,tip,Toast.LENGTH_SHORT).show();
finish();
return;
} else if (uri.getPath().contains("framework")) {
}
if (code.contains("_wx_debug")) {
uri = Uri.parse(code);
String debug_url = uri.getQueryParameter("_wx_debug");
WXSDKEngine.switchDebugModel(true,debug_url);
finish();
} else {
Toast.makeText(this, rawResult.getText(), Toast.LENGTH_SHORT)
.show();
Intent intent;
intent = new Intent(CaptureActivity.this, WXPageActivity.class);
intent.setData(Uri.parse(code));
startActivity(intent);
}
}
}
示例9: handleDecode
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
/**
* A valid barcode has been found, so give an indication of success and show the results.
*
* @param rawResult The contents of the barcode.
* @param barcode A greyscale bitmap of the camera data which was decoded.
*/
public void handleDecode(Result rawResult, Bitmap barcode) {
inactivityTimer.onActivity();
lastResult = rawResult;
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
boolean fromLiveScan = barcode != null;
if (fromLiveScan) {
historyManager.addHistoryItem(rawResult, resultHandler);
// Then not from history, so beep/vibrate and we have an image to draw on
beepManager.playBeepSoundAndVibrate();
drawResultPoints(barcode, rawResult);
}
switch (source) {
case NATIVE_APP_INTENT:
case PRODUCT_SEARCH_LINK:
handleDecodeExternally(rawResult, resultHandler, barcode);
break;
case ZXING_LINK:
if (returnUrlTemplate == null){
handleDecodeInternally(rawResult, resultHandler, barcode);
} else {
handleDecodeExternally(rawResult, resultHandler, barcode);
}
break;
case NONE:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
String message = getResources().getString(fakeR.getId("string", "msg_bulk_mode_scanned"))
+ " (" + rawResult.getText() + ')';
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
// Wait a moment or else it will scan the same barcode continuously about 3 times
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
} else {
handleDecodeInternally(rawResult, resultHandler, barcode);
}
break;
}
}
示例10: addHistoryItem
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
public void addHistoryItem(Result result, ResultHandler handler) {
// Do not save this item to the history if the preference is turned off, or the contents are
// considered secure.
if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
handler.areContentsSecure()) {
return;
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
deletePrevious(result.getText());
}
ContentValues values = new ContentValues();
values.put(DBHelper.TEXT_COL, result.getText());
values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());
SQLiteOpenHelper helper = new DBHelper(activity);
SQLiteDatabase db = null;
try {
db = helper.getWritableDatabase();
// Insert the new entry into the DB.
db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
} finally {
close(null, db);
}
}
示例11: handleDecode
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
/**
* A valid barcode has been found, so give an indication of success and show the results.
*
* @param rawResult The contents of the barcode.
* @param scaleFactor amount by which thumbnail was scaled
* @param barcode A greyscale bitmap of the camera data which was decoded.
*/
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
inactivityTimer.onActivity();
lastResult = rawResult;
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
boolean fromLiveScan = barcode != null;
if (fromLiveScan) {
historyManager.addHistoryItem(rawResult, resultHandler);
// Then not from history, so beep/vibrate and we have an image to draw on
beepManager.playBeepSoundAndVibrate();
drawResultPoints(barcode, scaleFactor, rawResult);
}
switch (source) {
case NATIVE_APP_INTENT:
case PRODUCT_SEARCH_LINK:
handleDecodeExternally(rawResult, resultHandler, barcode);
break;
case ZXING_LINK:
if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
handleDecodeInternally(rawResult, resultHandler, barcode);
} else {
handleDecodeExternally(rawResult, resultHandler, barcode);
}
break;
case NONE:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
Toast.makeText(getApplicationContext(),
getResources().getString(R.string.msg_bulk_mode_scanned) + " (" + rawResult.getText() + ')',
Toast.LENGTH_SHORT).show();
// Wait a moment or else it will scan the same barcode continuously about 3 times
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
} else {
handleDecodeInternally(rawResult, resultHandler, barcode);
}
break;
}
}
示例12: handleDecode
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
/**
* A valid barcode has been found, so give an indication of success and show the results.
*
* @param rawResult The contents of the barcode.
* @param scaleFactor amount by which thumbnail was scaled
* @param barcode A greyscale bitmap of the camera data which was decoded.
*/
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
inactivityTimer.onActivity();
lastResult = rawResult;
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
boolean fromLiveScan = barcode != null;
if (fromLiveScan) {
historyManager.addHistoryItem(rawResult, resultHandler);
// Then not from history, so beep/vibrate and we have an image to draw on
beepManager.playBeepSoundAndVibrate();
drawResultPoints(barcode, scaleFactor, rawResult);
}
switch (source) {
case NATIVE_APP_INTENT:
case PRODUCT_SEARCH_LINK:
handleDecodeExternally(rawResult, resultHandler, barcode);
break;
case ZXING_LINK:
if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
handleDecodeInternally(rawResult, resultHandler, barcode);
} else {
handleDecodeExternally(rawResult, resultHandler, barcode);
}
break;
case NONE:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
String message = getResources().getString(R.string.msg_bulk_mode_scanned)
+ " (" + rawResult.getText() + ')';
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
// Wait a moment or else it will scan the same barcode continuously about 3 times
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
} else {
handleDecodeInternally(rawResult, resultHandler, barcode);
}
break;
}
}
示例13: buildReplyURL
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
String buildReplyURL(Result rawResult, ResultHandler resultHandler) {
String result = returnUrlTemplate;
result = replace(CODE_PLACEHOLDER,
returnRaw ? rawResult.getText() : resultHandler.getDisplayContents(), result);
result = replace(RAW_CODE_PLACEHOLDER, rawResult.getText(), result);
result = replace(FORMAT_PLACEHOLDER, rawResult.getBarcodeFormat().toString(), result);
result = replace(TYPE_PLACEHOLDER, resultHandler.getType().toString(), result);
result = replace(META_PLACEHOLDER, String.valueOf(rawResult.getResultMetadata()), result);
return result;
}
示例14: addHistoryItem
import com.google.zxing.client.android.result.ResultHandler; //导入依赖的package包/类
public void addHistoryItem(Result result, ResultHandler handler) {
// Do not save this item to the history if the preference is turned off, or the contents are
// considered secure.
if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
handler.areContentsSecure()) {
return;
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
deletePrevious(result.getText());
}
ContentValues values = new ContentValues();
values.put(DBHelper.TEXT_COL, result.getText());
values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());
SQLiteOpenHelper helper = new DBHelper(activity);
SQLiteDatabase db = null;
try {
db = helper.getWritableDatabase();
// Insert the new entry into the DB.
db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
} finally {
close(null, db);
}
}