add a helper function for toggling timer visibility in the activity
This commit is contained in:
parent
b8db893c1c
commit
05dee60cb7
|
@ -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() {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue