int previewHeight = (int) (stillResolution.x * stillMultiplier * 1.5f);
int previewWidth = previewHeight * screenResolution.x / screenResolution.y;
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;
previewResolution = new Point(previewWidth, previewHeight);
Log.v(TAG, "previewWidth " + previewWidth + " previewHeight " + previewHeight);
return null;
}
- private String getNewPhotoName() {
- Date now = new Date();
- return "capture" + now.getTime() + ".jpg";
+ private static String getNewPhotoName() {
+ return "capture" + System.currentTimeMillis() + ".jpg";
}
}
*/
public final class BugBarcodeApp implements IButtonEventListener, ImageObserver {
- private ICameraDevice camera;
- private ICameraModuleControl cameraControl;
- private Frame frame;
+ private final ICameraDevice camera;
+ private final ICameraModuleControl cameraControl;
+ private final Frame frame;
private Image image;
private ImageCanvas imageCanvas;
private Label barcodeLabel;
*/
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
* @return the current implementation of {@link GridSampler}
*/
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) {
gridSampler = new DefaultGridSampler();
}
*/
boolean checkChecksum(String s) throws ReaderException {
int length = s.length();
- if (length == 0) return false;
+ if (length == 0) {
+ return false;
+ }
int sum = 0;
for (int i = length - 2; i >= 0; i -= 2) {
}
}
- private void closeResources(Store store, Folder inbox) {
+ private static void closeResources(Store store, Folder inbox) {
try {
if (inbox != null) {
inbox.close(true);