Style stuff mostly but fix a problem between Aztec and J2ME too

git-svn-id: https://zxing.googlecode.com/svn/trunk@1681 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2010-12-15 14:42:17 +00:00
parent c7d055bb92
commit 99d09e0a44
16 changed files with 16 additions and 44 deletions

View file

@ -35,7 +35,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@ -329,12 +328,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
return super.onOptionsItemSelected(item);
}
@Override
public void onConfigurationChanged(Configuration config) {
// Do nothing, this is to prevent the activity from being restarted when the keyboard opens.
super.onConfigurationChanged(config);
}
public void surfaceCreated(SurfaceHolder holder) {
if (!hasSurface) {
hasSurface = true;

View file

@ -159,12 +159,6 @@ public final class SearchBookContentsActivity extends Activity {
queryTextView.selectAll();
}
@Override
public void onConfigurationChanged(Configuration config) {
// Do nothing, this is to prevent the activity from being restarted when the keyboard opens.
super.onConfigurationChanged(config);
}
private void resetForNewQuery() {
networkThread = null;
queryTextView.setEnabled(true);

View file

@ -16,7 +16,6 @@
package com.google.zxing.client.android.encode;
import android.content.Context;
import android.view.Display;
import android.view.WindowManager;
import com.google.zxing.WriterException;
@ -34,7 +33,6 @@ import android.os.Environment;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

View file

@ -16,14 +16,11 @@
package com.google.zxing.client.android.share;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import com.google.zxing.client.android.R;
import java.io.Serializable;
import java.util.ArrayList;

View file

@ -25,8 +25,6 @@ import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.List;
public final class BenchmarkActivity extends Activity {
private static final String PATH = "/sdcard/zxingbenchmark";
@ -76,7 +74,7 @@ public final class BenchmarkActivity extends Activity {
};
private void handleBenchmarkDone(Message message) {
List<BenchmarkItem> items = (List<BenchmarkItem>) message.obj;
Iterable<BenchmarkItem> items = (Iterable<BenchmarkItem>) message.obj;
int count = 0;
int time = 0;
for (BenchmarkItem item : items) {

View file

@ -66,8 +66,8 @@ final class BenchmarkThread extends Thread {
if (file.isDirectory()) {
String[] files = file.list();
Arrays.sort(files);
for (int x = 0; x < files.length; x++) {
walkTree(file.getAbsolutePath() + '/' + files[x], items);
for (String f : files) {
walkTree(file.getAbsolutePath() + '/' + f, items);
}
} else {
BenchmarkItem item = decode(path);

View file

@ -58,7 +58,7 @@ final class CameraManager {
private boolean previewing;
private int previewFormat;
private String previewFormatString;
private boolean useOneShotPreviewCallback;
private final boolean useOneShotPreviewCallback;
/**
* Preview frames are delivered here, which we pass on to the registered handler. Make sure to
@ -288,7 +288,7 @@ final class CameraManager {
private String collectCameraParameters() {
Camera.Parameters parameters = camera.getParameters();
String[] params = parameters.flatten().split(";");
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append("Default camera parameters:");
for (String param : params) {
result.append("\n ");

View file

@ -30,7 +30,6 @@ import android.view.WindowManager;
import android.widget.Toast;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@ -148,7 +147,7 @@ public final class CameraTestActivity extends Activity implements SurfaceHolder.
}
private void collectStatsAndSendEmail(String parameters) {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
result.append("Device info:");
result.append("\n Board: ");
result.append(Build.BOARD);
@ -184,13 +183,11 @@ public final class CameraTestActivity extends Activity implements SurfaceHolder.
result.append("\n\n");
result.append(parameters);
File file = new File("/sdcard/CameraParameters.txt");
try {
File file = new File("/sdcard/CameraParameters.txt");
FileOutputStream stream = new FileOutputStream(file);
stream.write(result.toString().getBytes());
stream.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}

View file

@ -63,7 +63,7 @@ final class SaveThread extends Thread {
// Save the center rectangle of the Y channel as a greyscale PNG to the SD card.
private void save(byte[] data, int width, int height) {
final Rect framingRect = CameraManager.get().getFramingRect();
Rect framingRect = CameraManager.get().getFramingRect();
int framingWidth = framingRect.width();
int framingHeight = framingRect.height();
if (framingWidth > width || framingHeight > height) {

View file

@ -122,7 +122,7 @@ public final class Decoder {
int lastTable = UPPER;
int table = UPPER;
int startIndex = 0;
StringBuilder result = new StringBuilder(20);
StringBuffer result = new StringBuffer(20);
boolean end = false;
boolean shift = false;
boolean switchShift = false;

View file

@ -18,7 +18,6 @@ package com.google.zxing.qrcode.decoder;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.reedsolomon.GenericGF;
@ -41,8 +40,7 @@ public final class Decoder {
rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
public DecoderResult decode(boolean[][] image)
throws ChecksumException, FormatException, NotFoundException {
public DecoderResult decode(boolean[][] image) throws ChecksumException, FormatException {
return decode(image, null);
}

View file

@ -55,7 +55,7 @@ public final class ExpandedProductParsedResultTestCase extends Assert {
String price = "5";
String priceIncrement = "2";
String priceCurrency = "445";
Hashtable uncommonAIs = new Hashtable();
Hashtable<Object,Object> uncommonAIs = new Hashtable<Object,Object>();
uncommonAIs.put("123", "544654");
Result result = new Result(text, null, null, BarcodeFormat.RSS_EXPANDED);

View file

@ -246,7 +246,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
private boolean decode(BinaryBitmap source,
float rotation,
String expectedText,
Properties expectedMetadata,
Map<Object,Object> expectedMetadata,
boolean tryHarder) {
Result result;
String suffix = " (" + (tryHarder ? "try harder, " : "") + "rotation: " + rotation + ')';
@ -279,7 +279,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
return false;
}
Hashtable resultMetadata = result.getResultMetadata();
Hashtable<Object,Object> resultMetadata = result.getResultMetadata();
for (Map.Entry<Object,Object> metadatum : expectedMetadata.entrySet()) {
ResultMetadataType key = ResultMetadataType.valueOf(metadatum.getKey().toString());
Object expectedValue = metadatum.getValue();

View file

@ -84,16 +84,14 @@ class SplashThread extends Canvas implements Runnable {
* Allows Early dismissal of the splash Screen, for example, when all background
* initialisations are complete.
*/
public void stop() {
public synchronized void stop() {
// Invoke the notify method of the Splash Object ("and the correct thread just
// happens to be arbitrarily chosen as the thread to be awakened"), and thus
// dismiss the Splash Screen. The current implementation only uses a single
// thread, so invoking the notify method should work, however, the
// implementation may change in the future. Thus lets' make use of the
// notifyAll method of the Splash Object.
synchronized (this) {
notifyAll(); // Wake everyone up
}
notifyAll(); // Wake everyone up
}
/**

View file

@ -19,7 +19,6 @@ package com.google.zxing.client.j2se;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.LuminanceSource;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;

View file

@ -103,7 +103,7 @@ public class WifiGenerator implements GeneratorSource {
return parseTextField("Password", password);
}
private String getNetworkTypeField() throws GeneratorException {
private String getNetworkTypeField() {
return networkType.getValue(networkType.getSelectedIndex());
}