diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt index 7c11c1dd..842474ac 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt @@ -411,11 +411,12 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE } - fun hideTimer() { - video_rec_curr_timer.text = 0.getFormattedDuration() - video_rec_curr_timer.beGone() - mCurrVideoRecTimer = 0 - mTimerHandler.removeCallbacksAndMessages(null) + fun toggleTimer(show: Boolean) { + if (show) { + showTimer() + } else { + hideTimer() + } } private fun showTimer() { @@ -423,6 +424,13 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave setupTimer() } + private fun hideTimer() { + video_rec_curr_timer.text = 0.getFormattedDuration() + video_rec_curr_timer.beGone() + mCurrVideoRecTimer = 0 + mTimerHandler.removeCallbacksAndMessages(null) + } + private fun setupTimer() { runOnUiThread(object : Runnable { override fun run() { diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraOne.kt b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraOne.kt index a4f082c0..c6e06044 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraOne.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/PreviewCameraOne.kt @@ -204,7 +204,7 @@ class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MediaScannerConnecti if (setCamera(mCurrCameraId)) { setFlashlightState(FLASH_OFF) mActivity?.updateCameraIcon(mCurrCameraId == mCameraImpl!!.getFrontCameraId()) - mActivity?.hideTimer() + mActivity?.toggleTimer(false) } else { mActivity?.toast(R.string.camera_switch_error) }