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


Java ZXingScannerView类代码示例

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

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

示例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));
		}
	});
}
 
开发者ID:TheRealGitCub,项目名称:SplitSmart,代码行数:25,代码来源:AddItemActivity.java

示例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());
}
 
开发者ID:kenCode-de,项目名称:smartcoins-wallet,代码行数:19,代码来源:QRCodeActivity.java

示例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;
}
 
开发者ID:openfoodfacts,项目名称:openfoodfacts-androidapp,代码行数:21,代码来源:BarCodeScannerFragment.java

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

示例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();
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:10,代码来源:QRScanActivity.java

示例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));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:ScannerActivity.java

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

示例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("扫一扫");
}
 
开发者ID:iHaPBoy,项目名称:BookShelf,代码行数:16,代码来源:ScannerActivity.java

示例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);
}
 
开发者ID:matbrandao,项目名称:Saude-no-Mapa,代码行数:9,代码来源:ScanActivity.java

示例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
			);
		}
	}
}
 
开发者ID:fython-tools,项目名称:NyanpasuTile,代码行数:37,代码来源:ScannerActivity.java

示例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();
}
 
开发者ID:FAU-Inf2,项目名称:fablab-android,代码行数:10,代码来源:ScannerViewCommandBinding.java

示例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);
}
 
开发者ID:zacharytamas,项目名称:super-duo,代码行数:8,代码来源:ScannerActivity.java


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