use of com.google.zxing.integration.android.IntentResult in project zxing-android-embedded by journeyapps.
the class MainActivity method onActivityResult.
@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);
}
}
use of com.google.zxing.integration.android.IntentResult in project Conversations by siacs.
the class VerifyOTRActivity method onActivityResult.
@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);
}
use of com.google.zxing.integration.android.IntentResult in project cw-omnibus by commonsguy.
the class ZXingDemo method onActivityResult.
public void onActivityResult(int request, int result, Intent i) {
IntentResult scan = IntentIntegrator.parseActivityResult(request, result, i);
if (scan != null) {
format.setText(scan.getFormatName());
contents.setText(scan.getContents());
}
}
use of com.google.zxing.integration.android.IntentResult in project android-uploader by nightscout.
the class SettingsActivity method onActivityResult.
@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();
}
}
use of com.google.zxing.integration.android.IntentResult in project xabber-android by redsolution.
the class FingerprintViewer method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if (scanResult != null) {
String code = scanResult.getContents();
boolean equals = code != null && code.equals(remoteFingerprint);
verifiedView.setChecked(equals);
int dialogMessageId;
if (equals) {
dialogMessageId = R.string.action_otr_smp_verified;
} else {
dialogMessageId = R.string.action_otr_smp_unverified;
}
new AlertDialog.Builder(this).setMessage(dialogMessageId).setNeutralButton(android.R.string.ok, null).show();
}
}
Aggregations