当前位置: 首页>>代码示例>>Java>>正文


Java IntentIntegrator.parseActivityResult方法代码示例

本文整理汇总了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 );
        }
    }
}
 
开发者ID:tec-ustp,项目名称:SIIEScanner,代码行数:22,代码来源:BaseActivity.java

示例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);
        }
    }
}
 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:17,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:22,代码来源:EssensbonActivity.java

示例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);
    }
}
 
开发者ID:Fr4gorSoftware,项目名称:SecScanQR,代码行数:29,代码来源:MainActivity.java

示例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);
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:20,代码来源:VerifyOTRActivity.java

示例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);
    }
}
 
开发者ID:NikhilBhutani,项目名称:Android-Snippets,代码行数:18,代码来源:MainActivity.java

示例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);
    }

}
 
开发者ID:NikhilBhutani,项目名称:Android-Snippets,代码行数:20,代码来源:MainActivity.java

示例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));
    }
}
 
开发者ID:davide-imbriaco,项目名称:a-sync-browser,代码行数:21,代码来源:MainActivity.java

示例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();
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:18,代码来源:KeyScanningActivity.java

示例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);
        }
    }
 
开发者ID:SpeedyFireCyclone,项目名称:Cardstore,代码行数:18,代码来源:EditCardActivity.java

示例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());
            }
        }
    }
}
 
开发者ID:pili-engineering,项目名称:PLDroidMediaStreaming,代码行数:17,代码来源:MainActivity.java

示例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();
}
 
开发者ID:timberdoodle,项目名称:TimberdoodleApp,代码行数:21,代码来源:ScanFriendKeyFragment.java

示例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);
}
 
开发者ID:valerio-bozzolan,项目名称:bus-torino,代码行数:21,代码来源:ActivityMain.java

示例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);
				}
			}
	}
}
 
开发者ID:vanitasvitae,项目名称:EnigmAndroid,代码行数:29,代码来源:MainActivity.java

示例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);
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:20,代码来源:VerifyOTRActivity.java


注:本文中的com.google.zxing.integration.android.IntentIntegrator.parseActivityResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。