mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Slight tweak to last change -- parse MODE value even when there's no SCAN_FORMATS. Also be extra paranoid about other call to String.split()
git-svn-id: https://zxing.googlecode.com/svn/trunk@1324 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
43dfd0053f
commit
ed7f1b83aa
|
@ -264,17 +264,17 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector<BarcodeFormat> parseDecodeFormats(Intent intent) {
|
private static Vector<BarcodeFormat> parseDecodeFormats(Intent intent) {
|
||||||
String formats = intent.getStringExtra(Intents.Scan.SCAN_FORMATS);
|
List<String> scanFormats = null;
|
||||||
if (formats != null) {
|
String scanFormatsString = intent.getStringExtra(Intents.Scan.SCAN_FORMATS);
|
||||||
return parseDecodeFormats(Arrays.asList(COMMA_PATTERN.split(formats)),
|
if (scanFormatsString != null) {
|
||||||
intent.getStringExtra(Intents.Scan.MODE));
|
scanFormats = Arrays.asList(COMMA_PATTERN.split(scanFormatsString));
|
||||||
}
|
}
|
||||||
return null;
|
return parseDecodeFormats(scanFormats, intent.getStringExtra(Intents.Scan.MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
|
private static Vector<BarcodeFormat> parseDecodeFormats(Uri inputUri) {
|
||||||
List<String> formats = inputUri.getQueryParameters(Intents.Scan.SCAN_FORMATS);
|
List<String> formats = inputUri.getQueryParameters(Intents.Scan.SCAN_FORMATS);
|
||||||
if (formats.size() == 1){
|
if (formats != null && formats.size() == 1 && formats.get(0) != null){
|
||||||
formats = Arrays.asList(COMMA_PATTERN.split(formats.get(0)));
|
formats = Arrays.asList(COMMA_PATTERN.split(formats.get(0)));
|
||||||
}
|
}
|
||||||
return parseDecodeFormats(formats, inputUri.getQueryParameter(Intents.Scan.MODE));
|
return parseDecodeFormats(formats, inputUri.getQueryParameter(Intents.Scan.MODE));
|
||||||
|
|
Loading…
Reference in a new issue