mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
More small static analysis stuff
git-svn-id: https://zxing.googlecode.com/svn/trunk@1945 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
6a2c4e8d2f
commit
eda536772b
|
@ -83,18 +83,23 @@ final class DecodeHandler extends Handler {
|
|||
multiFormatReader.reset();
|
||||
}
|
||||
|
||||
Handler handler = activity.getHandler();
|
||||
if (rawResult != null) {
|
||||
// Don't log the barcode contents for security.
|
||||
long end = System.currentTimeMillis();
|
||||
Log.d(TAG, "Found barcode in " + (end - start) + " ms");
|
||||
Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(DecodeThread.BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
|
||||
message.setData(bundle);
|
||||
message.sendToTarget();
|
||||
if (handler != null) {
|
||||
Message message = Message.obtain(handler, R.id.decode_succeeded, rawResult);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(DecodeThread.BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
|
||||
message.setData(bundle);
|
||||
message.sendToTarget();
|
||||
}
|
||||
} else {
|
||||
Message message = Message.obtain(activity.getHandler(), R.id.decode_failed);
|
||||
message.sendToTarget();
|
||||
if (handler != null) {
|
||||
Message message = Message.obtain(handler, R.id.decode_failed);
|
||||
message.sendToTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public final class ViewfinderView extends View {
|
|||
private static final long ANIMATION_DELAY = 80L;
|
||||
private static final int CURRENT_POINT_OPACITY = 0xA0;
|
||||
private static final int MAX_RESULT_POINTS = 20;
|
||||
private static final int POINT_SIZE = 6;
|
||||
|
||||
private final Paint paint;
|
||||
private Bitmap resultBitmap;
|
||||
|
@ -127,7 +128,7 @@ public final class ViewfinderView extends View {
|
|||
for (ResultPoint point : currentPossible) {
|
||||
canvas.drawCircle(frameLeft + (int) (point.getX() * scaleX),
|
||||
frameTop + (int) (point.getY() * scaleY),
|
||||
6.0f, paint);
|
||||
POINT_SIZE, paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,14 +139,18 @@ public final class ViewfinderView extends View {
|
|||
for (ResultPoint point : currentLast) {
|
||||
canvas.drawCircle(frameLeft + (int) (point.getX() * scaleX),
|
||||
frameTop + (int) (point.getY() * scaleY),
|
||||
3.0f, paint);
|
||||
POINT_SIZE / 2, paint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Request another update at the animation interval, but only repaint the laser line,
|
||||
// not the entire viewfinder mask.
|
||||
postInvalidateDelayed(ANIMATION_DELAY, frame.left, frame.top, frame.right, frame.bottom);
|
||||
postInvalidateDelayed(ANIMATION_DELAY,
|
||||
frame.left - POINT_SIZE,
|
||||
frame.top - POINT_SIZE,
|
||||
frame.right + POINT_SIZE,
|
||||
frame.bottom + POINT_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ final class BookmarkAdapter extends BaseAdapter {
|
|||
|
||||
public View getView(int index, View view, ViewGroup viewGroup) {
|
||||
LinearLayout layout;
|
||||
if (view == null || !(view instanceof LinearLayout)) {
|
||||
if (!(view instanceof LinearLayout)) {
|
||||
LayoutInflater factory = LayoutInflater.from(context);
|
||||
layout = (LinearLayout) factory.inflate(R.layout.bookmark_picker_list_item, viewGroup, false);
|
||||
} else {
|
||||
|
|
|
@ -125,7 +125,7 @@ final class DecodedBitStreamParser {
|
|||
throw FormatException.getFormatInstance();
|
||||
} else if (oneByte <= 128) { // ASCII data (ASCII value + 1)
|
||||
oneByte = upperShift ? oneByte + 128 : oneByte;
|
||||
upperShift = false;
|
||||
//upperShift = false;
|
||||
result.append((char) (oneByte - 1));
|
||||
return ASCII_ENCODE;
|
||||
} else if (oneByte == 129) { // Pad
|
||||
|
|
|
@ -91,8 +91,7 @@ final class DecodeThread extends Thread {
|
|||
}
|
||||
} else {
|
||||
try {
|
||||
Result result = decode(new URI(input), config.getHints());
|
||||
if (result != null) {
|
||||
if (decode(new URI(input), config.getHints()) != null) {
|
||||
successful++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in a new issue