예제 #1
0
 public void onClick(View view) {
   if (isEmulator()) {
     searchBook("9789631186192");
   } else {
     IntentIntegrator.initiateScan(this);
   }
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.cart_add_by_voice:
       Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
       intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getClass().getPackage().getName());
       intent.putExtra(RecognizerIntent.EXTRA_PROMPT, getString(R.string.cart_add_voice_prompt));
       intent.putExtra(
           RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
       intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5);
       startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
       break;
     case R.id.cart_add_by_barcode:
       IntentIntegrator integrator = new IntentIntegrator(this);
       integrator.initiateScan();
       break;
     case android.R.id.home:
       if (mDrawerLayout.isDrawerOpen(mDrawerList)) mDrawerLayout.closeDrawer(mDrawerList);
       else {
         // Specify the parent activity
         Intent parentActivityIntent = new Intent(this, ShopCartOverviewFragmentActivity.class);
         parentActivityIntent.addFlags(
             Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(parentActivityIntent);
         this.finish();
       }
       return true;
   }
   return super.onOptionsItemSelected(item);
 }
예제 #3
0
 private void startScannerApplication() {
   final IntentIntegrator integrator = new IntentIntegrator(this);
   // integrator dialog is English only, therefore localize it
   integrator.setButtonYesByID(android.R.string.yes);
   integrator.setButtonNoByID(android.R.string.no);
   integrator.setTitleByID(R.string.menu_scan_geo);
   integrator.setMessageByID(R.string.menu_scan_description);
   integrator.initiateScan(IntentIntegrator.QR_CODE_TYPES);
 }
  @Override
  public void onClick(View v) {
    if (v.getId() == R.id.btnScan) {
      // Initiate scan
      IntentIntegrator scanIntegrator = new IntentIntegrator(this);

      scanIntegrator.initiateScan();
    }
  }
 public void scanNow() {
   IntentIntegrator integrator = new IntentIntegrator(this);
   integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
   integrator.setPrompt("Scan a barcode");
   integrator.setResultDisplayDuration(0);
   integrator.setWide(); // Wide scanning rectangle, may work better for 1D barcodes
   integrator.setCameraId(0); // Use a specific camera of the device
   integrator.initiateScan();
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.webModeration:
       IntentIntegrator integrator = new IntentIntegrator(this);
       integrator.setCaptureActivity(CaptureActivityAnyOrientation.class);
       integrator.setOrientationLocked(false);
       integrator.initiateScan();
   }
   return super.onOptionsItemSelected(item);
 }
  /**
   * event handler for scan button instantiates an instance of the Intent Integrator and send an
   * Intent to the barcode scanner of the device.
   *
   * @param view view of the activity
   */
  public void scanQR(View view) {

    // create an instance of the integrator class which
    // will send the scan intent to the devices barcode scanner
    IntentIntegrator integrator = new IntentIntegrator(this);
    // sets the type of code that will be scanned
    integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
    integrator.setPrompt(String.valueOf(R.string.txt_scan_qrcode));
    integrator.setResultDisplayDuration(0);
    integrator.setCameraId(0); // Use a specific camera of the device
    integrator.initiateScan(); // starts the scan
  }
예제 #8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bar_code);

    IntentIntegrator integrator = new IntentIntegrator(this);
    integrator.setCaptureActivity(AnyOrientationCaptureActivity.class);
    integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
    integrator.setPrompt("Scan something"); // Optional- take out or change if needed
    integrator.setOrientationLocked(false); // Scanning can be done in any orientation
    integrator.setBeepEnabled(false);
    integrator.initiateScan();
  }
예제 #9
0
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.scan:
       wrapInstallDialog(integrator.initiateScan(IntentIntegrator.QR_CODE_TYPES));
       break;
     case R.id.show:
       wrapInstallDialog(integrator.shareText(localFingerprint));
       break;
     case R.id.copy:
       ((ClipboardManager) getSystemService(CLIPBOARD_SERVICE))
           .setText(((TextView) findViewById(R.id.otr_local_fingerprint)).getText());
       break;
     default:
       break;
   }
 }
예제 #10
0
  private void scanBarcode() {

    // create the intent integrator to scan in the current fragment
    IntentIntegrator integrator = IntentIntegrator.forSupportFragment(this);

    // use a custom scanactivity that can be rotated
    integrator.setCaptureActivity(ScanActivity.class);
    integrator.setOrientationLocked(false);

    // limit scanning to only one-dimensional barcodes
    integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);

    // set the prompt message
    integrator.setPrompt(getString(R.string.scanner_prompt));

    // launch the scanner
    integrator.initiateScan();
  }
예제 #11
0
 private void getBarcodeScan() {
   IntentIntegrator integrator = new IntentIntegrator(this);
   integrator.initiateScan();
 }
예제 #12
0
 /**
  * Initiates a scan, only for a certain set of barcode types, given as strings corresponding to
  * their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants like
  * {@link #PRODUCT_CODE_TYPES} for example.
  *
  * @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
  */
 public final void initiateScan(Collection<String> desiredBarcodeFormats) {
   setDesiredBarcodeFormats(desiredBarcodeFormats);
   initiateScan();
 }
 public void onClick(View v) {
   IntentIntegrator integrator = new IntentIntegrator(self);
   integrator.initiateScan();
 }
 public void startQRScanner(String message) {
   qrScanStartTime = System.currentTimeMillis();
   IntentIntegrator integrator = new IntentIntegrator(this);
   integrator.setPrompt(message);
   integrator.initiateScan();
 }