removing another redundant function
This commit is contained in:
parent
250bf176c1
commit
7ff48fc880
|
@ -13,8 +13,6 @@ interface MyPreview {
|
||||||
|
|
||||||
fun setFlashlightState(state: Int)
|
fun setFlashlightState(state: Int)
|
||||||
|
|
||||||
fun setCamera(cameraId: Int): Boolean
|
|
||||||
|
|
||||||
fun getCameraState(): Int
|
fun getCameraState(): Int
|
||||||
|
|
||||||
fun showChangeResolutionDialog()
|
fun showChangeResolutionDialog()
|
||||||
|
|
|
@ -124,13 +124,10 @@ class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MyPreview {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resumeCamera() = setCamera(mCurrCameraId)
|
override fun resumeCamera(): Boolean {
|
||||||
|
|
||||||
override fun setCamera(cameraId: Int): Boolean {
|
|
||||||
mCurrCameraId = cameraId
|
|
||||||
val newCamera: Camera
|
val newCamera: Camera
|
||||||
try {
|
try {
|
||||||
newCamera = Camera.open(cameraId)
|
newCamera = Camera.open(mCurrCameraId)
|
||||||
mCallback.setIsCameraAvailable(true)
|
mCallback.setIsCameraAvailable(true)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
mActivity!!.showErrorToast(e)
|
mActivity!!.showErrorToast(e)
|
||||||
|
@ -204,7 +201,7 @@ class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MyPreview {
|
||||||
|
|
||||||
mConfig.lastUsedCamera = mCurrCameraId
|
mConfig.lastUsedCamera = mCurrCameraId
|
||||||
releaseCamera()
|
releaseCamera()
|
||||||
if (setCamera(mCurrCameraId)) {
|
if (resumeCamera()) {
|
||||||
setFlashlightState(FLASH_OFF)
|
setFlashlightState(FLASH_OFF)
|
||||||
mActivity?.updateCameraIcon(mCurrCameraId == mCameraImpl!!.getFrontCameraId())
|
mActivity?.updateCameraIcon(mCurrCameraId == mCameraImpl!!.getFrontCameraId())
|
||||||
mActivity?.toggleTimer(false)
|
mActivity?.toggleTimer(false)
|
||||||
|
|
|
@ -401,10 +401,6 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
||||||
checkFlashlight()
|
checkFlashlight()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setCamera(cameraId: Int): Boolean {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getCameraState() = mCameraState
|
override fun getCameraState() = mCameraState
|
||||||
|
|
||||||
override fun showChangeResolutionDialog() {
|
override fun showChangeResolutionDialog() {
|
||||||
|
|
Loading…
Reference in New Issue