mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
- Added Joseph's excellent supermarket checkout beep. There seems to be a bug in the M3 framework where it sometimes plays twice or hiccups.
- Changed the status bar to flash green for a second when the result points are drawn. - Added install as a target to the build file. - Fixed a crashing bug when decoding from preview mode (driver problem). git-svn-id: https://zxing.googlecode.com/svn/trunk@378 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
38867c7ddc
commit
2db1ea526f
|
@ -49,6 +49,7 @@
|
|||
|
||||
<!-- Tools -->
|
||||
<property name="aapt" value="${android-tools}/aapt"/>
|
||||
<property name="adb" value="${android-tools}/adb"/>
|
||||
<property name="aidl" value="${android-tools}/aidl"/>
|
||||
<!-- dx is a special case as it is a .bat file on Windows -->
|
||||
<condition property="dx" value="${android-tools}/dx.bat" else="${android-tools}/dx">
|
||||
|
@ -257,6 +258,15 @@ only when the assets dir exists. -->
|
|||
<!-- Create the package file for this project from the sources. -->
|
||||
<target name="package" depends="package-dex"/>
|
||||
|
||||
<!-- Install package on the default emulator -->
|
||||
<target name="install">
|
||||
<echo>Sending package to default emulator...</echo>
|
||||
<exec executable="${adb}" failonerror="true">
|
||||
<arg value="install" />
|
||||
<arg value="${out-package}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${outdir}"/>
|
||||
</target>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="48px"
|
||||
android:layout_weight="0"
|
||||
android:background="#55000000"
|
||||
android:background="#50000000"
|
||||
android:baselineAligned="false"
|
||||
android:padding="4px">
|
||||
|
||||
|
|
BIN
android-m3/res/raw/beep.wav
Normal file
BIN
android-m3/res/raw/beep.wav
Normal file
Binary file not shown.
|
@ -20,6 +20,7 @@ import android.app.Activity;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
@ -173,6 +174,7 @@ public final class BarcodeReaderCaptureActivity extends Activity {
|
|||
};
|
||||
|
||||
public void restartPreview() {
|
||||
resetStatusViewColor();
|
||||
Message restart = Message.obtain(cameraThread.handler, R.id.restart_preview);
|
||||
restart.sendToTarget();
|
||||
}
|
||||
|
@ -180,6 +182,7 @@ public final class BarcodeReaderCaptureActivity extends Activity {
|
|||
private void handleDecode(Result rawResult, int duration) {
|
||||
if (!rawResult.toString().equals(lastResult)) {
|
||||
lastResult = rawResult.toString();
|
||||
playBeepSound();
|
||||
|
||||
ResultPoint[] points = rawResult.getResultPoints();
|
||||
if (points != null && points.length > 0) {
|
||||
|
@ -202,6 +205,9 @@ public final class BarcodeReaderCaptureActivity extends Activity {
|
|||
actionButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
View statusView = findViewById(R.id.status_view);
|
||||
statusView.setBackgroundColor(0xc000ff00);
|
||||
|
||||
// Show the green finder patterns for one second, then restart the preview
|
||||
Message message = Message.obtain(messageHandler, R.id.restart_preview);
|
||||
messageHandler.sendMessageDelayed(message, 1000);
|
||||
|
@ -210,7 +216,14 @@ public final class BarcodeReaderCaptureActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
private void playBeepSound() {
|
||||
MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.beep);
|
||||
mediaPlayer.prepare();
|
||||
mediaPlayer.start();
|
||||
}
|
||||
|
||||
private void resetStatusView() {
|
||||
resetStatusViewColor();
|
||||
TextView textView = (TextView) findViewById(R.id.status_text_view);
|
||||
textView.setText(R.string.msg_default_status);
|
||||
Button actionButton = (Button) findViewById(R.id.status_action_button);
|
||||
|
@ -218,6 +231,11 @@ public final class BarcodeReaderCaptureActivity extends Activity {
|
|||
lastResult = "";
|
||||
}
|
||||
|
||||
private void resetStatusViewColor() {
|
||||
View statusView = findViewById(R.id.status_view);
|
||||
statusView.setBackgroundColor(0x50000000);
|
||||
}
|
||||
|
||||
private static ParsedReaderResult parseReaderResult(Result rawResult) {
|
||||
ParsedReaderResult readerResult = ParsedReaderResult.parseReaderResult(rawResult);
|
||||
if (readerResult.getType().equals(ParsedReaderResultType.TEXT)) {
|
||||
|
|
|
@ -247,7 +247,7 @@ final class CameraManager {
|
|||
*/
|
||||
private void calculatePreviewResolution() {
|
||||
if (previewResolution == null) {
|
||||
int previewHeight = (int) (stillResolution.x * stillMultiplier * 1.8f);
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue