mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Issue 1236 let history answer an Intent
git-svn-id: https://zxing.googlecode.com/svn/trunk@2250 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
41c4e34063
commit
9a33192652
|
@ -442,38 +442,35 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
lastResult = rawResult;
|
lastResult = rawResult;
|
||||||
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
|
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
|
||||||
historyManager.addHistoryItem(rawResult, resultHandler);
|
historyManager.addHistoryItem(rawResult, resultHandler);
|
||||||
|
beepManager.playBeepSoundAndVibrate();
|
||||||
|
|
||||||
if (barcode == null) {
|
if (barcode != null) {
|
||||||
// This is from history -- no saved barcode
|
|
||||||
handleDecodeInternally(rawResult, resultHandler, null);
|
|
||||||
} else {
|
|
||||||
beepManager.playBeepSoundAndVibrate();
|
|
||||||
drawResultPoints(barcode, rawResult);
|
drawResultPoints(barcode, rawResult);
|
||||||
switch (source) {
|
}
|
||||||
case NATIVE_APP_INTENT:
|
switch (source) {
|
||||||
case PRODUCT_SEARCH_LINK:
|
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);
|
handleDecodeExternally(rawResult, resultHandler, barcode);
|
||||||
break;
|
}
|
||||||
case ZXING_LINK:
|
break;
|
||||||
if (returnUrlTemplate == null){
|
case NONE:
|
||||||
handleDecodeInternally(rawResult, resultHandler, barcode);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
} else {
|
if (prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
|
||||||
handleDecodeExternally(rawResult, resultHandler, barcode);
|
String message = getResources().getString(R.string.msg_bulk_mode_scanned)
|
||||||
}
|
+ " (" + rawResult.getText() + ')';
|
||||||
break;
|
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||||
case NONE:
|
// Wait a moment or else it will scan the same barcode continuously about 3 times
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
|
||||||
if (prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
|
} else {
|
||||||
String message = getResources().getString(R.string.msg_bulk_mode_scanned)
|
handleDecodeInternally(rawResult, resultHandler, barcode);
|
||||||
+ " (" + rawResult.getText() + ')';
|
}
|
||||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
break;
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,7 +601,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
|
|
||||||
// Briefly show the contents of the barcode, then handle the result outside Barcode Scanner.
|
// Briefly show the contents of the barcode, then handle the result outside Barcode Scanner.
|
||||||
private void handleDecodeExternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
|
private void handleDecodeExternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
|
||||||
viewfinderView.drawResultBitmap(barcode);
|
|
||||||
|
if (barcode != null) {
|
||||||
|
viewfinderView.drawResultBitmap(barcode);
|
||||||
|
}
|
||||||
|
|
||||||
// Since this message will only be shown for a second, just tell the user what kind of
|
// Since this message will only be shown for a second, just tell the user what kind of
|
||||||
// barcode was found (e.g. contact info) rather than the full contents, which they won't
|
// barcode was found (e.g. contact info) rather than the full contents, which they won't
|
||||||
|
|
Loading…
Reference in a new issue