Tabnine Logo
ScannerView
Code IndexAdd Tabnine to your IDE (free)

How to use
ScannerView
in
com.mylhyl.zxing.scanner

Best Java code snippets using com.mylhyl.zxing.scanner.ScannerView (Showing top 7 results out of 315)

origin: mylhyl/Android-Zxing

@Override
public void restartPreview() {
  mScannerView.drawViewfinder();
}
origin: mylhyl/Android-Zxing

@Override
public void decodeSucceeded(Result rawResult, Bitmap barcode, float scaleFactor) {
  mScannerView.handleDecode(rawResult, barcode, scaleFactor);
}
origin: mylhyl/Android-Zxing

public ScannerView(Context context, AttributeSet attrs, int defStyle) {
  super(context, attrs, defStyle);
  init(context, attrs, defStyle);
}
origin: mylhyl/Android-Zxing

mScannerView.setOnScannerCompletionListener(this);
int scanMode = extras.getInt(EXTRA_SCAN_MODE);
showThumbnail = extras.getBoolean(EXTRA_SHOW_THUMBNAIL);
mScannerView.setMediaResId(R.raw.beep);//设置扫描成功的声音
mScannerView.setDrawText("将二维码放入框内", true);
mScannerView.setDrawTextColor(Color.RED);
  mScannerView.setScanMode(Scanner.ScanMode.QR_CODE_MODE);
} else if (scanMode == 2) {
  mScannerView.setScanMode(Scanner.ScanMode.PRODUCT_MODE);
mScannerView.isShowResThumbnail(showThumbnail);
mScannerView.isScanFullScreen(extras.getBoolean(EXTRA_SCAN_FULL_SCREEN));
mScannerView.isHideLaserFrame(extras.getBoolean(EXTRA_HIDE_LASER_FRAME));
    mScannerView.setLaserLineResId(R.mipmap.wx_scan_line);//线图
    break;
  case EXTRA_LASER_LINE_MODE_1:
    mScannerView.setLaserGridLineResId(R.mipmap.zfb_grid_scan_line);//网格图
    mScannerView.setLaserFrameBoundColor(0xFF26CEFF);//支付宝颜色
    break;
  case EXTRA_LASER_LINE_MODE_2:
    mScannerView.setLaserColor(Color.RED);
    break;
origin: mylhyl/Android-Zxing

/**
 * A valid barcode has been found, so give an indication of success and show
 * the results.
 *
 * @param rawResult   The contents of the barcode.
 * @param scaleFactor amount by which thumbnail was scaled
 * @param barcode     A greyscale bitmap of the camera data which was decoded.
 */
void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
  //扫描成功
  if (mScannerCompletionListener != null) {
    //转换结果
    mScannerCompletionListener.onScannerCompletion(rawResult, Scanner.parseResult(rawResult), barcode);
  }
  if (mScannerOptions.getMediaResId() != 0) {
    if (mBeepManager == null) {
      mBeepManager = new BeepManager(getContext());
      mBeepManager.setMediaResId(mScannerOptions.getMediaResId());
    }
    mBeepManager.playBeepSoundAndVibrate();
  }
  if (barcode != null && mScannerOptions.isShowQrThumbnail()) {
    mViewfinderView.drawResultBitmap(barcode);
    drawResultPoints(barcode, scaleFactor, rawResult);
  }
}
origin: mylhyl/Android-Zxing

private void init(Context context, AttributeSet attrs, int defStyle) {
  mSurfaceView = new CameraSurfaceView(context, this);
  mSurfaceView.setId(android.R.id.list);
  addView(mSurfaceView);
  mViewfinderView = new ViewfinderView(context, attrs);
  RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(context, attrs);
  layoutParams.addRule(RelativeLayout.ALIGN_TOP, mSurfaceView.getId());
  layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, mSurfaceView.getId());
  addView(mViewfinderView, layoutParams);
  mScannerOptionsBuilder = new ScannerOptions.Builder();
  mScannerOptions = mScannerOptionsBuilder.build();
}
origin: mylhyl/Android-Zxing

if (points.length == 2) {
  paint.setStrokeWidth(4.0f);
  drawLine(canvas, paint, points[0], points[1], scaleFactor);
} else if (points.length == 4
    && (rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A || rawResult.getBarcodeFormat() == BarcodeFormat.EAN_13)) {
  drawLine(canvas, paint, points[0], points[1], scaleFactor);
  drawLine(canvas, paint, points[2], points[3], scaleFactor);
} else {
  paint.setStrokeWidth(10.0f);
com.mylhyl.zxing.scannerScannerView

Javadoc

Created by hupei on 2016/7/1.

Most used methods

  • addView
  • drawLine
  • drawResultPoints
    Superimpose a line for 1D or dots for 2D to highlight the key features of the barcode.
  • drawViewfinder
  • getContext
  • handleDecode
    A valid barcode has been found, so give an indication of success and show the results.
  • init
  • isHideLaserFrame
    设置隐藏取景视图,包括文字
  • isScanFullScreen
    是否全屏扫描
  • isShowResThumbnail
    是否显示扫描结果缩略图
  • onPause
  • onResume
  • onPause,
  • onResume,
  • restartPreviewAfterDelay,
  • setDrawText,
  • setDrawTextColor,
  • setLaserColor,
  • setLaserFrameBoundColor,
  • setLaserGridLineResId,
  • setLaserLineResId,
  • setMediaResId

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JComboBox (javax.swing)
  • Join (org.hibernate.mapping)
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now