mirror of
https://github.com/SimpleMobileTools/Simple-Voice-Recorder.git
synced 2025-06-05 21:59:31 +02:00
stop the duration and visualizer during pause
This commit is contained in:
@@ -99,6 +99,7 @@ class RecorderFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
|||||||
Intent(context, RecorderService::class.java).apply {
|
Intent(context, RecorderService::class.java).apply {
|
||||||
context.startService(this)
|
context.startService(this)
|
||||||
}
|
}
|
||||||
|
recorder_visualizer.recreate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stopRecording() {
|
private fun stopRecording() {
|
||||||
@@ -117,14 +118,13 @@ class RecorderFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
|||||||
status = event.status
|
status = event.status
|
||||||
toggle_recording_button.setImageDrawable(getToggleButtonIcon())
|
toggle_recording_button.setImageDrawable(getToggleButtonIcon())
|
||||||
toggle_pause_button.beVisibleIf(status != RECORDING_STOPPED && isNougatPlus())
|
toggle_pause_button.beVisibleIf(status != RECORDING_STOPPED && isNougatPlus())
|
||||||
if (status == RECORDING_RUNNING) {
|
|
||||||
recorder_visualizer.recreate()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun gotAmplitudeEvent(event: Events.RecordingAmplitude) {
|
fun gotAmplitudeEvent(event: Events.RecordingAmplitude) {
|
||||||
val amplitude = event.amplitude
|
val amplitude = event.amplitude
|
||||||
|
if (status == RECORDING_RUNNING) {
|
||||||
recorder_visualizer.update(amplitude)
|
recorder_visualizer.update(amplitude)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -202,10 +202,12 @@ class RecorderService : Service() {
|
|||||||
|
|
||||||
private fun getDurationUpdateTask() = object : TimerTask() {
|
private fun getDurationUpdateTask() = object : TimerTask() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
if (status == RECORDING_RUNNING) {
|
||||||
duration++
|
duration++
|
||||||
broadcastDuration()
|
broadcastDuration()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getAmplitudeUpdateTask() = object : TimerTask() {
|
private fun getAmplitudeUpdateTask() = object : TimerTask() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
Reference in New Issue
Block a user