mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Add history feature; group some functionality into subpackages
git-svn-id: https://zxing.googlecode.com/svn/trunk@1058 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
938c44c17a
commit
e844ff06f4
|
@ -53,6 +53,7 @@
|
||||||
<string name="menu_about">詳細</string>
|
<string name="menu_about">詳細</string>
|
||||||
<string name="menu_help">ヘルプ</string>
|
<string name="menu_help">ヘルプ</string>
|
||||||
<string name="menu_settings">設定</string>
|
<string name="menu_settings">設定</string>
|
||||||
|
<string name="menu_history">歴史</string>
|
||||||
<string name="menu_share">共有</string>
|
<string name="menu_share">共有</string>
|
||||||
|
|
||||||
<string name="msg_about">オープンソースのバーコード ライブラリ、ZXing を使用しています</string>
|
<string name="msg_about">オープンソースのバーコード ライブラリ、ZXing を使用しています</string>
|
||||||
|
@ -102,6 +103,9 @@
|
||||||
<string name="result_text">テキストデータがヒットしました</string>
|
<string name="result_text">テキストデータがヒットしました</string>
|
||||||
<string name="result_uri">URL がヒットしました</string>
|
<string name="result_uri">URL がヒットしました</string>
|
||||||
|
|
||||||
|
<string name="history_title">歴史</string>
|
||||||
|
<string name="history_clear_text">削除履歴</string>
|
||||||
|
|
||||||
<string name="sbc_name">Google ブックス</string>
|
<string name="sbc_name">Google ブックス</string>
|
||||||
<string name="share_name">バーコードで共有する</string>
|
<string name="share_name">バーコードで共有する</string>
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
<string name="menu_about">关于</string>
|
<string name="menu_about">关于</string>
|
||||||
<string name="menu_help">帮助</string>
|
<string name="menu_help">帮助</string>
|
||||||
<string name="menu_settings">设置</string>
|
<string name="menu_settings">设置</string>
|
||||||
|
<string name="menu_history">历史</string>
|
||||||
<string name="menu_share">分享</string>
|
<string name="menu_share">分享</string>
|
||||||
<string name="msg_about">以ZXing的开源条码库为基础</string>
|
<string name="msg_about">以ZXing的开源条码库为基础</string>
|
||||||
<string name="msg_default_contents">内容</string>
|
<string name="msg_default_contents">内容</string>
|
||||||
|
@ -87,6 +88,8 @@
|
||||||
<string name="result_tel">找到电话号码</string>
|
<string name="result_tel">找到电话号码</string>
|
||||||
<string name="result_text">找到纯文本</string>
|
<string name="result_text">找到纯文本</string>
|
||||||
<string name="result_uri">找到URL</string>
|
<string name="result_uri">找到URL</string>
|
||||||
|
<string name="history_title">历史</string>
|
||||||
|
<string name="history_clear_text">删除历史</string>
|
||||||
<string name="sbc_name">Google图书搜索</string>
|
<string name="sbc_name">Google图书搜索</string>
|
||||||
<string name="share_name">通过条码分享</string>
|
<string name="share_name">通过条码分享</string>
|
||||||
<string name="title_about">条码扫描器</string>
|
<string name="title_about">条码扫描器</string>
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
<string name="menu_about">關于</string>
|
<string name="menu_about">關于</string>
|
||||||
<string name="menu_help">幫助</string>
|
<string name="menu_help">幫助</string>
|
||||||
<string name="menu_settings">設置</string>
|
<string name="menu_settings">設置</string>
|
||||||
|
<string name="menu_history">歷史</string>
|
||||||
<string name="menu_share">分享</string>
|
<string name="menu_share">分享</string>
|
||||||
<string name="msg_about">以ZXing的開源條碼庫為基礎</string>
|
<string name="msg_about">以ZXing的開源條碼庫為基礎</string>
|
||||||
<string name="msg_default_contents">內容</string>
|
<string name="msg_default_contents">內容</string>
|
||||||
|
@ -87,6 +88,8 @@
|
||||||
<string name="result_tel">找到電話號碼</string>
|
<string name="result_tel">找到電話號碼</string>
|
||||||
<string name="result_text">找到純文本</string>
|
<string name="result_text">找到純文本</string>
|
||||||
<string name="result_uri">找到URL</string>
|
<string name="result_uri">找到URL</string>
|
||||||
|
<string name="history_title">歷史</string>
|
||||||
|
<string name="history_clear_text">刪除歷史</string>
|
||||||
<string name="sbc_name">Google圖書搜索</string>
|
<string name="sbc_name">Google圖書搜索</string>
|
||||||
<string name="share_name">通過條碼分享</string>
|
<string name="share_name">通過條碼分享</string>
|
||||||
<string name="title_about">條碼掃描器</string>
|
<string name="title_about">條碼掃描器</string>
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
<string name="menu_help">Help</string>
|
<string name="menu_help">Help</string>
|
||||||
<string name="menu_settings">Settings</string>
|
<string name="menu_settings">Settings</string>
|
||||||
|
<string name="menu_history">History</string>
|
||||||
<string name="menu_share">Share</string>
|
<string name="menu_share">Share</string>
|
||||||
|
|
||||||
<string name="msg_about">Based on the open source ZXing Barcode Library</string>
|
<string name="msg_about">Based on the open source ZXing Barcode Library</string>
|
||||||
|
@ -103,6 +104,9 @@
|
||||||
<string name="result_text">Found plain text</string>
|
<string name="result_text">Found plain text</string>
|
||||||
<string name="result_uri">Found URL</string>
|
<string name="result_uri">Found URL</string>
|
||||||
|
|
||||||
|
<string name="history_title">History</string>
|
||||||
|
<string name="history_clear_text">Clear history</string>
|
||||||
|
|
||||||
<string name="sbc_name">Google Book Search</string>
|
<string name="sbc_name">Google Book Search</string>
|
||||||
<string name="share_name">Share via barcode</string>
|
<string name="share_name">Share via barcode</string>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ import android.graphics.Bitmap;
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
public abstract class BaseLuminanceSource extends LuminanceSource {
|
public abstract class BaseLuminanceSource extends LuminanceSource {
|
||||||
public BaseLuminanceSource(int width, int height) {
|
|
||||||
|
BaseLuminanceSource(int width, int height) {
|
||||||
super(width, height);
|
super(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ import com.google.zxing.ResultPoint;
|
||||||
import com.google.zxing.client.android.result.ResultButtonListener;
|
import com.google.zxing.client.android.result.ResultButtonListener;
|
||||||
import com.google.zxing.client.android.result.ResultHandler;
|
import com.google.zxing.client.android.result.ResultHandler;
|
||||||
import com.google.zxing.client.android.result.ResultHandlerFactory;
|
import com.google.zxing.client.android.result.ResultHandlerFactory;
|
||||||
|
import com.google.zxing.client.android.history.HistoryManager;
|
||||||
|
import com.google.zxing.client.android.share.ShareActivity;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -42,6 +44,7 @@ import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.ClipboardManager;
|
import android.text.ClipboardManager;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
|
@ -73,9 +76,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
private static final String TAG = "CaptureActivity";
|
private static final String TAG = "CaptureActivity";
|
||||||
|
|
||||||
private static final int SHARE_ID = Menu.FIRST;
|
private static final int SHARE_ID = Menu.FIRST;
|
||||||
private static final int SETTINGS_ID = Menu.FIRST + 1;
|
private static final int HISTORY_ID = Menu.FIRST + 1;
|
||||||
private static final int HELP_ID = Menu.FIRST + 2;
|
private static final int SETTINGS_ID = Menu.FIRST + 2;
|
||||||
private static final int ABOUT_ID = Menu.FIRST + 3;
|
private static final int HELP_ID = Menu.FIRST + 3;
|
||||||
|
private static final int ABOUT_ID = Menu.FIRST + 4;
|
||||||
|
|
||||||
private static final int MAX_RESULT_IMAGE_SIZE = 150;
|
private static final int MAX_RESULT_IMAGE_SIZE = 150;
|
||||||
private static final long INTENT_RESULT_DURATION = 1500L;
|
private static final long INTENT_RESULT_DURATION = 1500L;
|
||||||
|
@ -94,7 +98,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
NONE
|
NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
public CaptureActivityHandler handler;
|
private CaptureActivityHandler handler;
|
||||||
|
|
||||||
private ViewfinderView viewfinderView;
|
private ViewfinderView viewfinderView;
|
||||||
private View statusView;
|
private View statusView;
|
||||||
|
@ -109,6 +113,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
private String sourceUrl;
|
private String sourceUrl;
|
||||||
private String decodeMode;
|
private String decodeMode;
|
||||||
private String versionName;
|
private String versionName;
|
||||||
|
private HistoryManager historyManager;
|
||||||
|
|
||||||
private final OnCompletionListener beepListener = new BeepListener();
|
private final OnCompletionListener beepListener = new BeepListener();
|
||||||
|
|
||||||
|
@ -120,6 +125,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public Handler getHandler() {
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
Log.i(TAG, "Creating CaptureActivity");
|
Log.i(TAG, "Creating CaptureActivity");
|
||||||
|
@ -136,6 +145,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
handler = null;
|
handler = null;
|
||||||
lastResult = null;
|
lastResult = null;
|
||||||
hasSurface = false;
|
hasSurface = false;
|
||||||
|
historyManager = new HistoryManager(this);
|
||||||
|
|
||||||
showHelpOnFirstLaunch();
|
showHelpOnFirstLaunch();
|
||||||
}
|
}
|
||||||
|
@ -233,6 +243,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
menu.add(0, SHARE_ID, 0, R.string.menu_share).setIcon(R.drawable.share_menu_item);
|
menu.add(0, SHARE_ID, 0, R.string.menu_share).setIcon(R.drawable.share_menu_item);
|
||||||
|
menu.add(0, HISTORY_ID, 0, R.string.menu_history).setIcon(android.R.drawable.ic_menu_recent_history);
|
||||||
menu.add(0, SETTINGS_ID, 0, R.string.menu_settings)
|
menu.add(0, SETTINGS_ID, 0, R.string.menu_settings)
|
||||||
.setIcon(android.R.drawable.ic_menu_preferences);
|
.setIcon(android.R.drawable.ic_menu_preferences);
|
||||||
menu.add(0, HELP_ID, 0, R.string.menu_help)
|
menu.add(0, HELP_ID, 0, R.string.menu_help)
|
||||||
|
@ -259,6 +270,11 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case HISTORY_ID: {
|
||||||
|
AlertDialog historyAlert = historyManager.buildAlert();
|
||||||
|
historyAlert.show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SETTINGS_ID: {
|
case SETTINGS_ID: {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setClassName(this, PreferencesActivity.class.getName());
|
intent.setClassName(this, PreferencesActivity.class.getName());
|
||||||
|
@ -313,18 +329,22 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
*/
|
*/
|
||||||
public void handleDecode(Result rawResult, Bitmap barcode) {
|
public void handleDecode(Result rawResult, Bitmap barcode) {
|
||||||
lastResult = rawResult;
|
lastResult = rawResult;
|
||||||
playBeepSoundAndVibrate();
|
historyManager.addHistoryItem(rawResult.getText());
|
||||||
drawResultPoints(barcode, rawResult);
|
if (barcode != null) {
|
||||||
|
playBeepSoundAndVibrate();
|
||||||
switch (source) {
|
drawResultPoints(barcode, rawResult);
|
||||||
case NATIVE_APP_INTENT:
|
switch (source) {
|
||||||
case PRODUCT_SEARCH_LINK:
|
case NATIVE_APP_INTENT:
|
||||||
handleDecodeExternally(rawResult, barcode);
|
case PRODUCT_SEARCH_LINK:
|
||||||
break;
|
handleDecodeExternally(rawResult, barcode);
|
||||||
case ZXING_LINK:
|
break;
|
||||||
case NONE:
|
case ZXING_LINK:
|
||||||
handleDecodeInternally(rawResult, barcode);
|
case NONE:
|
||||||
break;
|
handleDecodeInternally(rawResult, barcode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
handleDecodeInternally(rawResult, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,13 +386,23 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
resultView.setVisibility(View.VISIBLE);
|
resultView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
|
ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
|
||||||
barcodeImageView.setMaxWidth(MAX_RESULT_IMAGE_SIZE);
|
if (barcode == null) {
|
||||||
barcodeImageView.setMaxHeight(MAX_RESULT_IMAGE_SIZE);
|
barcodeImageView.setVisibility(View.GONE);
|
||||||
barcodeImageView.setImageBitmap(barcode);
|
} else {
|
||||||
|
barcodeImageView.setVisibility(View.VISIBLE);
|
||||||
|
barcodeImageView.setMaxWidth(MAX_RESULT_IMAGE_SIZE);
|
||||||
|
barcodeImageView.setMaxHeight(MAX_RESULT_IMAGE_SIZE);
|
||||||
|
barcodeImageView.setImageBitmap(barcode);
|
||||||
|
}
|
||||||
|
|
||||||
TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
|
TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
|
||||||
formatTextView.setText(getString(R.string.msg_default_format) + ": " +
|
if (rawResult.getBarcodeFormat() == null) {
|
||||||
rawResult.getBarcodeFormat().toString());
|
formatTextView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
formatTextView.setVisibility(View.VISIBLE);
|
||||||
|
formatTextView.setText(getString(R.string.msg_default_format) + ": " +
|
||||||
|
rawResult.getBarcodeFormat().toString());
|
||||||
|
}
|
||||||
|
|
||||||
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
|
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
|
||||||
TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
|
TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
|
||||||
|
|
|
@ -72,13 +72,13 @@ public final class CaptureActivityHandler extends Handler {
|
||||||
case R.id.decode_succeeded:
|
case R.id.decode_succeeded:
|
||||||
state = State.SUCCESS;
|
state = State.SUCCESS;
|
||||||
Bundle bundle = message.getData();
|
Bundle bundle = message.getData();
|
||||||
Bitmap barcode = bundle.getParcelable(DecodeThread.BARCODE_BITMAP);
|
Bitmap barcode = bundle == null ? null : (Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);
|
||||||
activity.handleDecode((Result) message.obj, barcode);
|
activity.handleDecode((Result) message.obj, barcode);
|
||||||
break;
|
break;
|
||||||
case R.id.decode_failed:
|
case R.id.decode_failed:
|
||||||
// We're decoding as fast as possible, so when one decode fails, start another.
|
// We're decoding as fast as possible, so when one decode fails, start another.
|
||||||
state = State.PREVIEW;
|
state = State.PREVIEW;
|
||||||
CameraManager.get().requestPreviewFrame(decodeThread.handler, R.id.decode);
|
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
||||||
break;
|
break;
|
||||||
case R.id.return_scan_result:
|
case R.id.return_scan_result:
|
||||||
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
||||||
|
@ -94,7 +94,7 @@ public final class CaptureActivityHandler extends Handler {
|
||||||
public void quitSynchronously() {
|
public void quitSynchronously() {
|
||||||
state = State.DONE;
|
state = State.DONE;
|
||||||
CameraManager.get().stopPreview();
|
CameraManager.get().stopPreview();
|
||||||
Message quit = Message.obtain(decodeThread.handler, R.id.quit);
|
Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
|
||||||
quit.sendToTarget();
|
quit.sendToTarget();
|
||||||
try {
|
try {
|
||||||
decodeThread.join();
|
decodeThread.join();
|
||||||
|
@ -109,7 +109,7 @@ public final class CaptureActivityHandler extends Handler {
|
||||||
private void restartPreviewAndDecode() {
|
private void restartPreviewAndDecode() {
|
||||||
if (state == State.SUCCESS) {
|
if (state == State.SUCCESS) {
|
||||||
state = State.PREVIEW;
|
state = State.PREVIEW;
|
||||||
CameraManager.get().requestPreviewFrame(decodeThread.handler, R.id.decode);
|
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
||||||
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
|
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
|
||||||
activity.drawViewfinder();
|
activity.drawViewfinder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ final class DecodeThread extends Thread {
|
||||||
public static final String BARCODE_BITMAP = "barcode_bitmap";
|
public static final String BARCODE_BITMAP = "barcode_bitmap";
|
||||||
private static final String TAG = "DecodeThread";
|
private static final String TAG = "DecodeThread";
|
||||||
|
|
||||||
public Handler handler;
|
private Handler handler;
|
||||||
private final CaptureActivity activity;
|
private final CaptureActivity activity;
|
||||||
private final MultiFormatReader multiFormatReader;
|
private final MultiFormatReader multiFormatReader;
|
||||||
|
|
||||||
|
@ -77,6 +77,10 @@ final class DecodeThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handler getHandler() {
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
|
@ -175,13 +179,13 @@ final class DecodeThread extends Thread {
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
Log.v(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString());
|
Log.v(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString());
|
||||||
Message message = Message.obtain(activity.handler, R.id.decode_succeeded, rawResult);
|
Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putParcelable(BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
|
bundle.putParcelable(BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap());
|
||||||
message.setData(bundle);
|
message.setData(bundle);
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
} else {
|
} else {
|
||||||
Message message = Message.obtain(activity.handler, R.id.decode_failed);
|
Message message = Message.obtain(activity.getHandler(), R.id.decode_failed);
|
||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.client.android;
|
package com.google.zxing.client.android.book;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -47,6 +47,11 @@ import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.google.zxing.client.android.R;
|
||||||
|
import com.google.zxing.client.android.Intents;
|
||||||
|
import com.google.zxing.client.android.AndroidHttpClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses Google Book Search to find a word or phrase in the requested book.
|
* Uses Google Book Search to find a word or phrase in the requested book.
|
||||||
|
@ -64,7 +69,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
private ListView resultListView;
|
private ListView resultListView;
|
||||||
private TextView headerView;
|
private TextView headerView;
|
||||||
|
|
||||||
public final Handler handler = new Handler() {
|
private final Handler handler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
switch (message.what) {
|
switch (message.what) {
|
||||||
|
@ -95,6 +100,11 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private static final Pattern TAG_PATTERN = Pattern.compile("\\<.*?\\>");
|
||||||
|
private static final Pattern LT_ENTITY_PATTERN = Pattern.compile("<");
|
||||||
|
private static final Pattern GT_ENTITY_PATTERN = Pattern.compile(">");
|
||||||
|
private static final Pattern QUOTE_ENTITY_PATTERN = Pattern.compile("'");
|
||||||
|
private static final Pattern QUOT_ENTITY_PATTERN = Pattern.compile(""");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
|
@ -209,11 +219,11 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
String snippet = json.optString("snippet_text");
|
String snippet = json.optString("snippet_text");
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
if (snippet.length() > 0) {
|
if (snippet.length() > 0) {
|
||||||
snippet = snippet.replaceAll("\\<.*?\\>", "");
|
snippet = TAG_PATTERN.matcher(snippet).replaceAll("");
|
||||||
snippet = snippet.replaceAll("<", "<");
|
snippet = LT_ENTITY_PATTERN.matcher(snippet).replaceAll("<");
|
||||||
snippet = snippet.replaceAll(">", ">");
|
snippet = GT_ENTITY_PATTERN.matcher(snippet).replaceAll(">");
|
||||||
snippet = snippet.replaceAll("'", "'");
|
snippet = QUOTE_ENTITY_PATTERN.matcher(snippet).replaceAll("'");
|
||||||
snippet = snippet.replaceAll(""", "\"");
|
snippet = QUOT_ENTITY_PATTERN.matcher(snippet).replaceAll("\"");
|
||||||
} else {
|
} else {
|
||||||
snippet = '(' + getString(R.string.msg_sbc_snippet_unavailable) + ')';
|
snippet = '(' + getString(R.string.msg_sbc_snippet_unavailable) + ')';
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -279,7 +289,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
// Book Search requires a cookie to work, which we store persistently. If the cookie does
|
// Book Search requires a cookie to work, which we store persistently. If the cookie does
|
||||||
// not exist, this could be the first search or it has expired. Either way, do a quick HEAD
|
// not exist, this could be the first search or it has expired. Either way, do a quick HEAD
|
||||||
// request to fetch it, save it via the CookieSyncManager to flash, then return it.
|
// request to fetch it, save it via the CookieSyncManager to flash, then return it.
|
||||||
private String getCookie(String url) {
|
private static String getCookie(String url) {
|
||||||
String cookie = CookieManager.getInstance().getCookie(url);
|
String cookie = CookieManager.getInstance().getCookie(url);
|
||||||
if (cookie == null || cookie.length() == 0) {
|
if (cookie == null || cookie.length() == 0) {
|
||||||
Log.v(TAG, "Book Search cookie was missing or expired");
|
Log.v(TAG, "Book Search cookie was missing or expired");
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.client.android;
|
package com.google.zxing.client.android.book;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -24,12 +24,14 @@ import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.zxing.client.android.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manufactures list items which represent SBC results.
|
* Manufactures list items which represent SBC results.
|
||||||
*
|
*
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
public final class SearchBookContentsAdapter extends ArrayAdapter<SearchBookContentsResult> {
|
final class SearchBookContentsAdapter extends ArrayAdapter<SearchBookContentsResult> {
|
||||||
public SearchBookContentsAdapter(Context context, List<SearchBookContentsResult> items) {
|
public SearchBookContentsAdapter(Context context, List<SearchBookContentsResult> items) {
|
||||||
super(context, R.layout.search_book_contents_list_item, 0, items);
|
super(context, R.layout.search_book_contents_list_item, 0, items);
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.client.android;
|
package com.google.zxing.client.android.book;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
@ -24,13 +24,14 @@ import android.text.style.StyleSpan;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import com.google.zxing.client.android.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list item which displays the page number and snippet of this search result.
|
* A list item which displays the page number and snippet of this search result.
|
||||||
*
|
*
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
public final class SearchBookContentsListItem extends LinearLayout {
|
final class SearchBookContentsListItem extends LinearLayout {
|
||||||
private TextView pageNumberView;
|
private TextView pageNumberView;
|
||||||
private TextView snippetView;
|
private TextView snippetView;
|
||||||
|
|
|
@ -14,21 +14,21 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.client.android;
|
package com.google.zxing.client.android.book;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The underlying data for a SBC result.
|
* The underlying data for a SBC result.
|
||||||
*
|
*
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
public final class SearchBookContentsResult {
|
final class SearchBookContentsResult {
|
||||||
private static String query;
|
private static String query;
|
||||||
|
|
||||||
private final String pageNumber;
|
private final String pageNumber;
|
||||||
private final String snippet;
|
private final String snippet;
|
||||||
private final boolean validSnippet;
|
private final boolean validSnippet;
|
||||||
|
|
||||||
public SearchBookContentsResult(String pageNumber, String snippet, boolean validSnippet) {
|
SearchBookContentsResult(String pageNumber, String snippet, boolean validSnippet) {
|
||||||
this.pageNumber = pageNumber;
|
this.pageNumber = pageNumber;
|
||||||
this.snippet = snippet;
|
this.snippet = snippet;
|
||||||
this.validSnippet = validSnippet;
|
this.validSnippet = validSnippet;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.client.android;
|
package com.google.zxing.client.android.encode;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -31,6 +31,8 @@ import android.view.View;
|
||||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import com.google.zxing.client.android.R;
|
||||||
|
import com.google.zxing.client.android.Intents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class encodes data from an Intent into a QR code, and then displays it full screen so that
|
* This class encodes data from an Intent into a QR code, and then displays it full screen so that
|
||||||
|
@ -38,7 +40,7 @@ import android.widget.TextView;
|
||||||
*
|
*
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
public final class EncodeActivity extends Activity {
|
final class EncodeActivity extends Activity {
|
||||||
private QRCodeEncoder qrCodeEncoder;
|
private QRCodeEncoder qrCodeEncoder;
|
||||||
private ProgressDialog progressDialog;
|
private ProgressDialog progressDialog;
|
||||||
private boolean firstLayout;
|
private boolean firstLayout;
|
||||||
|
@ -47,7 +49,7 @@ public final class EncodeActivity extends Activity {
|
||||||
* This needs to be delayed until after the first layout so that the view dimensions will be
|
* This needs to be delayed until after the first layout so that the view dimensions will be
|
||||||
* available.
|
* available.
|
||||||
*/
|
*/
|
||||||
public final OnGlobalLayoutListener layoutListener = new OnGlobalLayoutListener() {
|
private final OnGlobalLayoutListener layoutListener = new OnGlobalLayoutListener() {
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
if (firstLayout) {
|
if (firstLayout) {
|
||||||
View layout = findViewById(R.id.encode_view);
|
View layout = findViewById(R.id.encode_view);
|
||||||
|
@ -71,7 +73,7 @@ public final class EncodeActivity extends Activity {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public final Handler handler = new Handler() {
|
private final Handler handler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
switch (message.what) {
|
switch (message.what) {
|
|
@ -14,11 +14,14 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.client.android;
|
package com.google.zxing.client.android.encode;
|
||||||
|
|
||||||
import com.google.zxing.BarcodeFormat;
|
import com.google.zxing.BarcodeFormat;
|
||||||
import com.google.zxing.MultiFormatWriter;
|
import com.google.zxing.MultiFormatWriter;
|
||||||
import com.google.zxing.WriterException;
|
import com.google.zxing.WriterException;
|
||||||
|
import com.google.zxing.client.android.Intents;
|
||||||
|
import com.google.zxing.client.android.Contents;
|
||||||
|
import com.google.zxing.client.android.R;
|
||||||
import com.google.zxing.common.ByteMatrix;
|
import com.google.zxing.common.ByteMatrix;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -37,7 +40,7 @@ import android.util.Log;
|
||||||
*
|
*
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
public final class QRCodeEncoder {
|
final class QRCodeEncoder {
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
private String contents;
|
private String contents;
|
||||||
private String displayContents;
|
private String displayContents;
|
||||||
|
@ -96,18 +99,19 @@ public final class QRCodeEncoder {
|
||||||
contents = data;
|
contents = data;
|
||||||
displayContents = data;
|
displayContents = data;
|
||||||
title = activity.getString(R.string.contents_text);
|
title = activity.getString(R.string.contents_text);
|
||||||
if (format.equals(Contents.Format.CODE_128))
|
if (format.equals(Contents.Format.CODE_128)) {
|
||||||
this.format = BarcodeFormat.CODE_128;
|
this.format = BarcodeFormat.CODE_128;
|
||||||
else if (format.equals(Contents.Format.CODE_39))
|
} else if (format.equals(Contents.Format.CODE_39)) {
|
||||||
this.format = BarcodeFormat.CODE_39;
|
this.format = BarcodeFormat.CODE_39;
|
||||||
else if (format.equals(Contents.Format.EAN_8))
|
} else if (format.equals(Contents.Format.EAN_8)) {
|
||||||
this.format = BarcodeFormat.EAN_8;
|
this.format = BarcodeFormat.EAN_8;
|
||||||
else if (format.equals(Contents.Format.EAN_13))
|
} else if (format.equals(Contents.Format.EAN_13)) {
|
||||||
this.format = BarcodeFormat.EAN_13;
|
this.format = BarcodeFormat.EAN_13;
|
||||||
else if (format.equals(Contents.Format.UPC_A))
|
} else if (format.equals(Contents.Format.UPC_A)) {
|
||||||
this.format = BarcodeFormat.UPC_A;
|
this.format = BarcodeFormat.UPC_A;
|
||||||
else if (format.equals(Contents.Format.UPC_E))
|
} else if (format.equals(Contents.Format.UPC_E)) {
|
||||||
this.format = BarcodeFormat.UPC_E;
|
this.format = BarcodeFormat.UPC_E;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return contents != null && contents.length() > 0;
|
return contents != null && contents.length() > 0;
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009 ZXing authors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.zxing.client.android.history;
|
||||||
|
|
||||||
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sean Owen
|
||||||
|
*/
|
||||||
|
final class DBHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
|
private static final int DB_VERSION = 1;
|
||||||
|
private static final String DB_NAME = "barcode_scanner_history.db";
|
||||||
|
static final String TABLE_NAME = "history";
|
||||||
|
private static final String ID_COL = "id";
|
||||||
|
static final String TEXT_COL = "text";
|
||||||
|
static final String TIMESTAMP_COL = "timestamp";
|
||||||
|
|
||||||
|
DBHelper(Context context) {
|
||||||
|
super(context, DB_NAME, null, DB_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(SQLiteDatabase sqLiteDatabase) {
|
||||||
|
sqLiteDatabase.execSQL(
|
||||||
|
"CREATE TABLE " + TABLE_NAME + " (" +
|
||||||
|
ID_COL + " INTEGER PRIMARY KEY, " +
|
||||||
|
TEXT_COL + " TEXT, " +
|
||||||
|
TIMESTAMP_COL + " INTEGER" +
|
||||||
|
");");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009 ZXing authors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.zxing.client.android.history;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.os.Message;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.google.zxing.client.android.R;
|
||||||
|
import com.google.zxing.client.android.CaptureActivity;
|
||||||
|
import com.google.zxing.Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sean Owen
|
||||||
|
*/
|
||||||
|
public final class HistoryManager {
|
||||||
|
|
||||||
|
private final CaptureActivity activity;
|
||||||
|
|
||||||
|
public HistoryManager(CaptureActivity activity) {
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> getHistoryItems() {
|
||||||
|
|
||||||
|
SQLiteOpenHelper helper = new DBHelper(activity);
|
||||||
|
SQLiteDatabase db = helper.getReadableDatabase();
|
||||||
|
List<String> items = new ArrayList<String>();
|
||||||
|
try {
|
||||||
|
Cursor cursor = db.query(DBHelper.TABLE_NAME,
|
||||||
|
new String[] {DBHelper.TEXT_COL},
|
||||||
|
null, null, null, null,
|
||||||
|
DBHelper.TIMESTAMP_COL + " DESC");
|
||||||
|
while (cursor.moveToNext()) {
|
||||||
|
items.add(cursor.getString(0));
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
db.close();
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AlertDialog buildAlert() {
|
||||||
|
List<String> items = getHistoryItems();
|
||||||
|
final String[] dialogItems = new String[items.size() + 1];
|
||||||
|
for (int i = 0; i < items.size(); i++) {
|
||||||
|
dialogItems[i] = items.get(i);
|
||||||
|
}
|
||||||
|
dialogItems[dialogItems.length - 1] = activity.getResources().getString(R.string.history_clear_text);
|
||||||
|
DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
if (i == dialogItems.length - 1) {
|
||||||
|
clearHistory();
|
||||||
|
} else {
|
||||||
|
Result result = new Result(dialogItems[i], null, null, null);
|
||||||
|
Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, result);
|
||||||
|
message.sendToTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||||
|
builder.setTitle(R.string.history_title);
|
||||||
|
builder.setItems(dialogItems, clickListener);
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addHistoryItem(String text) {
|
||||||
|
|
||||||
|
if (getHistoryItems().contains(text)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SQLiteOpenHelper helper = new DBHelper(activity);
|
||||||
|
SQLiteDatabase db = helper.getWritableDatabase();
|
||||||
|
try {
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(DBHelper.TEXT_COL, text);
|
||||||
|
values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());
|
||||||
|
db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
|
||||||
|
} finally {
|
||||||
|
db.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearHistory() {
|
||||||
|
SQLiteOpenHelper helper = new DBHelper(activity);
|
||||||
|
SQLiteDatabase db = helper.getWritableDatabase();
|
||||||
|
try {
|
||||||
|
db.delete(DBHelper.TABLE_NAME, null, null);
|
||||||
|
} finally {
|
||||||
|
db.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -107,7 +107,7 @@ public final class AddressBookResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
AddressBookParsedResult addressResult = (AddressBookParsedResult) result;
|
AddressBookParsedResult addressResult = (AddressBookParsedResult) getResult();
|
||||||
int action = mapIndexToAction(index);
|
int action = mapIndexToAction(index);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -135,7 +135,7 @@ public final class AddressBookResultHandler extends ResultHandler {
|
||||||
// Overriden so we can hyphenate phone numbers, format birthdays, and bold the name.
|
// Overriden so we can hyphenate phone numbers, format birthdays, and bold the name.
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getDisplayContents() {
|
public CharSequence getDisplayContents() {
|
||||||
AddressBookParsedResult result = (AddressBookParsedResult) this.result;
|
AddressBookParsedResult result = (AddressBookParsedResult) getResult();
|
||||||
StringBuffer contents = new StringBuffer();
|
StringBuffer contents = new StringBuffer();
|
||||||
ParsedResult.maybeAppend(result.getNames(), contents);
|
ParsedResult.maybeAppend(result.getNames(), contents);
|
||||||
int namesLength = contents.length();
|
int namesLength = contents.length();
|
||||||
|
|
|
@ -58,7 +58,7 @@ public final class CalendarResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
CalendarParsedResult calendarResult = (CalendarParsedResult) result;
|
CalendarParsedResult calendarResult = (CalendarParsedResult) getResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
addCalendarEvent(calendarResult.getSummary(), calendarResult.getStart(),
|
addCalendarEvent(calendarResult.getSummary(), calendarResult.getStart(),
|
||||||
|
@ -69,7 +69,7 @@ public final class CalendarResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getDisplayContents() {
|
public CharSequence getDisplayContents() {
|
||||||
CalendarParsedResult calResult = (CalendarParsedResult) result;
|
CalendarParsedResult calResult = (CalendarParsedResult) getResult();
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuffer result = new StringBuffer();
|
||||||
ParsedResult.maybeAppend(calResult.getSummary(), result);
|
ParsedResult.maybeAppend(calResult.getSummary(), result);
|
||||||
appendTime(calResult.getStart(), result);
|
appendTime(calResult.getStart(), result);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public final class EmailAddressResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
EmailAddressParsedResult emailResult = (EmailAddressParsedResult) result;
|
EmailAddressParsedResult emailResult = (EmailAddressParsedResult) getResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
sendEmailFromUri(emailResult.getMailtoURI(), null, null);
|
sendEmailFromUri(emailResult.getMailtoURI(), null, null);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public final class GeoResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
GeoParsedResult geoResult = (GeoParsedResult) result;
|
GeoParsedResult geoResult = (GeoParsedResult) getResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
openMap(geoResult.getGeoURI());
|
openMap(geoResult.getGeoURI());
|
||||||
|
|
|
@ -59,7 +59,7 @@ public final class ISBNResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
ISBNParsedResult isbnResult = (ISBNParsedResult) result;
|
ISBNParsedResult isbnResult = (ISBNParsedResult) getResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
openProductSearch(isbnResult.getISBN());
|
openProductSearch(isbnResult.getISBN());
|
||||||
|
|
|
@ -57,7 +57,7 @@ public final class ProductResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
ProductParsedResult productResult = (ProductParsedResult) result;
|
ProductParsedResult productResult = (ProductParsedResult) getResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
openProductSearch(productResult.getNormalizedProductID());
|
openProductSearch(productResult.getNormalizedProductID());
|
||||||
|
|
|
@ -26,8 +26,8 @@ import android.widget.Button;
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
public final class ResultButtonListener implements Button.OnClickListener {
|
public final class ResultButtonListener implements Button.OnClickListener {
|
||||||
final ResultHandler resultHandler;
|
private final ResultHandler resultHandler;
|
||||||
final int index;
|
private final int index;
|
||||||
|
|
||||||
public ResultButtonListener(ResultHandler resultHandler, int index) {
|
public ResultButtonListener(ResultHandler resultHandler, int index) {
|
||||||
this.resultHandler = resultHandler;
|
this.resultHandler = resultHandler;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.google.zxing.client.android.Contents;
|
||||||
import com.google.zxing.client.android.Intents;
|
import com.google.zxing.client.android.Intents;
|
||||||
import com.google.zxing.client.android.LocaleManager;
|
import com.google.zxing.client.android.LocaleManager;
|
||||||
import com.google.zxing.client.android.R;
|
import com.google.zxing.client.android.R;
|
||||||
import com.google.zxing.client.android.SearchBookContentsActivity;
|
import com.google.zxing.client.android.book.SearchBookContentsActivity;
|
||||||
import com.google.zxing.client.result.ParsedResult;
|
import com.google.zxing.client.result.ParsedResult;
|
||||||
import com.google.zxing.client.result.ParsedResultType;
|
import com.google.zxing.client.result.ParsedResultType;
|
||||||
|
|
||||||
|
@ -54,14 +54,18 @@ public abstract class ResultHandler {
|
||||||
|
|
||||||
public static final int MAX_BUTTON_COUNT = 4;
|
public static final int MAX_BUTTON_COUNT = 4;
|
||||||
|
|
||||||
protected final ParsedResult result;
|
private final ParsedResult result;
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
|
|
||||||
protected ResultHandler(Activity activity, ParsedResult result) {
|
ResultHandler(Activity activity, ParsedResult result) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ParsedResult getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates how many buttons the derived class wants shown.
|
* Indicates how many buttons the derived class wants shown.
|
||||||
*
|
*
|
||||||
|
@ -119,7 +123,7 @@ public abstract class ResultHandler {
|
||||||
* @param start The start time as yyyyMMdd or yyyyMMdd'T'HHmmss or yyyyMMdd'T'HHmmss'Z'
|
* @param start The start time as yyyyMMdd or yyyyMMdd'T'HHmmss or yyyyMMdd'T'HHmmss'Z'
|
||||||
* @param end The end time as yyyyMMdd or yyyyMMdd'T'HHmmss or yyyyMMdd'T'HHmmss'Z'
|
* @param end The end time as yyyyMMdd or yyyyMMdd'T'HHmmss or yyyyMMdd'T'HHmmss'Z'
|
||||||
*/
|
*/
|
||||||
public final void addCalendarEvent(String summary, String start, String end) {
|
final void addCalendarEvent(String summary, String start, String end) {
|
||||||
Intent intent = new Intent(Intent.ACTION_EDIT);
|
Intent intent = new Intent(Intent.ACTION_EDIT);
|
||||||
intent.setType("vnd.android.cursor.item/event");
|
intent.setType("vnd.android.cursor.item/event");
|
||||||
intent.putExtra("beginTime", calculateMilliseconds(start));
|
intent.putExtra("beginTime", calculateMilliseconds(start));
|
||||||
|
@ -155,7 +159,7 @@ public abstract class ResultHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void addContact(String[] names, String[] phoneNumbers, String[] emails, String note,
|
final void addContact(String[] names, String[] phoneNumbers, String[] emails, String note,
|
||||||
String address, String org, String title) {
|
String address, String org, String title) {
|
||||||
|
|
||||||
// Only use the first name in the array, if present.
|
// Only use the first name in the array, if present.
|
||||||
|
@ -180,16 +184,16 @@ public abstract class ResultHandler {
|
||||||
launchIntent(intent);
|
launchIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void shareByEmail(String contents) {
|
final void shareByEmail(String contents) {
|
||||||
sendEmailFromUri("mailto:", activity.getString(R.string.msg_share_subject_line), contents);
|
sendEmailFromUri("mailto:", activity.getString(R.string.msg_share_subject_line), contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void sendEmail(String address, String subject, String body) {
|
final void sendEmail(String address, String subject, String body) {
|
||||||
sendEmailFromUri("mailto:" + address, subject, body);
|
sendEmailFromUri("mailto:" + address, subject, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use public Intent fields rather than private GMail app fields to specify subject and body.
|
// Use public Intent fields rather than private GMail app fields to specify subject and body.
|
||||||
public final void sendEmailFromUri(String uri, String subject, String body) {
|
final void sendEmailFromUri(String uri, String subject, String body) {
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse(uri));
|
Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse(uri));
|
||||||
putExtra(intent, Intent.EXTRA_SUBJECT, subject);
|
putExtra(intent, Intent.EXTRA_SUBJECT, subject);
|
||||||
putExtra(intent, Intent.EXTRA_TEXT, body);
|
putExtra(intent, Intent.EXTRA_TEXT, body);
|
||||||
|
@ -197,16 +201,16 @@ public abstract class ResultHandler {
|
||||||
launchIntent(intent);
|
launchIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void shareBySMS(String contents) {
|
final void shareBySMS(String contents) {
|
||||||
sendSMSFromUri("smsto:", activity.getString(R.string.msg_share_subject_line) + ":\n" +
|
sendSMSFromUri("smsto:", activity.getString(R.string.msg_share_subject_line) + ":\n" +
|
||||||
contents);
|
contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void sendSMS(String phoneNumber, String body) {
|
final void sendSMS(String phoneNumber, String body) {
|
||||||
sendSMSFromUri("smsto:" + phoneNumber, body);
|
sendSMSFromUri("smsto:" + phoneNumber, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void sendSMSFromUri(String uri, String body) {
|
final void sendSMSFromUri(String uri, String body) {
|
||||||
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
|
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
|
||||||
putExtra(intent, "sms_body", body);
|
putExtra(intent, "sms_body", body);
|
||||||
// Exit the app once the SMS is sent
|
// Exit the app once the SMS is sent
|
||||||
|
@ -214,11 +218,11 @@ public abstract class ResultHandler {
|
||||||
launchIntent(intent);
|
launchIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void sendMMS(String phoneNumber, String subject, String body) {
|
final void sendMMS(String phoneNumber, String subject, String body) {
|
||||||
sendMMSFromUri("mmsto:" + phoneNumber, subject, body);
|
sendMMSFromUri("mmsto:" + phoneNumber, subject, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void sendMMSFromUri(String uri, String subject, String body) {
|
final void sendMMSFromUri(String uri, String subject, String body) {
|
||||||
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
|
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
|
||||||
// The Messaging app needs to see a valid subject or else it will treat this an an SMS.
|
// The Messaging app needs to see a valid subject or else it will treat this an an SMS.
|
||||||
if (subject == null || subject.length() == 0) {
|
if (subject == null || subject.length() == 0) {
|
||||||
|
@ -231,15 +235,15 @@ public abstract class ResultHandler {
|
||||||
launchIntent(intent);
|
launchIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void dialPhone(String phoneNumber) {
|
final void dialPhone(String phoneNumber) {
|
||||||
launchIntent(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber)));
|
launchIntent(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void dialPhoneFromUri(String uri) {
|
final void dialPhoneFromUri(String uri) {
|
||||||
launchIntent(new Intent(Intent.ACTION_DIAL, Uri.parse(uri)));
|
launchIntent(new Intent(Intent.ACTION_DIAL, Uri.parse(uri)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void openMap(String geoURI) {
|
final void openMap(String geoURI) {
|
||||||
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(geoURI)));
|
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(geoURI)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +253,7 @@ public abstract class ResultHandler {
|
||||||
* @param address The address to find
|
* @param address The address to find
|
||||||
* @param title An optional title, e.g. the name of the business at this address
|
* @param title An optional title, e.g. the name of the business at this address
|
||||||
*/
|
*/
|
||||||
public final void searchMap(String address, String title) {
|
final void searchMap(String address, String title) {
|
||||||
String query = address;
|
String query = address;
|
||||||
if (title != null && title.length() > 0) {
|
if (title != null && title.length() > 0) {
|
||||||
query = query + " (" + title + ')';
|
query = query + " (" + title + ')';
|
||||||
|
@ -257,42 +261,42 @@ public abstract class ResultHandler {
|
||||||
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(query))));
|
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(query))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void getDirections(double latitude, double longitude) {
|
final void getDirections(double latitude, double longitude) {
|
||||||
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google." +
|
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google." +
|
||||||
LocaleManager.getCountryTLD() + "/maps?f=d&daddr=" + latitude + ',' + longitude)));
|
LocaleManager.getCountryTLD() + "/maps?f=d&daddr=" + latitude + ',' + longitude)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uses the mobile-specific version of Product Search, which is formatted for small screens.
|
// Uses the mobile-specific version of Product Search, which is formatted for small screens.
|
||||||
public final void openProductSearch(String upc) {
|
final void openProductSearch(String upc) {
|
||||||
Uri uri = Uri.parse("http://www.google." + LocaleManager.getProductSearchCountryTLD() +
|
Uri uri = Uri.parse("http://www.google." + LocaleManager.getProductSearchCountryTLD() +
|
||||||
"/m/products?q=" + upc + "&source=zxing");
|
"/m/products?q=" + upc + "&source=zxing");
|
||||||
launchIntent(new Intent(Intent.ACTION_VIEW, uri));
|
launchIntent(new Intent(Intent.ACTION_VIEW, uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void openBookSearch(String isbn) {
|
final void openBookSearch(String isbn) {
|
||||||
Uri uri = Uri.parse("http://books.google." + LocaleManager.getBookSearchCountryTLD() +
|
Uri uri = Uri.parse("http://books.google." + LocaleManager.getBookSearchCountryTLD() +
|
||||||
"/books?vid=isbn" + isbn);
|
"/books?vid=isbn" + isbn);
|
||||||
launchIntent(new Intent(Intent.ACTION_VIEW, uri));
|
launchIntent(new Intent(Intent.ACTION_VIEW, uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void searchBookContents(String isbn) {
|
final void searchBookContents(String isbn) {
|
||||||
Intent intent = new Intent(Intents.SearchBookContents.ACTION);
|
Intent intent = new Intent(Intents.SearchBookContents.ACTION);
|
||||||
intent.setClassName(activity, SearchBookContentsActivity.class.getName());
|
intent.setClassName(activity, SearchBookContentsActivity.class.getName());
|
||||||
putExtra(intent, Intents.SearchBookContents.ISBN, isbn);
|
putExtra(intent, Intents.SearchBookContents.ISBN, isbn);
|
||||||
launchIntent(intent);
|
launchIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void openURL(String url) {
|
final void openURL(String url) {
|
||||||
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void webSearch(String query) {
|
final void webSearch(String query) {
|
||||||
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
|
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
|
||||||
intent.putExtra("query", query);
|
intent.putExtra("query", query);
|
||||||
launchIntent(intent);
|
launchIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchIntent(Intent intent) {
|
void launchIntent(Intent intent) {
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
try {
|
try {
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public final class SMSResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
SMSParsedResult smsResult = (SMSParsedResult) result;
|
SMSParsedResult smsResult = (SMSParsedResult) getResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
sendSMS(smsResult.getNumber(), smsResult.getBody());
|
sendSMS(smsResult.getNumber(), smsResult.getBody());
|
||||||
|
@ -63,7 +63,7 @@ public final class SMSResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getDisplayContents() {
|
public CharSequence getDisplayContents() {
|
||||||
SMSParsedResult smsResult = (SMSParsedResult) result;
|
SMSParsedResult smsResult = (SMSParsedResult) getResult();
|
||||||
StringBuffer contents = new StringBuffer();
|
StringBuffer contents = new StringBuffer();
|
||||||
ParsedResult.maybeAppend(PhoneNumberUtils.formatNumber(smsResult.getNumber()), contents);
|
ParsedResult.maybeAppend(PhoneNumberUtils.formatNumber(smsResult.getNumber()), contents);
|
||||||
ParsedResult.maybeAppend(smsResult.getVia(), contents);
|
ParsedResult.maybeAppend(smsResult.getVia(), contents);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public final class TelResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
TelParsedResult telResult = (TelParsedResult) result;
|
TelParsedResult telResult = (TelParsedResult) getResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
dialPhoneFromUri(telResult.getTelURI());
|
dialPhoneFromUri(telResult.getTelURI());
|
||||||
|
@ -66,7 +66,7 @@ public final class TelResultHandler extends ResultHandler {
|
||||||
// Overriden so we can take advantage of Android's phone number hyphenation routines.
|
// Overriden so we can take advantage of Android's phone number hyphenation routines.
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getDisplayContents() {
|
public CharSequence getDisplayContents() {
|
||||||
String contents = result.getDisplayResult();
|
String contents = getResult().getDisplayResult();
|
||||||
contents = contents.replace("\r", "");
|
contents = contents.replace("\r", "");
|
||||||
return PhoneNumberUtils.formatNumber(contents);
|
return PhoneNumberUtils.formatNumber(contents);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public final class TextResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
String text = result.getDisplayResult();
|
String text = getResult().getDisplayResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
webSearch(text);
|
webSearch(text);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public final class URIResultHandler extends ResultHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleButtonPress(int index) {
|
public void handleButtonPress(int index) {
|
||||||
URIParsedResult uriResult = (URIParsedResult) result;
|
URIParsedResult uriResult = (URIParsedResult) getResult();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
openURL(uriResult.getURI());
|
openURL(uriResult.getURI());
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.client.android;
|
package com.google.zxing.client.android.share;
|
||||||
|
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -25,6 +25,7 @@ import android.view.View;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.SimpleCursorAdapter;
|
import android.widget.SimpleCursorAdapter;
|
||||||
|
import com.google.zxing.client.android.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is only needed because I can't successfully send an ACTION_PICK intent to
|
* This class is only needed because I can't successfully send an ACTION_PICK intent to
|
||||||
|
@ -32,7 +33,7 @@ import android.widget.SimpleCursorAdapter;
|
||||||
*
|
*
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
*/
|
*/
|
||||||
public final class BookmarkPickerActivity extends ListActivity {
|
final class BookmarkPickerActivity extends ListActivity {
|
||||||
private static final String[] BOOKMARK_PROJECTION = {
|
private static final String[] BOOKMARK_PROJECTION = {
|
||||||
Browser.BookmarkColumns.TITLE,
|
Browser.BookmarkColumns.TITLE,
|
||||||
Browser.BookmarkColumns.URL
|
Browser.BookmarkColumns.URL
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.client.android;
|
package com.google.zxing.client.android.share;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
|
@ -28,6 +28,9 @@ import android.provider.BaseColumns;
|
||||||
import android.text.ClipboardManager;
|
import android.text.ClipboardManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import com.google.zxing.client.android.Intents;
|
||||||
|
import com.google.zxing.client.android.Contents;
|
||||||
|
import com.google.zxing.client.android.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Barcode Scanner can share data like contacts and bookmarks by displaying a QR Code on screen,
|
* Barcode Scanner can share data like contacts and bookmarks by displaying a QR Code on screen,
|
Loading…
Reference in a new issue