本文整理汇总了Java中com.google.zxing.integration.android.IntentIntegrator.parseActivityResult方法的典型用法代码示例。如果您正苦于以下问题:Java IntentIntegrator.parseActivityResult方法的具体用法?Java IntentIntegrator.parseActivityResult怎么用?Java IntentIntegrator.parseActivityResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.integration.android.IntentIntegrator
的用法示例。
在下文中一共展示了IntentIntegrator.parseActivityResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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 );
}
}
}
示例2: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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);
}
}
}
示例3: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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);
}
}
示例4: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
/**
* 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);
}
}
示例5: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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);
}
示例6: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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);
}
}
示例7: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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);
}
}
示例8: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
/**
* 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));
}
}
示例9: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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();
}
}
示例10: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
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);
}
}
示例11: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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());
}
}
}
}
示例12: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
/**
* 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();
}
示例13: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
/**
* 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);
}
示例14: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
/**
* 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);
}
}
}
}
示例15: onActivityResult
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@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);
}