com.google.zxing.integration.android.IntentResult Java Examples
The following examples show how to use
com.google.zxing.integration.android.IntentResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShareContactActivity.java From Travel-Mate with MIT License | 8 votes |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (result != null) { //if QRcode has nothing in it if (result.getContents() != null) { //if QRCode contains data //retrieve results String resultContents = result.getContents(); String[] values = resultContents.split(":"); String userName = values[0]; String userEmail = values[1]; addContact(userName, userEmail); } } }
Example #2
Source File: ImportWalletActivity.java From tron-wallet-android with Apache License 2.0 | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult result = IntentIntegrator.parseActivityResult(IntentIntegrator.REQUEST_CODE, resultCode, data); if(result != null) { if(result.getContents() != null) { switch (requestCode) { case ADDRESS_REQUEST_CODE: mPublicAddress_EditText.setText(result.getContents()); break; case PRIV_KEY_REQUEST_CODE: mPrivateKey_EditText.setText(result.getContents()); break; default: super.onActivityResult(requestCode, resultCode, data); } } } else { super.onActivityResult(requestCode, resultCode, data); } }
Example #3
Source File: ThirdPartyScannerActivity.java From SecScanQR with GNU General Public License v3.0 | 6 votes |
/** * 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); Intent intent = getIntent(); if(result != null){ if(result.getContents()==null){ setResult(RESULT_CANCELED, intent); finish(); return; } else { qrcode = result.getContents(); intent.putExtra("SCAN_RESULT", qrcode); setResult(RESULT_OK, intent); finish(); return; } } else { super.onActivityResult(requestCode, resultCode, data); } }
Example #4
Source File: KeyScanningActivity.java From Silence with GNU General Public License v3.0 | 6 votes |
@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(); } }
Example #5
Source File: MainActivity.java From PLDroidMediaStreaming with Apache License 2.0 | 6 votes |
@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()); } } } }
Example #6
Source File: SettingsActivity.java From ShoppingList with Apache License 2.0 | 6 votes |
public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult != null) { Gson gson = new Gson(); try { BackendSettings backendSettings = gson.fromJson(scanResult.getContents().toString(), BackendSettings.class); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences.Editor editor = prefs.edit(); editor.putString("host", backendSettings.getHost()); editor.putString("authkey", backendSettings.getAuth()); editor.putBoolean("useSSL", backendSettings.getSsl()); editor.commit(); Toast.makeText(getApplicationContext(),"Success!", Toast.LENGTH_SHORT).show(); refreshValues(); } catch (Exception e){ Toast.makeText(getApplicationContext(),"QR Code: Wrong data!", Toast.LENGTH_SHORT).show(); } } }
Example #7
Source File: MainActivity.java From quickhybrid-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
@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); } } }
Example #8
Source File: ActivityMain.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case requestCodePaymentCharge: case requestCodePaymentBill: getPaymentResultCode(resultCode, data); break; case requestCodeQrCode: IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data); if (result.getContents() != null) { new RequestUserVerifyNewDevice().verifyNewDevice(result.getContents()); } break; } }
Example #9
Source File: SignFragment.java From tron-wallet-android with Apache License 2.0 | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if(result != null) { if(result.getContents() != null) { try { Protocol.Transaction transaction = Protocol.Transaction.parseFrom(Hex.decode(result.getContents())); if(getContext() != null) { ConfirmTransactionActivity.start(getContext(), transaction); } } catch (InvalidProtocolBufferException | DecoderException ignored) { } } } else { super.onActivityResult(requestCode, resultCode, data); } }
Example #10
Source File: SignTransactionActivity.java From tron-wallet-android with Apache License 2.0 | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if(result != null) { if(result.getContents() != null) { byte[] transaction_bytes = null; try { transaction_bytes = Hex.decode(result.getContents()); } catch (Exception ignored) { } Intent intent = new Intent(); intent.putExtra(TRANSACTION_SIGNED_EXTRA, transaction_bytes); setResult(TRANSACTION_SIGN_REQUEST_CODE, intent); finish(); } } else { super.onActivityResult(requestCode, resultCode, data); } }
Example #11
Source File: MainActivity.java From a-sync-browser with Mozilla Public License 2.0 | 6 votes |
/** * 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)); } }
Example #12
Source File: ConversationListActivity.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case IntentIntegrator.REQUEST_CODE: IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); QrCodeHandler qrCodeHandler = new QrCodeHandler(this); qrCodeHandler.onScanPerformed(scanResult); break; case REQUEST_RELAY: if (resultCode == RESULT_OK) { handleResetRelaying(); setResult(RESULT_OK); finish(); } break; default: break; } }
Example #13
Source File: QrCodeHandler.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
public void onScanPerformed(IntentResult scanResult) { if (scanResult == null || scanResult.getFormatName() == null) { return; // aborted } handleOpenPgp4Fpr(scanResult.getContents()); }
Example #14
Source File: ShoppingListFragment.java From ShoppingList with Apache License 2.0 | 5 votes |
public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult != null) { Gson gson = new Gson(); try { String QRcode = scanResult.getContents().toString(); Toast.makeText(getActivity().getApplicationContext(), QRcode, Toast.LENGTH_SHORT).show(); addQRcodeItem(QRcode); } catch (Exception e){ Toast.makeText(getActivity().getApplicationContext(),"QR Code: Wrong data!", Toast.LENGTH_SHORT).show(); } } }
Example #15
Source File: BluetoothScan.java From xDrip-Experimental with GNU General Public License v3.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (scanResult == null || scanResult.getContents() == null) { return; } if (scanResult.getFormatName().equals("CODE_128")) { Log.d(TAG, "Setting serial number to: " + scanResult.getContents()); prefs.edit().putString("share_key", scanResult.getContents()).apply(); returnToHome(); } }
Example #16
Source File: MainActivity.java From moserp with Apache License 2.0 | 5 votes |
@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.getApplicationContext(), R.string.toast_scan_cancelled, Toast.LENGTH_LONG).show(); } else { Log.d("MainActivity", "Scanned: " + result.getContents()); startActivity(ProductListActivity.buildIntent(getApplicationContext(), result.getContents())); } } else { super.onActivityResult(requestCode, resultCode, data); } }
Example #17
Source File: WelcomeActivity.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode==IntentIntegrator.REQUEST_CODE) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (scanResult == null || scanResult.getFormatName() == null) { return; // aborted } String qrRaw = scanResult.getContents(); DcLot qrParsed = dcContext.checkQr(qrRaw); switch (qrParsed.getState()) { case DcContext.DC_QR_ACCOUNT: String domain = qrParsed.getText1(); new AlertDialog.Builder(this) .setMessage(getString(R.string.qraccount_ask_create_and_login, domain)) .setPositiveButton(R.string.ok, (dialog, which) -> startQrAccountCreation(qrRaw)) .setNegativeButton(R.string.cancel, null) .setCancelable(false) .show(); break; default: new AlertDialog.Builder(this) .setMessage(R.string.qraccount_qr_code_cannot_be_used) .setPositiveButton(R.string.ok, null) .show(); break; } } }
Example #18
Source File: IndexActivity.java From WeexOne with MIT License | 5 votes |
@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, "Cancelled", Toast.LENGTH_LONG).show(); } else { handleDecodeInternally(result.getContents()); } } else { super.onActivityResult(requestCode, resultCode, data); } }
Example #19
Source File: SubscriptionsActivity.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void onActivityResult(int requestCode, int resultCode, Intent intent) { try { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult == null) return; parseTokenOrUri(scanResult.getContents().trim()); } catch (PushjetException e) { Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show(); } catch (NullPointerException ignore) { } }
Example #20
Source File: MainActivity.java From SmartProxy with GNU General Public License v3.0 | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == START_VPN_SERVICE_REQUEST_CODE) { if (resultCode == RESULT_OK) { startVPNService(); } else { switchProxy.setChecked(false); switchProxy.setEnabled(true); onLogReceived("canceled."); } return; } IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult != null) { String configUrl = scanResult.getContents(); if (isValidUrl(configUrl)) { setConfigUrl(configUrl); textViewConfigUrl.setText(configUrl); } else { Toast.makeText(MainActivity.this, R.string.err_invalid_url, Toast.LENGTH_SHORT).show(); } return; } super.onActivityResult(requestCode, resultCode, intent); }
Example #21
Source File: AccountActivity.java From cnode-android with MIT License | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (result != null) { String token = result.getContents(); Log.d(TAG, "token: " + token); validate(token); return; } super.onActivityResult(requestCode, resultCode, data); }
Example #22
Source File: AddressBookActivity.java From bitseal with GNU General Public License v3.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { ((AddressBookRecordAdapter)mAddressBookListView.getAdapter()).notifyDataSetChanged(); // Get the result of the QR code scan IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (result != null) { String contents = result.getContents(); if (contents != null) { contents = contents.trim(); // Remove leading or trailing spaces Log.i(TAG, "Found QRcode with the following contents: " + contents); if (contents.substring(0, 3).equals(BITMESSAGE_ADDRESS_PREFIX)) { openNewEntryDialog(contents); } else { Toast.makeText(getApplicationContext(), R.string.addressBook_toast_qr_address_invalid, Toast.LENGTH_LONG).show(); openNewEntryDialog(""); } } else { Log.i(TAG, "No QRcode found"); openNewEntryDialog(""); } } }
Example #23
Source File: DeviceActivity.java From syncthing-android with Mozilla Public License 2.0 | 5 votes |
/** * 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) { mDevice.deviceID = scanResult.getContents(); mIdView.setText(mDevice.deviceID); } }
Example #24
Source File: DeploymentsActivity.java From OpenMapKitAndroid with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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("DeploymentsActivity", "Cancelled scan"); Toast.makeText(this, "Cancelled QR Code Scan", Toast.LENGTH_LONG).show(); } else { processQR(result.getContents()); } } else { // This is important, otherwise the result will not be passed to the fragment super.onActivityResult(requestCode, resultCode, data); } }
Example #25
Source File: InventoryFragment.java From pos with Eclipse Public License 1.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanningResult = IntentIntegrator.parseActivityResult( requestCode, resultCode, intent); if (scanningResult != null) { String scanContent = scanningResult.getContents(); searchBox.setText(scanContent); } else { Toast.makeText(getActivity().getBaseContext(), res.getString(R.string.fail), Toast.LENGTH_SHORT).show(); } }
Example #26
Source File: AddProductDialogFragment.java From pos with Eclipse Public License 1.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanningResult = IntentIntegrator.parseActivityResult( requestCode, resultCode, intent); if (scanningResult != null) { String scanContent = scanningResult.getContents(); barcodeBox.setText(scanContent); } else { Toast.makeText(getActivity().getBaseContext(), res.getString(R.string.fail), Toast.LENGTH_SHORT).show(); } }
Example #27
Source File: InventoryFragment.java From pos with Eclipse Public License 1.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanningResult = IntentIntegrator.parseActivityResult( requestCode, resultCode, intent); if (scanningResult != null) { String scanContent = scanningResult.getContents(); searchBox.setText(scanContent); } else { Toast.makeText(getActivity().getBaseContext(), res.getString(R.string.fail), Toast.LENGTH_SHORT).show(); } }
Example #28
Source File: AddProductDialogFragment.java From pos with Eclipse Public License 1.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanningResult = IntentIntegrator.parseActivityResult( requestCode, resultCode, intent); if (scanningResult != null) { String scanContent = scanningResult.getContents(); barcodeBox.setText(scanContent); } else { Toast.makeText(getActivity().getBaseContext(), res.getString(R.string.fail), Toast.LENGTH_SHORT).show(); } }
Example #29
Source File: MainActivity.java From shadowsocks-android-java with Apache License 2.0 | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == START_VPN_SERVICE_REQUEST_CODE) { if (resultCode == RESULT_OK) { startVPNService(); } else { switchProxy.setChecked(false); switchProxy.setEnabled(true); onLogReceived("canceled."); } return; } IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult != null) { String ProxyUrl = scanResult.getContents(); if (isValidUrl(ProxyUrl)) { setProxyUrl(ProxyUrl); textViewProxyUrl.setText(ProxyUrl); } else { Toast.makeText(MainActivity.this, R.string.err_invalid_url, Toast.LENGTH_SHORT).show(); } return; } super.onActivityResult(requestCode, resultCode, intent); }
Example #30
Source File: ScanActivity.java From HomeApplianceMall with MIT License | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // 获取解析结果 IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (result != null) { if (result.getContents() == null) { finish(); Toast.makeText(this, "取消扫描", Toast.LENGTH_LONG).show(); } else { String goodId = null; String[] res = result.getContents().split("#"); if(res!=null && res.length==3){ if(res[0].equals(KEY_1) && res[2].equals(KEY_2)){ goodId = res[1]; } } if(goodId!=null){ Intent intent = new Intent(ScanActivity.this,GoodDetailActivity.class); intent.putExtra("goodId",goodId); startActivity(intent); }else{ Toast.makeText(this, "请扫描本网站二维码!", Toast.LENGTH_LONG).show(); } finish(); } } else { super.onActivityResult(requestCode, resultCode, data); } }