|
|
|
@ -49,20 +49,16 @@ public final class CaptureActivityHandler extends Handler {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handleMessage(Message message) {
|
|
|
|
public void handleMessage(Message message) {
|
|
|
|
switch (message.what) {
|
|
|
|
if(message.what==R.id.auto_focus){
|
|
|
|
case R.id.auto_focus:
|
|
|
|
|
|
|
|
//Log.d(TAG, "Got auto-focus message");
|
|
|
|
|
|
|
|
// When one auto focus pass finishes, start another. This is the closest thing to
|
|
|
|
|
|
|
|
// continuous AF. It does seem to hunt background bit, but I'm not sure what else to do.
|
|
|
|
|
|
|
|
if (state == State.PREVIEW) {
|
|
|
|
if (state == State.PREVIEW) {
|
|
|
|
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
|
|
|
|
CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case R.id.restart_preview:
|
|
|
|
if(message.what==R.id.restart_preview){
|
|
|
|
Log.d(TAG, "Got restart preview message");
|
|
|
|
Log.d(TAG, "Got restart preview message");
|
|
|
|
restartPreviewAndDecode();
|
|
|
|
restartPreviewAndDecode();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case R.id.decode_succeeded:
|
|
|
|
if(message.what==R.id.decode_succeeded){
|
|
|
|
Log.d(TAG, "Got decode succeeded message");
|
|
|
|
Log.d(TAG, "Got decode succeeded message");
|
|
|
|
state = State.SUCCESS;
|
|
|
|
state = State.SUCCESS;
|
|
|
|
Bundle bundle = message.getData();
|
|
|
|
Bundle bundle = message.getData();
|
|
|
|
@ -71,26 +67,67 @@ public final class CaptureActivityHandler extends Handler {
|
|
|
|
Bitmap barcode = bundle == null ? null :
|
|
|
|
Bitmap barcode = bundle == null ? null :
|
|
|
|
(Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
(Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
activity.handleDecode((Result) message.obj, barcode);//<2F><><EFBFBD>ؽ<EFBFBD><D8BD>? /***********************************************************************/
|
|
|
|
activity.handleDecode((Result) message.obj, barcode);
|
|
|
|
break;
|
|
|
|
/***********************************************************************/
|
|
|
|
case R.id.decode_failed:
|
|
|
|
}
|
|
|
|
// We're decoding as fast as possible, so when one decode fails, start another.
|
|
|
|
if(message.what==R.id.decode_failed){
|
|
|
|
state = State.PREVIEW;
|
|
|
|
state = State.PREVIEW;
|
|
|
|
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
|
|
|
CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case R.id.return_scan_result:
|
|
|
|
if(message.what==R.id.return_scan_result){
|
|
|
|
Log.d(TAG, "Got return scan result message");
|
|
|
|
Log.d(TAG, "Got return scan result message");
|
|
|
|
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
|
|
|
activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
|
|
|
activity.finish();
|
|
|
|
activity.finish();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case R.id.launch_product_query:
|
|
|
|
if(message.what==R.id.launch_product_query){
|
|
|
|
Log.d(TAG, "Got product query message");
|
|
|
|
Log.d(TAG, "Got product query message");
|
|
|
|
String url = (String) message.obj;
|
|
|
|
String url = (String) message.obj;
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
|
|
activity.startActivity(intent);
|
|
|
|
activity.startActivity(intent);
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// switch (message.what) {
|
|
|
|
|
|
|
|
// case R.id.auto_focus:
|
|
|
|
|
|
|
|
// //Log.d(TAG, "Got auto-focus message");
|
|
|
|
|
|
|
|
// // When one auto focus pass finishes, start another. This is the closest thing to
|
|
|
|
|
|
|
|
// // continuous AF. It does seem to hunt background bit, but I'm not sure what else to do.
|
|
|
|
|
|
|
|
// if (state == State.PREVIEW) {
|
|
|
|
|
|
|
|
// CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case R.id.restart_preview:
|
|
|
|
|
|
|
|
// Log.d(TAG, "Got restart preview message");
|
|
|
|
|
|
|
|
// restartPreviewAndDecode();
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case R.id.decode_succeeded:
|
|
|
|
|
|
|
|
// Log.d(TAG, "Got decode succeeded message");
|
|
|
|
|
|
|
|
// state = State.SUCCESS;
|
|
|
|
|
|
|
|
// Bundle bundle = message.getData();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// /***********************************************************************/
|
|
|
|
|
|
|
|
// Bitmap barcode = bundle == null ? null :
|
|
|
|
|
|
|
|
// (Bitmap) bundle.getParcelable(DecodeThread.BARCODE_BITMAP);//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// activity.handleDecode((Result) message.obj, barcode);//<2F><><EFBFBD>ؽ<EFBFBD><D8BD>? /***********************************************************************/
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case R.id.decode_failed:
|
|
|
|
|
|
|
|
// // We're decoding as fast as possible, so when one decode fails, start another.
|
|
|
|
|
|
|
|
// state = State.PREVIEW;
|
|
|
|
|
|
|
|
// CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case R.id.return_scan_result:
|
|
|
|
|
|
|
|
// Log.d(TAG, "Got return scan result message");
|
|
|
|
|
|
|
|
// activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
|
|
|
|
|
|
|
|
// activity.finish();
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case R.id.launch_product_query:
|
|
|
|
|
|
|
|
// Log.d(TAG, "Got product query message");
|
|
|
|
|
|
|
|
// String url = (String) message.obj;
|
|
|
|
|
|
|
|
// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
|
|
|
|
|
|
|
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
|
|
|
|
|
|
// activity.startActivity(intent);
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void quitSynchronously() {
|
|
|
|
public void quitSynchronously() {
|
|
|
|
|