Merged revisions 378,380,382 via svnmerge from

https://zxing.googlecode.com/svn/trunk/android-m3

........
  r378 | dswitkin | 2008-04-28 21:27:27 -0400 (Mon, 28 Apr 2008) | 4 lines
  
  - 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).
........
  r380 | srowen | 2008-05-02 14:39:03 -0400 (Fri, 02 May 2008) | 2 lines
  
  Added preliminary support for MobileTag formats; not enabled yet.
  Added "sms:" URI support.
........
  r382 | srowen | 2008-05-02 15:18:14 -0400 (Fri, 02 May 2008) | 1 line
  
  Many more little tweaks from IntelliJ inspections
........


git-svn-id: https://zxing.googlecode.com/svn/trunk@384 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin 2008-05-03 16:10:16 +00:00
parent 3d4d5b3498
commit 6291508a2e
6 changed files with 23 additions and 2 deletions

View file

@ -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">

View file

@ -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">

BIN
android/res/raw/beep.wav Normal file

Binary file not shown.

View file

@ -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)) {

View file

@ -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;

View file

@ -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()));