本文整理汇总了Java中com.google.zxing.integration.android.IntentIntegrator类的典型用法代码示例。如果您正苦于以下问题:Java IntentIntegrator类的具体用法?Java IntentIntegrator怎么用?Java IntentIntegrator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntentIntegrator类属于com.google.zxing.integration.android包,在下文中一共展示了IntentIntegrator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_refresh:
createWeexInstance();
renderPage();
break;
case R.id.action_scan:
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
integrator.setPrompt("Scan a barcode");
//integrator.setCameraId(0); // Use a specific camera of the device
integrator.setBeepEnabled(true);
integrator.setOrientationLocked(false);
integrator.setBarcodeImageEnabled(true);
integrator.setPrompt(getString(R.string.capture_qrcode_prompt));
integrator.initiateScan();
break;
case android.R.id.home:
finish();
default:
break;
}
return super.onOptionsItemSelected(item);
}
示例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: onClick
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (textBack.equals(v)) {
finish();
} else if (textScan.equals(v)) {
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
integrator.setPrompt("Scan a barcode");
//integrator.setCameraId(0); // Use a specific camera of the device
integrator.setBeepEnabled(true);
integrator.setOrientationLocked(false);
integrator.setBarcodeImageEnabled(true);
integrator.setPrompt("请将条码置于取景框内扫描");
integrator.initiateScan();
} else if (btnSave.equals(v)) {
save();
} else if (btnReset.equals(v)) {
save();
AppExitUtil.restart(this);
} else if (btnOpen.equals(v)) {
String page = editOpen.getText().toString().trim();
UWXJumpUtil.openPage(this, page);
}
}
示例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
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 );
}
}
}
示例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) {
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);
}
}
示例7: handleIntent
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
protected boolean handleIntent(Intent intent) {
if (intent != null && intent.getAction().equals(ACTION_VERIFY_CONTACT)) {
this.mAccount = extractAccount(intent);
if (this.mAccount == null) {
return false;
}
try {
this.mConversation = this.xmppConnectionService.find(this.mAccount,Jid.fromString(intent.getExtras().getString("contact")));
if (this.mConversation == null) {
return false;
}
} catch (final InvalidJidException ignored) {
return false;
}
this.mode = intent.getIntExtra("mode", MODE_MANUAL_VERIFICATION);
if (this.mode == MODE_SCAN_FINGERPRINT) {
new IntentIntegrator(this).initiateScan();
return false;
}
return true;
} else {
return false;
}
}
示例8: 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);
}
示例9: onOptionsItemSelected
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_create_contact:
showCreateContactDialog(null, null);
return true;
case R.id.action_join_conference:
showJoinConferenceDialog(null);
return true;
case R.id.action_create_conference:
showCreateConferenceDialog();
return true;
case R.id.action_scan_qr_code:
new IntentIntegrator(this).initiateScan(Arrays.asList("AZTEC","QR_CODE"));
return true;
case R.id.action_hide_offline:
mHideOfflineContacts = !item.isChecked();
getPreferences().edit().putBoolean("hide_offline", mHideOfflineContacts).commit();
if (mSearchEditText != null) {
filter(mSearchEditText.getText().toString());
}
invalidateOptionsMenu();
}
return super.onOptionsItemSelected(item);
}
示例10: onClick
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.fragment_send_dialog_send:
sendCoins();
break;
case R.id.fragment_send_dialog_cancel:
getDialog().cancel();
break;
case R.id.fragment_send_dialog_qr_scan:
IntentIntegrator.forFragment(SendDialogFragment.this).initiateScan();
break;
case R.id.fragment_send_dialog_address:
openAddressList();
break;
}
}
示例11: callScanner
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
/**
* Inicia el lector de barras.
* Devuelve el resultado por {@link #onActivityResult(int, int, Intent)}.
*/
private void callScanner() {
IntentIntegrator integrator = IntentIntegrator.forSupportFragment(this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
integrator.setPrompt(getString(R.string.balance_align_barcode));
integrator.setBeepEnabled(false);
integrator.setBarcodeImageEnabled(true);
integrator.initiateScan();
}
示例12: onCreate
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final SettingsFragment that = this;
/* set preferences */
addPreferencesFromResource(R.xml.preferences);
// iterate through all preferences and update to saved value
for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) {
initSummary(getPreferenceScreen().getPreference(i));
}
setMinBatPollIntervall((ListPreference) findPreference("pollInterval"), (ListPreference) findPreference("lowBatPollInterval"));
Preference button = findPreference("scanButton");
button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
IntentIntegrator integrator = new IntentIntegrator(that);
integrator.initiateScan();
return true;
}
});
}
示例13: onRequestPermissionsResult
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_CAMERA: {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
new IntentIntegrator(activity).initiateScan();
} else {
toast("Without camera permission we cannot scan a barcode");
}
return;
}
}
}
示例14: scan
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
public void scan() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(activity.getApplicationContext(),
Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(activity,
new String[]{Manifest.permission.CAMERA},
MY_PERMISSIONS_REQUEST_CAMERA);
} else {
new IntentIntegrator(activity).initiateScan();
}
} else {
new IntentIntegrator(activity).initiateScan();
}
}
示例15: onOptionsItemSelected
import com.google.zxing.integration.android.IntentIntegrator; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_create_contact:
showCreateContactDialog(null,null);
return true;
case R.id.action_join_conference:
showJoinConferenceDialog(null);
return true;
case R.id.action_scan_qr_code:
new IntentIntegrator(this).initiateScan();
return true;
case R.id.action_hide_offline:
mHideOfflineContacts = !item.isChecked();
getPreferences().edit().putBoolean("hide_offline", mHideOfflineContacts).commit();
if (mSearchEditText != null) {
filter(mSearchEditText.getText().toString());
}
invalidateOptionsMenu();
return true;
}
return super.onOptionsItemSelected(item);
}