ScanManager.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:ForeverLibrary 作者:
/**
 * 用于启动照相机扫描二维码,在activity的onCreate里面构造出来
 * 在activity的生命周期中调用此类相对应的生命周期方法
 *
 * @param activity      扫描的activity
 * @param scanPreview   预览的SurfaceView
 * @param scanContainer 扫描的布局,全屏布局
 * @param scanCropView  扫描的矩形区域
 * @param scanLine      扫描线
 */
public ScanManager(Activity activity, SurfaceView scanPreview, View scanContainer,
                   View scanCropView, ImageView scanLine, int scanMode, ScanListener listener) {
    this.activity = activity;
    this.scanPreview = scanPreview;
    this.scanContainer = scanContainer;
    this.scanCropView = scanCropView;
    this.scanLine = scanLine;
    this.listener = listener;
    this.scanMode = scanMode;
    //启动动画
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
            0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    scanLine.startAnimation(animation);

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号