Merge pull request #353 from aarongrider/overlay-fix

Misc Fixes
This commit is contained in:
Aaron Grider 2021-01-12 14:13:10 -08:00 committed by GitHub
commit 0a32dad9e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 12 deletions

View File

@ -191,9 +191,6 @@ class CKCamera(context: ThemedReactContext) : FrameLayout(context), LifecycleObs
}
orientationListener!!.enable()
// Contain camera feed image within component bounds, centered
viewFinder.scaleType = PreviewView.ScaleType.FILL_CENTER
// Tap to focus
viewFinder.setOnTouchListener { _, event ->
if (event.action != MotionEvent.ACTION_UP) {
@ -258,7 +255,7 @@ class CKCamera(context: ThemedReactContext) : FrameLayout(context), LifecycleObs
fun capture(options: Map<String, Any>, promise: Promise) {
// Create output options object which contains file + metadata
val contentValues = ContentValues().apply {
put(MediaStore.MediaColumns.DISPLAY_NAME, "Untitled")
put(MediaStore.MediaColumns.DISPLAY_NAME, "IMG_" + System.currentTimeMillis())
put(MediaStore.MediaColumns.MIME_TYPE, "image/jpg")
}

View File

@ -8,9 +8,6 @@ import androidx.annotation.ColorInt
import com.rncamerakit.R
class BarcodeFrame(context: Context) : View(context) {
private var dimPaint: Paint = Paint()
private var framePaint: Paint = Paint()
private var borderPaint: Paint = Paint()
private var laserPaint: Paint = Paint()
var frameRect: Rect = Rect()
@ -22,9 +19,6 @@ class BarcodeFrame(context: Context) : View(context) {
private var laserY = 0
private fun init(context: Context) {
framePaint.xfermode = PorterDuffXfermode(PorterDuff.Mode.CLEAR)
dimPaint.style = Paint.Style.FILL
dimPaint.color = context.resources.getColor(R.color.bg_dark)
borderPaint = Paint()
borderPaint.style = Paint.Style.STROKE
borderPaint.strokeWidth = STROKE_WIDTH.toFloat()
@ -48,8 +42,6 @@ class BarcodeFrame(context: Context) : View(context) {
override fun onDraw(canvas: Canvas) {
val timeElapsed = System.currentTimeMillis() - previousFrameTime
super.onDraw(canvas)
canvas.drawRect(0f, 0f, width.toFloat(), height.toFloat(), dimPaint)
canvas.drawRect(frameRect, framePaint)
drawBorder(canvas)
drawLaser(canvas, timeElapsed)
previousFrameTime = System.currentTimeMillis()