removing another redundant function

This commit is contained in:
tibbi 2018-05-30 16:40:46 +02:00
parent 250bf176c1
commit 7ff48fc880
3 changed files with 3 additions and 12 deletions

View File

@ -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()

View File

@ -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)

View File

@ -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() {