diff --git a/android/build.xml b/android/build.xml index c79690468..9034b6237 100644 --- a/android/build.xml +++ b/android/build.xml @@ -49,6 +49,7 @@ + diff --git a/android/res/layout/main.xml b/android/res/layout/main.xml index 115a8d27c..e844111ca 100644 --- a/android/res/layout/main.xml +++ b/android/res/layout/main.xml @@ -39,7 +39,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0" - android:background="#55000000" + android:background="#50000000" android:baselineAligned="false" android:padding="4px"> diff --git a/android/res/raw/beep.wav b/android/res/raw/beep.wav new file mode 100644 index 000000000..1a11aadba Binary files /dev/null and b/android/res/raw/beep.wav differ diff --git a/android/src/com/google/zxing/client/android/BarcodeReaderCaptureActivity.java b/android/src/com/google/zxing/client/android/BarcodeReaderCaptureActivity.java index 34e7ef9a9..b8dae1e5b 100644 --- a/android/src/com/google/zxing/client/android/BarcodeReaderCaptureActivity.java +++ b/android/src/com/google/zxing/client/android/BarcodeReaderCaptureActivity.java @@ -19,6 +19,7 @@ package com.google.zxing.client.android; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.media.MediaPlayer; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -165,6 +166,7 @@ public final class BarcodeReaderCaptureActivity extends Activity { }; void restartPreview() { + resetStatusViewColor(); Message restart = Message.obtain(cameraThread.handler, R.id.restart_preview); restart.sendToTarget(); } @@ -172,6 +174,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) { @@ -194,6 +197,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); @@ -202,7 +208,13 @@ public final class BarcodeReaderCaptureActivity extends Activity { } } + private void playBeepSound() { + MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.beep); + mediaPlayer.start(); + } + private void resetStatusView() { + resetStatusViewColor(); TextView textView = (TextView) findViewById(R.id.status_text_view); textView.setText(R.string.msg_default_status); View actionButton = findViewById(R.id.status_action_button); @@ -210,6 +222,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)) { diff --git a/android/src/com/google/zxing/client/android/CameraManager.java b/android/src/com/google/zxing/client/android/CameraManager.java index e751f00cb..57a591319 100644 --- a/android/src/com/google/zxing/client/android/CameraManager.java +++ b/android/src/com/google/zxing/client/android/CameraManager.java @@ -272,7 +272,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; diff --git a/android/src/com/google/zxing/client/android/ResultHandler.java b/android/src/com/google/zxing/client/android/ResultHandler.java index 13aaa831e..b9fb37998 100755 --- a/android/src/com/google/zxing/client/android/ResultHandler.java +++ b/android/src/com/google/zxing/client/android/ResultHandler.java @@ -87,6 +87,9 @@ final class ResultHandler implements Button.OnClickListener { } else if (type.equals(ParsedReaderResultType.SMS)) { SMSParsedResult smsResult = (SMSParsedResult) result; intent = new Intent(Intent.SENDTO_ACTION, Uri.parse(smsResult.getSMSURI())); + } else if (type.equals(ParsedReaderResultType.SMS)) { + SMSParsedResult smsResult = (SMSParsedResult) result; + intent = new Intent(Intent.SENDTO_ACTION, Uri.parse(smsResult.getSMSURI())); } else if (type.equals(ParsedReaderResultType.TEL)) { TelParsedResult telResult = (TelParsedResult) result; intent = new Intent(Intent.DIAL_ACTION, Uri.parse("tel:" + telResult.getNumber()));