本文整理汇总了Java中me.dm7.barcodescanner.zxing.ZXingScannerView类的典型用法代码示例。如果您正苦于以下问题:Java ZXingScannerView类的具体用法?Java ZXingScannerView怎么用?Java ZXingScannerView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ZXingScannerView类属于me.dm7.barcodescanner.zxing包,在下文中一共展示了ZXingScannerView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LerCodigoBarrasActivityBinding binding =
DataBindingUtil.setContentView(this, R.layout.ler_codigo_barras_activity);
binding.setLerCodigoBarrasVM(new LerCodigoBarrasViewModel(this));
mScannerView = new ZXingScannerView(this) {
@Override
protected IViewFinder createViewFinderView(Context context) {
return new BarCodeReaderView(context, getWindowManager().getDefaultDisplay());
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
};
mScannerView.setFormats(getSupportedFormats());
((ViewGroup) findViewById(R.id.content_frame)).addView(mScannerView);
Toolbar toolbar = binding.toolbar;
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
示例2: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qr_code);
contentFrame = (ViewGroup) findViewById(R.id.content_frame);
mScannerView = new ZXingScannerView(this);
mScannerView.setResultHandler(this);
if (isCameraAccessAllowed()) {
contentFrame.addView(mScannerView);
} else {
requestStoragePermission();
}
mImageView = (ImageView) findViewById(R.id.qr_code_id);
String data;
if (getIntent().getExtras() != null) {
data = getIntent().getExtras().getString(EXTRA_DATA);
} else {
data = "Udhari";
}
mImageView.setImageBitmap(endcode(data));
}
示例3: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_item);
setupToolbar();
scannerFrame = (ViewGroup) findViewById(R.id.scanner_frame);
toManualButton = (Button) findViewById(R.id.manual_entry);
scannerView = new ZXingScannerView(this) {
@Override
protected IViewFinder createViewFinderView(Context context) {
return new ViewFinderView(context);
}
};
scannerFrame.addView(scannerView);
toManualButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(view.getContext(), ItemDetailsActivity.class));
}
});
}
示例4: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
setBackButton(true);
setTitle(getResources().getString(R.string.qr_code_activity_name));
verifyCameraPermissions(this);
Intent intent = getIntent();
id = intent.getIntExtra("id", -1);
mScannerView = new ZXingScannerView(this); // Programmatically initialize the scanner view
setContentView(mScannerView); // Set the scanner view as the content view
progressDialog = new ProgressDialog(this);
tinyDB = new TinyDB(getApplicationContext());
}
示例5: onCreateView
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) {
final SharedPreferences settings = getActivity().getSharedPreferences("camera", 0);
mScannerView = new ZXingScannerView(getActivity());
api = new OpenFoodAPIClient(getActivity());
if(state != null) {
mRing = state.getBoolean(RING_STATE, false);
mFlash = state.getBoolean(FLASH_STATE, false);
mAutoFocus = state.getBoolean(AUTO_FOCUS_STATE, true);
mCameraId = state.getInt(CAMERA_ID, -1);
} else {
mRing = settings.getBoolean("ring", false);
mFlash = settings.getBoolean("flash", false);
mAutoFocus = settings.getBoolean("focus", true);
mCameraId = -1;
}
setupFormats();
return mScannerView;
}
示例6: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scan_text_screen);
Assent.setActivity(this, this);
mScannerView = new ZXingScannerView(this);
List<BarcodeFormat> formats = Collections.singletonList(BarcodeFormat.QR_CODE);
mScannerView.setFormats(formats);
mScannerView.setAspectTolerance(0.5f);
ViewGroup contentFrame = findViewById(R.id.content);
contentFrame.addView(mScannerView);
setupToolbar(true, false);
setTitle(getIntent().getStringExtra("title"));
}
示例7: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_escaner);
escanerView = new ZXingScannerView(this);
setContentView(escanerView);
escanerView.setResultHandler(this);
escanerView.startCamera();
}
开发者ID:EdwardAlexis,项目名称:Sistema-de-Comercializacion-Negocios-Jhordan,代码行数:10,代码来源:ActivityEscaner.java
示例8: initQRScan
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
public void initQRScan(FrameLayout frame) {
mScannerView = new ZXingScannerView(this);
frame.addView(mScannerView);
mScannerView.setResultHandler(this);
ArrayList<BarcodeFormat> supported = new ArrayList<BarcodeFormat>();
supported.add(BarcodeFormat.QR_CODE);
mScannerView.setFormats(supported);
mScannerView.startCamera();
}
示例9: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
public void onCreate(Bundle state) {
super.onCreate(state);
MobclickAgent.onEvent(this.ctx, Event.tool_searchfood_scan);
setContentView(R.layout.ct);
ButterKnife.inject((Activity) this);
this.mScannerView = new ZXingScannerView(this) {
protected IViewFinder createViewFinderView(Context context) {
return new CustomViewFinderView(context);
}
};
this.flScanner.addView(this.mScannerView, new LayoutParams(-1, -1));
}
示例10: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
checkProvider = new OnlineCheckProvider(this);
config = new AppConfig(this);
setContentView(R.layout.activity_main);
qrView = (ZXingScannerView) findViewById(R.id.qrdecoderview);
qrView.setResultHandler(this);
qrView.setAutoFocus(config.getAutofocus());
qrView.setFlash(config.getFlashlight());
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.CAMERA},
PERMISSIONS_REQUEST_CAMERA);
}
List<BarcodeFormat> formats = new ArrayList<>();
formats.add(BarcodeFormat.QR_CODE);
qrView.setFormats(formats);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = buildMediaPlayer(this);
timeoutHandler = new Handler();
resetView();
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.drawable.ic_logo);
getSupportActionBar().setDisplayUseLogoEnabled(true);
}
示例11: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
mScannerView = new ZXingScannerView(this);
setContentView(mScannerView);
// 返回按钮
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
// Activity标题
setTitle("扫一扫");
}
示例12: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scan);
mScannerView = new ZXingScannerView(this); // Programmatically initialize the scanner view
setContentView(mScannerView);
}
示例13: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().getDecorView().setSystemUiVisibility(ACTIVITY_VISIBILITY);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().setNavigationBarColor(Color.TRANSPARENT);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scanner);
mScannerView = (ZXingScannerView) findViewById(R.id.scanner_view);
mGalleryBtn = (ImageButton) findViewById(R.id.btn_gallery);
View fab = findViewById(R.id.btn_exit);
fab.setOnClickListener((view) -> {
onBackPressed();
});
((FrameLayout.LayoutParams) fab.getLayoutParams()).bottomMargin +=
ScreenUtils.getNavigationBarHeight(this);
if (!isCameraPermissionGranted()) {
if (shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)) {
new AlertDialog.Builder(this)
.setTitle(R.string.dialog_explanation_permission_title)
.setMessage(R.string.dialog_explanation_permission_message)
.setPositiveButton(R.string.dialog_explanation_permission_pos_btn, (dialogInterface, i) -> jumpToSettings())
.setNegativeButton(android.R.string.cancel, null)
.show();
} else {
requestPermissions(
new String[]{Manifest.permission.CAMERA},
REQUEST_PERMISSION
);
}
}
}
示例14: bind
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
public void bind(ZXingScannerView view, Command<Result> command) {
mCommand = command;
mScannerView = view;
mCommand.setListener(this);
mScannerView.setResultHandler(this);
mScannerView.startCamera();
}
示例15: onCreate
import me.dm7.barcodescanner.zxing.ZXingScannerView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
scannerView = new ZXingScannerView(this);
scannerView.setResultHandler(this);
setContentView(scannerView);
}