A few more touch-ups from Codacy

This commit is contained in:
Sean Owen 2017-06-16 13:51:02 +01:00
parent 11a88fe7aa
commit ae6b9f4426
2 changed files with 58 additions and 57 deletions

View file

@ -637,8 +637,8 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
maybeSetClipboard(resultHandler); maybeSetClipboard(resultHandler);
if (source == IntentSource.NATIVE_APP_INTENT) { switch (source) {
case NATIVE_APP_INTENT:
// Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when // Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
// the deprecated intent is retired. // the deprecated intent is retired.
Intent intent = new Intent(getIntent().getAction()); Intent intent = new Intent(getIntent().getAction());
@ -674,23 +674,24 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
} }
} }
sendReplyMessage(R.id.return_scan_result, intent, resultDurationMS); sendReplyMessage(R.id.return_scan_result, intent, resultDurationMS);
break;
} else if (source == IntentSource.PRODUCT_SEARCH_LINK) { case PRODUCT_SEARCH_LINK:
// Reformulate the URL which triggered us into a query, so that the request goes to the same // Reformulate the URL which triggered us into a query, so that the request goes to the same
// TLD as the scan URL. // TLD as the scan URL.
int end = sourceUrl.lastIndexOf("/scan"); int end = sourceUrl.lastIndexOf("/scan");
String replyURL = sourceUrl.substring(0, end) + "?q=" + resultHandler.getDisplayContents() + "&source=zxing"; String productReplyURL = sourceUrl.substring(0, end) + "?q=" +
sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS); resultHandler.getDisplayContents() + "&source=zxing";
sendReplyMessage(R.id.launch_product_query, productReplyURL, resultDurationMS);
} else if (source == IntentSource.ZXING_LINK) { break;
case ZXING_LINK:
if (scanFromWebPageManager != null && scanFromWebPageManager.isScanFromWebPage()) { if (scanFromWebPageManager != null && scanFromWebPageManager.isScanFromWebPage()) {
String replyURL = scanFromWebPageManager.buildReplyURL(rawResult, resultHandler); String linkReplyURL = scanFromWebPageManager.buildReplyURL(rawResult, resultHandler);
scanFromWebPageManager = null; scanFromWebPageManager = null;
sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS); sendReplyMessage(R.id.launch_product_query, linkReplyURL, resultDurationMS);
} }
break;
} }
} }

View file

@ -36,6 +36,13 @@ import com.google.zxing.common.reedsolomon.ReedSolomonException;
*/ */
public final class Detector { public final class Detector {
private static final int[] EXPECTED_CORNER_BITS = {
0xee0, // 07340 XXX .XX X.. ...
0x1dc, // 00734 ... XXX .XX X..
0x83b, // 04073 X.. ... XXX .XX
0x707, // 03407 .XX X.. ... XXX
};
private final BitMatrix image; private final BitMatrix image;
private boolean compact; private boolean compact;
@ -146,13 +153,6 @@ public final class Detector {
} }
} }
private static final int[] EXPECTED_CORNER_BITS = {
0xee0, // 07340 XXX .XX X.. ...
0x1dc, // 00734 ... XXX .XX X..
0x83b, // 04073 X.. ... XXX .XX
0x707, // 03407 .XX X.. ... XXX
};
private static int getRotation(int[] sides, int length) throws NotFoundException { private static int getRotation(int[] sides, int length) throws NotFoundException {
// In a normal pattern, we expect to See // In a normal pattern, we expect to See
// ** .* D A // ** .* D A