Exemple #1
0
 @Override
 protected void onPause() {
   if (handler != null) {
     handler.quitSynchronously();
     handler = null;
   }
   inactivityTimer.onPause();
   beepManager.close();
   cameraManager.closeDriver();
   if (!isHasSurface) {
     scanPreview.getHolder().removeCallback(this);
   }
   super.onPause();
 }
Exemple #2
0
  /**
   * A valid barcode has been found, so give an indication of success and show the results.
   *
   * @param rawResult The contents of the barcode.
   * @param bundle The extras
   */
  public void handleDecode(final Result rawResult, Bundle bundle) {
    inactivityTimer.onActivity();
    beepManager.playBeepSoundAndVibrate();

    // 通过这种方式可以获取到扫描的图片
    //	bundle.putInt("width", mCropRect.width());
    //	bundle.putInt("height", mCropRect.height());
    //	bundle.putString("result", rawResult.getText());
    //
    //	startActivity(new Intent(CaptureActivity.this, ResultActivity.class)
    //		.putExtras(bundle));

    handler.postDelayed(
        new Runnable() {

          @Override
          public void run() {
            handleText(rawResult.getText());
          }
        },
        800);
  }