do not implement OnScanCompletedListener at PreviewCameraOne

This commit is contained in:
tibbi 2018-05-28 15:14:35 +02:00
parent ec294da274
commit a52716a3a5
2 changed files with 10 additions and 9 deletions

View File

@ -4,7 +4,7 @@ import android.content.Context
import android.hardware.Camera
import com.simplemobiletools.camera.R
val RATIO_TOLERANCE = 0.1f
const val RATIO_TOLERANCE = 0.1f
fun Camera.Size.isSixteenToNine(): Boolean {
val selectedRatio = Math.abs(width / height.toFloat())

View File

@ -7,7 +7,10 @@ import android.content.Context
import android.graphics.Point
import android.graphics.Rect
import android.hardware.Camera
import android.media.*
import android.media.AudioManager
import android.media.CamcorderProfile
import android.media.MediaPlayer
import android.media.MediaRecorder
import android.net.Uri
import android.os.Build
import android.os.Environment
@ -28,7 +31,7 @@ import java.io.File
import java.io.IOException
import java.util.*
class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScanCompletedListener {
class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback {
private var mCamera: Camera? = null
private val FOCUS_AREA_SIZE = 100
private val PHOTO_PREVIEW_LENGTH = 500L
@ -815,7 +818,10 @@ class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MediaScannerConnecti
try {
toggleShutterSound(true)
mRecorder!!.stop()
mActivity!!.rescanPaths(arrayListOf(mCurrVideoPath))
mActivity!!.rescanPaths(arrayListOf(mCurrVideoPath)) {
mCallback.videoSaved(Uri.fromFile(File(mCurrVideoPath)))
toggleShutterSound(false)
}
} catch (e: RuntimeException) {
mActivity!!.showErrorToast(e)
toggleShutterSound(false)
@ -841,11 +847,6 @@ class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MediaScannerConnecti
}
}
override fun onScanCompleted(path: String, uri: Uri) {
mCallback.videoSaved(uri)
toggleShutterSound(false)
}
private fun hasFlash(camera: Camera?): Boolean {
if (camera == null) {
return false