Minor style tweaks

git-svn-id: https://zxing.googlecode.com/svn/trunk@503 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2008-07-09 17:24:02 +00:00
parent 42940c4580
commit 6d124e1be5
6 changed files with 15 additions and 10 deletions

View file

@ -275,7 +275,9 @@ final class CameraManager {
int previewHeight = (int) (stillResolution.x * stillMultiplier * 1.5f); int previewHeight = (int) (stillResolution.x * stillMultiplier * 1.5f);
int previewWidth = previewHeight * screenResolution.x / screenResolution.y; int previewWidth = previewHeight * screenResolution.x / screenResolution.y;
previewWidth = ((previewWidth + 7) >> 3) << 3; previewWidth = ((previewWidth + 7) >> 3) << 3;
if (previewWidth > cameraResolution.x) previewWidth = cameraResolution.x; if (previewWidth > cameraResolution.x) {
previewWidth = cameraResolution.x;
}
previewHeight = previewWidth * screenResolution.y / screenResolution.x; previewHeight = previewWidth * screenResolution.y / screenResolution.x;
previewResolution = new Point(previewWidth, previewHeight); previewResolution = new Point(previewWidth, previewHeight);
Log.v(TAG, "previewWidth " + previewWidth + " previewHeight " + previewHeight); Log.v(TAG, "previewWidth " + previewWidth + " previewHeight " + previewHeight);

View file

@ -214,9 +214,8 @@ final class DecodeThread extends Thread {
return null; return null;
} }
private String getNewPhotoName() { private static String getNewPhotoName() {
Date now = new Date(); return "capture" + System.currentTimeMillis() + ".jpg";
return "capture" + now.getTime() + ".jpg";
} }
} }

View file

@ -43,9 +43,9 @@ import java.io.IOException;
*/ */
public final class BugBarcodeApp implements IButtonEventListener, ImageObserver { public final class BugBarcodeApp implements IButtonEventListener, ImageObserver {
private ICameraDevice camera; private final ICameraDevice camera;
private ICameraModuleControl cameraControl; private final ICameraModuleControl cameraControl;
private Frame frame; private final Frame frame;
private Image image; private Image image;
private ImageCanvas imageCanvas; private ImageCanvas imageCanvas;
private Label barcodeLabel; private Label barcodeLabel;

View file

@ -34,7 +34,7 @@ import com.google.zxing.ReaderException;
*/ */
public abstract class GridSampler { public abstract class GridSampler {
private static GridSampler gridSampler; private static GridSampler gridSampler = null;
/** /**
* Sets the implementation of {@link GridSampler} used by the library. One global * Sets the implementation of {@link GridSampler} used by the library. One global
@ -56,6 +56,8 @@ public abstract class GridSampler {
* @return the current implementation of {@link GridSampler} * @return the current implementation of {@link GridSampler}
*/ */
public static GridSampler getInstance() { public static GridSampler getInstance() {
// No real point in trying to make this thread-safe;
// doesn't matter if a second instance is created
if (gridSampler == null) { if (gridSampler == null) {
gridSampler = new DefaultGridSampler(); gridSampler = new DefaultGridSampler();
} }

View file

@ -141,7 +141,9 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
*/ */
boolean checkChecksum(String s) throws ReaderException { boolean checkChecksum(String s) throws ReaderException {
int length = s.length(); int length = s.length();
if (length == 0) return false; if (length == 0) {
return false;
}
int sum = 0; int sum = 0;
for (int i = length - 2; i >= 0; i -= 2) { for (int i = length - 2; i >= 0; i -= 2) {

View file

@ -163,7 +163,7 @@ final class DecodeEmailTask extends TimerTask {
} }
} }
private void closeResources(Store store, Folder inbox) { private static void closeResources(Store store, Folder inbox) {
try { try {
if (inbox != null) { if (inbox != null) {
inbox.close(true); inbox.close(true);