Java 类com.google.zxing.integration.android.IntentResult 实例源码

项目:quickhybrid-android    文件:MainActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {

        if (requestCode == IntentIntegrator.REQUEST_CODE) {
            // 扫描二维码回传值
            IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
            String ewmString = result.getContents();

            Intent mintent = new Intent(MainActivity.this, QuickWebLoader.class);
            QuickBean bean = new QuickBean(ewmString);
            mintent.putExtra("bean", bean);
            startActivity(mintent);
        }
    }
}
项目:SecScanQR    文件:MainActivity.java   
/**
 * This method handles the results of the scan
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if(result != null){
        if(result.getContents()==null){
            Toast.makeText(this, getResources().getText(R.string.error_canceled_scan), Toast.LENGTH_LONG).show();
        } else {
            qrcode = result.getContents();
            if(!qrcode.equals("")){
                mTextMessage.setText(qrcode);
                action_navigation.setVisibility(View.VISIBLE);
                addToDatabase(mTextMessage.getText().toString());
                //Automatic Clipboard if activated
                SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
                String auto_scan = prefs.getString("pref_auto_clipboard", "");
                if(auto_scan.equals("true")){
                    copyToClipboard(mTextMessage, qrcode, activity);
                }
            }

        }
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
项目:SIIEScanner    文件:BaseActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult result = IntentIntegrator.parseActivityResult( requestCode, resultCode, data);
    if (result != null) {

        if ( result.getContents() == null) {
            this.scan = null;
            long newInstance = Calendar.getInstance().getTimeInMillis();
            if ( newInstance - this.startScannerTime < 1000 * this.timeOutSecond ) {
                this.onCanceled();
            } else {
                this.onTimeOut();
            }
        } else {
            this.scan = new Scan( result.getContents() );
            ScanDao scanDao = new ScanDao( this );
            scanDao.register( this.scan);
            this.onScanReaderResult( this.scan );
        }
    }
}
项目:leoapp-sources    文件:EssensbonActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if(result != null) {
        if(result.getContents() != null) {
            QRReadTask task = new QRReadTask();
            task.execute(result.getContents());
            if (EssensbonUtils.isAutoFadeEnabled()) {
                final Handler handler = new Handler();
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        integrator.initiateScan();
                    }
                }, EssensbonUtils.getFadeTime()*1000);
            }
        }
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
项目:TenguChat    文件:VerifyOTRActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            XmppUri uri = new XmppUri(data);
            if (xmppConnectionServiceBound) {
                verifyWithUri(uri);
                finish();
            } else {
                this.mPendingUri = uri;
            }
        } else {
            finish();
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:messengerxmpp    文件:VerifyOTRActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            XmppUri uri = new XmppUri(data);
            if (xmppConnectionServiceBound) {
                verifyWithUri(uri);
                finish();
            } else {
                this.mPendingUri = uri;
            }
        } else {
            finish();
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:messengerxmpp    文件:StartConversationActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            Invite invite = new Invite(data);
            if (xmppConnectionServiceBound) {
                invite.invite();
            } else if (invite.getJid() != null) {
                this.mPendingInvite = invite;
            } else {
                this.mPendingInvite = null;
            }
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:a-sync-browser    文件:MainActivity.java   
/**
 * Receives value of scanned QR code and sets it as device ID.
 */
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (scanResult != null) {
        String deviceId = scanResult.getContents();
        if (!isBlank(deviceId)) {
            Log.i("Main", "qrcode text = " + deviceId);
            importDeviceId(deviceId);
            return;
        }
    }

    if (resultCode == Activity.RESULT_OK) {
        Uri fileUri = intent.getData();
        doUpload(indexBrowser.getFolder(), indexBrowser.getCurrentPath(), Arrays.asList(fileUri));
    }
}
项目:TextSecure    文件:KeyScanningActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

  if ((scanResult != null) && (scanResult.getContents() != null)) {
    String data = scanResult.getContents();

    if (data.equals(Base64.encodeBytes(getIdentityKeyToCompare().serialize()))) {
      Dialogs.showInfoDialog(this, getVerifiedTitle(), getVerifiedMessage());
    } else {
      Dialogs.showAlertDialog(this, getNotVerifiedTitle(), getNotVerifiedMessage());
    }
  } else {
    Toast.makeText(this, R.string.KeyScanningActivity_no_scanned_key_found_exclamation,
                   Toast.LENGTH_LONG).show();
  }
}
项目:Cardstore    文件:EditCardActivity.java   
public void onActivityResult(int requestCode, int resultCode, Intent intent) {

        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        String scanResultRaw = scanResult.toString();
        String splitData[] = scanResultRaw.split("\\r\\n|\\n|\\r");
        if (splitData[0].substring(8).equals("null")) {

            //Display error as a toast
            Toast.makeText(getApplicationContext(), "Barcode not found.", Toast.LENGTH_SHORT).show();
            //Disable confirm button
            confirmButton.setText("Scan to continue");
            confirmButton.setEnabled(false);

        } else {
            extraInfo.setText(scanResultRaw);
        }
    }
项目:OculusMobileSDKHeadTrackingXWalkViewExtension    文件:OculusMobileSDKHeadTrackingURLEntryActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) 
{
  IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
  if (scanResult != null && scanResult.getContents() != null) 
  {
    String url = scanResult.getContents();
    try
    {
        new URL(url);
        urlEditText.setText(url);
    }
    catch(MalformedURLException e)
    {
        AlertDialog alertDialog = createAlertDialog(this, "Not an URL", "The read QRCode does not represent a valid URL.", null, 1, "Ok", null, null);
        alertDialog.show();
    }
  }
}
项目:Android-Snippets    文件:MainActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if(result != null) {
        if(result.getContents() == null) {
            Log.d("MainActivity", "Cancelled scan");
            Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
        } else {
            Log.d("MainActivity", "Scanned");
            Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
        }
    } else {

        // This is important, otherwise the result will not be passed to the fragment
        super.onActivityResult(requestCode, resultCode, data);
    }
}
项目:Android-Snippets    文件:MainActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if(intentResult!= null){
        if(intentResult.getContents()==null){

            Toast.makeText(this,"Scanning Stopped", Toast.LENGTH_LONG).show();

        }else
        {
            Toast.makeText(this, intentResult.getContents(), Toast.LENGTH_SHORT).show();
        }
    }else
    {
        super.onActivityResult(requestCode, resultCode, data);
    }

}
项目:bus-torino    文件:ActivityMain.java   
/**
 * Receive the Barcode Scanner Intent
 *
 */
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

    Uri uri;
    try {
        uri = Uri.parse(scanResult != null ? scanResult.getContents() : null); // this apparently prevents NullPointerException. Somehow.
    } catch (NullPointerException e) {
        Toast.makeText(getApplicationContext(),
                R.string.no_qrcode, Toast.LENGTH_SHORT).show();
        return;
    }

    String busStopID = getBusStopIDFromUri(uri);
    busStopSearchByIDEditText.setText(busStopID);
    new asyncWgetBusStopFromBusStopID(busStopID, ArrivalFetchersRecursionHelper, lastSuccessfullySearchedBusStop);
}
项目:MDX-Exam-Software-Android    文件:TestSelectionActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == IntentIntegrator.REQUEST_CODE) {
        if (resultCode == RESULT_OK) {

            IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
            Toast.makeText(this, result.getContents(), Toast.LENGTH_SHORT).show();
            String[] parsedTuringData = result.getContents().split(":");
            new TestRequestTask().execute(parsedTuringData);

        } else if (resultCode == RESULT_CANCELED) {

            Toast.makeText(this, "QR Scanning cancelled", Toast.LENGTH_SHORT).show();

        }
    }
}
项目:TextSecureSMP    文件:KeyScanningActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

  if ((scanResult != null) && (scanResult.getContents() != null)) {
    String data = scanResult.getContents();

    if (data.equals(Base64.encodeBytes(getIdentityKeyToCompare().serialize()))) {
      Dialogs.showInfoDialog(this, getVerifiedTitle(), getVerifiedMessage());
    } else {
      Dialogs.showAlertDialog(this, getNotVerifiedTitle(), getNotVerifiedMessage());
    }
  } else {
    Toast.makeText(this, R.string.KeyScanningActivity_no_scanned_key_found_exclamation,
                   Toast.LENGTH_LONG).show();
  }
}
项目:Pix-Art-Messenger    文件:VerifyOTRActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            XmppUri uri = new XmppUri(data);
            if (xmppConnectionServiceBound) {
                verifyWithUri(uri);
                finish();
            } else {
                this.mPendingUri = uri;
            }
        } else {
            finish();
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:Silence    文件:KeyScanningActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

  if ((scanResult != null) && (scanResult.getContents() != null)) {
    String data = scanResult.getContents();

    if (data.equals(Base64.encodeBytes(getIdentityKeyToCompare().serialize()))) {
      Dialogs.showInfoDialog(this, getVerifiedTitle(), getVerifiedMessage());
    } else {
      Dialogs.showAlertDialog(this, getNotVerifiedTitle(), getNotVerifiedMessage());
    }
  } else {
    Toast.makeText(this, R.string.KeyScanningActivity_no_scanned_key_found_exclamation,
                   Toast.LENGTH_LONG).show();
  }
}
项目:EnigmAndroid    文件:MainActivity.java   
/**
 * Handle Activity Results
 * @param requestCode requestCode
 * @param resultCode resultCode (RESULT_SETTINGS is defined at the top)
 * @param data data
 */
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
        //Come back from Settings
        case RESULT_SETTINGS:
        {
            applyPreferenceChanges();
            break;
        }
        // Receive from QR
        case IntentIntegrator.REQUEST_CODE:
            IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
            if (scanResult != null) {
                String content = scanResult.getContents();
                if(content == null) Log.e(APP_ID, "Error! Received nothing from QR-Code!");
                else {
                    Log.d(APP_ID, "Received " + content + " from QR-Code!");
                    restoreStateFromCode(content);
                }
            }
    }
}
项目:PaperOrPlastic    文件:ItemSearchActivity.java   
public void onActivityResult (int requestCode, int resultCode, Intent intent)
{
    IntentResult scanningResult = IntentIntegrator.parseActivityResult (requestCode, resultCode, intent);

    if (scanningResult != null)
    {
        String scanContent = scanningResult.getContents ();
        String scanFormat = scanningResult.getFormatName ();

        formatText.setText ("FORMAT: " + scanFormat);
        contentText.setText ("CONTENT: " + scanContent);
    }
    else
    {
        Toast toast = Toast.makeText (getApplicationContext (), "No scan data received!",
                Toast.LENGTH_SHORT);
        toast.show();
    }
}
项目:wyliodrin-sensors-android    文件:MainActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (scanResult != null && resultCode == Activity.RESULT_OK) {
        String token = scanResult.getContents();
        if (token.contains("wyliodrin:gadget:")) {
            token = token.replace("wyliodrin:gadget://", "");

            wylioBoard = new WylioBoard(token);

            SharedPreferences.Editor prefs = PreferenceManager.getDefaultSharedPreferences(this).edit();
            prefs.putString("wylio board token", token);
            prefs.commit();

            // Button sendBtn = (Button) findViewById(R.id.send_button);
            // sendBtn.setText("Send");
        } else {
            Toast.makeText(this, token.length(), Toast.LENGTH_LONG).show();
        }
    }

}
项目:Bozon.kg_App    文件:Main_screen.java   
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

    if (scanningResult != null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(Main_screen.this);
        String scanContent = scanningResult.getContents();
        String scanFormat = scanningResult.getFormatName();

        builder.setTitle("Инфо о продукте.")
                .setMessage("FORMAT: " + scanFormat + "\n" + "CONTENT: " + scanContent)
                .setPositiveButton("ОК", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });
        builder.show();

    } else {
        Toast toast = Toast.makeText(getApplicationContext(),
                "No scan data received!", Toast.LENGTH_SHORT);
        toast.show();

    }


}
项目:PLDroidMediaStreaming    文件:MainActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;
    }
    if (requestCode ==  IntentIntegrator.REQUEST_CODE) {
        IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
        if(result != null) {
            if(result.getContents() == null) {
                Toast.makeText(this, "扫码取消!", Toast.LENGTH_SHORT).show();
            } else {
                mInputTextTV.setText(result.getContents());
            }
        }
    }
}
项目:f-droid    文件:WifiQrFragment.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (scanResult != null) {
        if (scanResult.getContents() != null) {
            NewRepoConfig repoConfig = new NewRepoConfig(getActivity(), scanResult.getContents());
            if (repoConfig.isValidRepo()) {
                startActivityForResult(new Intent(FDroid.ACTION_ADD_REPO, Uri.parse(scanResult.getContents()), getActivity(), ConnectSwapActivity.class), CONNECT_TO_SWAP);
            } else {
                Toast.makeText(getActivity(), "The QR code you scanned doesn't look like a swap code.", Toast.LENGTH_SHORT).show();
            }
        }
    } else if (requestCode == CONNECT_TO_SWAP && resultCode == Activity.RESULT_OK) {
        getActivity().finish();
    }
}
项目:TimberdoodleApp    文件:ScanFriendKeyFragment.java   
/**
 * Gets called when the QR code was read is provided by zxing
 */
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    // Cancel if activity result is not a QR code scan result
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (result == null) {
        super.onActivityResult(requestCode, resultCode, intent);
        return;
    }

    // User cancelled QR code scanning?
    if (result.getContents() == null) {
        Toast.makeText(getActivity(), R.string.canceled_toast, Toast.LENGTH_LONG).show();
        return;
    }

    qrData = result.getContents();
    tryHandleQRData();
}
项目:TimberdoodleApp    文件:ScanGroupKeyFragment.java   
/**
 * Gets called when the QR code was read is provided by zxing
 */
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    // Cancel if activity result is not a QR code scan result
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (result == null) {
        super.onActivityResult(requestCode, resultCode, intent);
        return;
    }

    // User cancelled QR code scanning?
    if (result.getContents() == null) {
        Toast.makeText(getActivity(), R.string.canceled_toast, Toast.LENGTH_LONG).show();
        return;
    }

    qrData = result.getContents();
    tryHandleQRData();
}
项目:FlippyPairs    文件:JoinGameActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    final IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (scanResult != null) {
        new AsyncTask<Void, Void, HostInfo>() {

            @Override
            protected HostInfo doInBackground(Void... params) {
                return qrCodeUtils.readHostInfo(scanResult.getContents());
            }

            @Override
            protected void onPostExecute(HostInfo hostInfo) {
                if (hostInfo != null) connectToHost(hostInfo);
                else Toast.makeText(JoinGameActivity.this, getString(R.string.join_game_help_client_error), Toast.LENGTH_LONG).show();
            }

        }.execute(null, null);
        Timber.d(scanResult.getContents());
    }
}
项目:Conversations    文件:VerifyOTRActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            XmppUri uri = new XmppUri(data);
            if (xmppConnectionServiceBound) {
                verifyWithUri(uri);
                finish();
            } else {
                this.mPendingUri = uri;
            }
        } else {
            finish();
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:android-uploader    文件:SettingsActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    NightscoutPreferences prefs = new AndroidPreferences(this);
    if (scanResult != null && scanResult.getContents() != null) {
        NSBarcodeConfig barcode = new NSBarcodeConfig(scanResult.getContents());
        if (barcode.hasMongoConfig()) {
            prefs.setMongoUploadEnabled(true);
            if (barcode.getMongoUri().isPresent()) {
                prefs.setMongoClientUri(barcode.getMongoUri().get());
                prefs.setMongoCollection(barcode.getMongoCollection().orNull());
                prefs.setMongoDeviceStatusCollection(
                        barcode.getMongoDeviceStatusCollection().orNull());
            }
        } else {
            prefs.setMongoUploadEnabled(false);
        }
        if (barcode.hasApiConfig()) {
            prefs.setRestApiEnabled(true);
            prefs.setRestApiBaseUris(barcode.getApiUris());
        } else {
            prefs.setRestApiEnabled(false);
        }
        refreshFragments();
    }
}
项目:Simplicissimus    文件:Sample.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    switch (requestCode & 0xFFFF) {
        case IntentIntegrator.REQUEST_CODE: {
            IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
            if (scanResult != null && scanResult.getFormatName() != null) {
                String data = scanResult.getContents();
                Log.d(TAG, "data: " + data);
                scan.setText(data);
            }
            break;
        }
        default: {
            super.onActivityResult(requestCode, resultCode, intent);
            break;
        }
    }
}
项目:Ampath-QR-code-scanner    文件:MainActivity.java   
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    //retrieve scan result

    IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (scanningResult != null) {
        //we have a result
        String scanContent = scanningResult.getContents();
        String scanFormat = scanningResult.getFormatName();
        formatTxt.setText("FORMAT: " + scanFormat);
        contentTxt.setText("CONTENT: " + scanContent);
    }
    else{
        Toast toast = Toast.makeText(getApplicationContext(),
                "No scan data received!", Toast.LENGTH_SHORT);
        toast.show();
    }

}
项目:QR-Code-Auth-Android-client    文件:MainActivity.java   
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (scanResult != null) {
        String text = getString(R.string.qr_result_init);
        TextView textView = (TextView) findViewById(R.id.qr_result);

        android.util.Log.d("----", scanResult.getContents());

        if (IntentIntegrator.QR_CODE_TYPES.equals(scanResult.getFormatName())) {
            textView.setText(String.format(text, scanResult.getContents()));

            initLoader(scanResult.getContents());

        } else {
            Toast.makeText(this, R.string.bad_bar_code, Toast.LENGTH_SHORT).show();
            IntentIntegrator.initiateScan(this);
        }

    }
}
项目:SMPT42    文件:MainActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode != 0) {
        IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
        Intent scanResultIntent = new Intent(this, ScanResultActivity.class);
        String contents = scanningResult.getContents();
        if (contents != null) {
            new UpdateScanDate().execute(contents);
            scanResultIntent.putExtra("barcode", contents);
            scanResultIntent.putExtra("fromScanner", true);
            startActivityForResult(scanResultIntent, 0);
        }
    } else if (resultCode != RESULT_NOT_FOUND) {
        scanIntegrator.initiateScan();
    }
}
项目:EasyToken    文件:ImportActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if (requestCode == REQ_SCAN_QR) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getContents() != null) {
            tryImport(scanResult.getContents());
        }
    } else if (requestCode == REQ_PICK_FILE) {
        if (resultCode == Activity.RESULT_OK) {
            String path = intent.getStringExtra(FileSelect.RESULT_DATA);
            tryImport(Uri.fromFile(new File(path)).toString());
        }
    }
}
项目:frozenchat    文件:VerifyOTRActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            XmppUri uri = new XmppUri(data);
            if (xmppConnectionServiceBound) {
                verifyWithUri(uri);
                finish();
            } else {
                this.mPendingUri = uri;
            }
        } else {
            finish();
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:frozenchat    文件:StartConversationActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            Invite invite = new Invite(data);
            if (xmppConnectionServiceBound) {
                invite.invite();
            } else if (invite.getJid() != null) {
                this.mPendingInvite = invite;
            } else {
                this.mPendingInvite = null;
            }
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:biblio    文件:BiblioActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    Log.d(TAG, "onActivityResult - requestCode[" + requestCode + "] resultCode[" + resultCode + "] intent[" + intent + "].");
    Log.d(TAG, "intent [" + (intent != null ? intent.getDataString() : "empty") + "].");

    IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (scanResult != null) {
        String contents = scanResult.getContents();
        String format = scanResult.getFormatName();
        Log.d(TAG, "Result. content [" + contents + "] format [" + format + "].");

        final Intent bookInfoIntent = new Intent(this, BookInfoActivity.class);
        bookInfoIntent.putExtra("link", sharedPreferences.getString("link", null));
        bookInfoIntent.putExtra("format", format);
        bookInfoIntent.putExtra("code", contents);
        startActivity(bookInfoIntent);

    } else {
        // Handle cancel
        Log.e(TAG, "Scan was cancelled");
        Toast toast = Toast.makeText(this, "Scan was Cancelled!", Toast.LENGTH_LONG);
        toast.setGravity(Gravity.TOP, 25, 400);
        toast.show();
    }
}
项目:txtr    文件:VerifyOTRActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            XmppUri uri = new XmppUri(data);
            if (xmppConnectionServiceBound) {
                verifyWithUri(uri);
                finish();
            } else {
                this.mPendingUri = uri;
            }
        } else {
            finish();
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:txtr    文件:StartConversationActivity.java   
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
        IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanResult != null && scanResult.getFormatName() != null) {
            String data = scanResult.getContents();
            Invite invite = new Invite(data);
            if (xmppConnectionServiceBound) {
                invite.invite();
            } else if (invite.getJid() != null) {
                this.mPendingInvite = invite;
            } else {
                this.mPendingInvite = null;
            }
        }
    }
    super.onActivityResult(requestCode, requestCode, intent);
}
项目:yasme-android    文件:ContactActivity.java   
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    try {
        IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
        if (scanningResult != null) {
            String scanContent = scanningResult.getContents();
            QRData qrData = new ObjectMapper().readValue(scanContent, QRData.class);
            Log.d(getClass().getSimpleName(), "DeviceId: " + qrData.getDeviceId());
            //SearchUserTask searchUserTask = new SearchUserTask(SearchUserTask.SearchBy.ID,String.valueOf(qrData.getUserId()), QRCodeFragment.class);
            GetQRDataTask getQRDataTask = new GetQRDataTask(qrData);
            toast(R.string.please_wait,Toast.LENGTH_LONG);
            getQRDataTask.execute();
        }
    } catch (Exception e) {
        //e.printStackTrace();
        //Log.d(getClass().getSimpleName(), "Not valid");
        toast(R.string.qr_not_valid,Toast.LENGTH_LONG);
    }
}