Android Zxing 添加闪光灯功能
zxing
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
项目地址:https://gitcode.com/gh_mirrors/zx/zxing
·
最近做了关于二维码解析的模块
选用的是google的开源工程Zxing
在Zxing 添加闪光灯功能 如下:
在 com.xxx.xxx.Zxing.camera 包下的CameraManager类中
添加代码:
//openLight 是开启闪光灯
//offLight 是关闭闪光灯
public void openLight(){
if (camera != null) {
parameter = camera.getParameters();
parameter.setFlashMode(Parameters.FLASH_MODE_TORCH);
camera.setParameters(parameter);
}
}
public void offLight(){
if (camera != null) {
parameter = camera.getParameters();
parameter.setFlashMode(Parameters.FLASH_MODE_OFF);
camera.setParameters(parameter);
}
}
在你需要调用闪光灯的类中
//开闪光灯
CameraManager.get().openLight();
// 关闪光灯
CameraManager.get().offLight();
闪光灯的功能就加进来了
希望对大家有用
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
最近提交(Master分支:4 个月前 )
50799640
Bumps [org.apache.maven.plugins:maven-release-plugin](https://github.com/apache/maven-release) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/apache/maven-release/releases)
- [Commits](https://github.com/apache/maven-release/compare/maven-release-3.1.1...maven-release-3.2.0)
---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-release-plugin
dependency-version: 3.2.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1 个月前
132ba33d
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-version: '6'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1 个月前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)