本文整理汇总了Java中com.google.zxing.integration.android.IntentIntegrator.initiateScan方法的典型用法代码示例。如果您正苦于以下问题:Java IntentIntegrator.initiateScan方法的具体用法?Java IntentIntegrator.initiateScan怎么用?Java IntentIntegrator.initiateScan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.integration.android.IntentIntegrator
的用法示例。
在下文中一共展示了IntentIntegrator.initiateScan方法的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: 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);
}
}
示例3: 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();
}
示例4: 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.initiateScan();
//scanQrCode();
break;
default:
break;
}
return super.onOptionsItemSelected(item);
}
示例5: actionSearchQrcode
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
private void actionSearchQrcode() {
IntentIntegrator integrator = new IntentIntegrator(getActivity());
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
integrator.setOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
integrator.initiateScan();
// Intent intent = new Intent(getActivity(), FindByQrCode.class);
// intent.putExtra(FindByQrCode.SCAN_QR_CODE, true);
// startActivityForResult(intent, MainActivity.RESULT_SCAN);
}
示例6: onOptionsItemSelected
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
// Insert/Update Food.
if (id == R.id.action_save_food) {
saveFood();
} else if (id == R.id.action_scan_barcode) {
//Toast.makeText(getActivity(), "Functionality coming soon", Toast.LENGTH_SHORT).show();
IntentIntegrator integrator = new IntentIntegrator(getActivity());
integrator.initiateScan();
} else if (id == R.id.action_delete_food) {
onFoodDelete();
}
return super.onOptionsItemSelected(item);
}
示例7: scanCode
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void scanCode() {
try {
CameraManager manager = (CameraManager) getApplicationContext().getSystemService(Context.CAMERA_SERVICE);
String[] cameraIds = manager.getCameraIdList();
for (int i = 0; i < cameraIds.length; i++) {
CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraIds[i]);
if (characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK) {
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setCameraId(i);
integrator.initiateScan();
}
}
} catch (CameraAccessException e) {
}
}
示例8: 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);
if (scanResult != null) {
String text = getString(R.string.qr_result_init);
TextView textView = (TextView) findViewById(R.id.qr_result);
android.util.Log.d("----", scanResult.getContents());
if (IntentIntegrator.QR_CODE_TYPES.equals(scanResult.getFormatName())) {
textView.setText(String.format(text, scanResult.getContents()));
initLoader(scanResult.getContents());
} else {
Toast.makeText(this, R.string.bad_bar_code, Toast.LENGTH_SHORT).show();
IntentIntegrator.initiateScan(this);
}
}
}
示例9: onCreate
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.send);
IntentIntegrator ii = new IntentIntegrator(this);
ii.initiateScan();
// try {
// Intent intent = new Intent("com.google.zxing.client.android.SCAN");
// intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
// startActivityForResult(intent, 0);
//
// } catch (Exception e) {
//
// Uri marketUri = Uri
// .parse("market://details?id=com.google.zxing.client.android");
// Intent marketIntent = new Intent(Intent.ACTION_VIEW,
// marketUri);
// startActivity(marketIntent);
//
// }
}
示例10: onOptionsItemSelected
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean result = true;
switch (item.getItemId()) {
case R.id.accounts_management_add:
// use com.google.zxing.android-integration
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.initiateScan();
break;
case R.id.accounts_management_settings:
startActivity(new Intent(this, SettingsActivity.class));
break;
default:
result = super.onOptionsItemSelected(item);
break;
}
return result;
}
示例11: onOptionsItemSelected
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_ITEM_ADD:
// Launch activity to insert a new item
IntentIntegrator.initiateScan(this);
return true;
case MENU_ITEM_ADD_MANUALLY:
showDialog(DIALOG_ADD_MANUALLY);
return true;
case MENU_ITEM_DELETE_ALL:
// delete all
getContentResolver().delete(ResourceManager.Resources.CONTENT_URI,
"", new String[] {});
getContentResolver().delete(
ResourceManager.ResourceBindings.CONTENT_URI, "",
new String[] {});
return true;
}
return super.onOptionsItemSelected(item);
}
示例12: onOptionsItemSelected
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_about:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Oxtilo/BetaDroid-Server"));
startActivity(browserIntent);
return true;
case R.id.action_scan:
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.initiateScan();
return true;
case R.id.action_refresh:
startRefreshService();
return true;
}
return super.onOptionsItemSelected(item);
}
示例13: scan
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
/**
* Запуск сканера.
*/
private void scan() {
if (ACTION_MANUAL_BARCODE.equals(getIntent().getAction())
&& !barcodeNotified) {
barcodeNotified = true;
showDialog(DIALOG_MANUAL_BARCODE_ID);
return;
}
IntentIntegrator integrator = new IntentIntegrator(this);
AlertDialog alertDialog = integrator.initiateScan(SUPPORTED_CODE_TYPES);
if (alertDialog != null) {
alertDialog.dismiss();
if (!installNotified) {
installNotified = true;
showDialog(DIALOG_INSTALL_ID);
}
}
}
示例14: decodeUseCamera
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
private void decodeUseCamera() {
IntentIntegrator integrator = IntentIntegrator.forSupportFragment(this);
integrator.setBeepEnabled(true);
integrator.setBarcodeImageEnabled(true);
integrator.setOrientationLocked(true);
integrator.initiateScan();
}
示例15: scan
import com.google.zxing.integration.android.IntentIntegrator; //导入方法依赖的package包/类
/**
* 打开二维码
* <p>
* 参数:
* videoUrl:视频地址
*/
public static void scan(IQuickFragment webLoader, WebView wv, JSONObject param, Callback callback) {
Object fragment = webLoader.getPageControl().getFragment();
IntentIntegrator integrator = null;
if (fragment instanceof Fragment) {
integrator = IntentIntegrator.forFragment((Fragment) fragment);
} else if (fragment instanceof android.support.v4.app.Fragment) {
integrator = IntentIntegrator.forSupportFragment((android.support.v4.app.Fragment) fragment);
}
if (integrator != null) {
integrator.setCaptureActivity(ScanCaptureActivity.class);
integrator.initiateScan();
webLoader.getWebloaderControl().addPort(AutoCallbackDefined.OnScanCode, callback.getPort());
}
}