use of com.journeyapps.barcodescanner.camera.CameraSettings in project zxing-android-embedded by journeyapps.
the class DecoratedBarcodeView method initializeFromIntent.
/**
* Convenience method to initialize camera id, decode formats and prompt message from an intent.
*
* @param intent the intent, as generated by IntentIntegrator
*/
public void initializeFromIntent(Intent intent) {
// Scan the formats the intent requested, and return the result to the calling activity.
Set<BarcodeFormat> decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);
Map<DecodeHintType, Object> decodeHints = DecodeHintManager.parseDecodeHints(intent);
CameraSettings settings = new CameraSettings();
if (intent.hasExtra(Intents.Scan.CAMERA_ID)) {
int cameraId = intent.getIntExtra(Intents.Scan.CAMERA_ID, -1);
if (cameraId >= 0) {
settings.setRequestedCameraId(cameraId);
}
}
String customPromptMessage = intent.getStringExtra(Intents.Scan.PROMPT_MESSAGE);
if (customPromptMessage != null) {
setStatusText(customPromptMessage);
}
// Check to see if the scan should be inverted.
boolean inverted = intent.getBooleanExtra(Intents.Scan.INVERTED_SCAN, false);
String characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);
MultiFormatReader reader = new MultiFormatReader();
reader.setHints(decodeHints);
barcodeView.setCameraSettings(settings);
barcodeView.setDecoderFactory(new DefaultDecoderFactory(decodeFormats, decodeHints, characterSet, inverted));
}
Aggregations