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
|
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hideTimer() {
|
fun toggleTimer(show: Boolean) {
|
||||||
video_rec_curr_timer.text = 0.getFormattedDuration()
|
if (show) {
|
||||||
video_rec_curr_timer.beGone()
|
showTimer()
|
||||||
mCurrVideoRecTimer = 0
|
} else {
|
||||||
mTimerHandler.removeCallbacksAndMessages(null)
|
hideTimer()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showTimer() {
|
private fun showTimer() {
|
||||||
|
@ -423,6 +424,13 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
||||||
setupTimer()
|
setupTimer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun hideTimer() {
|
||||||
|
video_rec_curr_timer.text = 0.getFormattedDuration()
|
||||||
|
video_rec_curr_timer.beGone()
|
||||||
|
mCurrVideoRecTimer = 0
|
||||||
|
mTimerHandler.removeCallbacksAndMessages(null)
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupTimer() {
|
private fun setupTimer() {
|
||||||
runOnUiThread(object : Runnable {
|
runOnUiThread(object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
|
|
@ -204,7 +204,7 @@ class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MediaScannerConnecti
|
||||||
if (setCamera(mCurrCameraId)) {
|
if (setCamera(mCurrCameraId)) {
|
||||||
setFlashlightState(FLASH_OFF)
|
setFlashlightState(FLASH_OFF)
|
||||||
mActivity?.updateCameraIcon(mCurrCameraId == mCameraImpl!!.getFrontCameraId())
|
mActivity?.updateCameraIcon(mCurrCameraId == mCameraImpl!!.getFrontCameraId())
|
||||||
mActivity?.hideTimer()
|
mActivity?.toggleTimer(false)
|
||||||
} else {
|
} else {
|
||||||
mActivity?.toast(R.string.camera_switch_error)
|
mActivity?.toast(R.string.camera_switch_error)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue