/*
- * Copyright 2007 Google Inc.
+ * Copyright 2007 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* @author Sean Owen (srowen@google.com)
*/
-final class SnapshotThread extends Thread {
+final class SnapshotThread implements Runnable {
private final ZXingMIDlet zXingMIDlet;
private final Object waitLock;
private boolean done;
+ private final MultimediaManager multimediaManager;
SnapshotThread(ZXingMIDlet zXingMIDlet) {
this.zXingMIDlet = zXingMIDlet;
waitLock = new Object();
done = false;
+ multimediaManager = new DefaultMultimediaManager();
}
void continueRun() {
do {
waitForSignal();
try {
- AdvancedMultimediaManager.setFocus(player);
+ multimediaManager.setFocus(player);
byte[] snapshot = takeSnapshot();
Image capturedImage = Image.createImage(snapshot, 0, snapshot.length);
MonochromeBitmapSource source = new LCDUIImageMonochromeBitmapSource(capturedImage);
Reader reader = new MultiFormatReader();
Result result = reader.decode(source);
- zXingMIDlet.handleDecodedText(result.getText());
+ zXingMIDlet.handleDecodedText(result);
} catch (ReaderException re) {
// Show a friendlier message on a mere failure to read the barcode
zXingMIDlet.showError("Sorry, no barcode was found.");