mirror of
https://github.com/SimpleMobileTools/Simple-Voice-Recorder.git
synced 2025-06-05 21:59:31 +02:00
implement actual pausing functionality
This commit is contained in:
@ -74,7 +74,7 @@ class RecorderFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getToggleButtonIcon(): Drawable {
|
private fun getToggleButtonIcon(): Drawable {
|
||||||
val drawable = if (status == RECORDING_RUNNING) R.drawable.ic_stop_vector else R.drawable.ic_microphone_vector
|
val drawable = if (status == RECORDING_RUNNING || status == RECORDING_PAUSED) R.drawable.ic_stop_vector else R.drawable.ic_microphone_vector
|
||||||
return resources.getColoredDrawableWithColor(drawable, context.getFABIconColor())
|
return resources.getColoredDrawableWithColor(drawable, context.getFABIconColor())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,8 +147,20 @@ class RecorderService : Service() {
|
|||||||
amplitudeTimer.scheduleAtFixedRate(getAmplitudeUpdateTask(), 0, AMPLITUDE_UPDATE_MS)
|
amplitudeTimer.scheduleAtFixedRate(getAmplitudeUpdateTask(), 0, AMPLITUDE_UPDATE_MS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
private fun togglePause() {
|
private fun togglePause() {
|
||||||
|
try {
|
||||||
|
if (status == RECORDING_RUNNING) {
|
||||||
|
recorder?.pause()
|
||||||
|
status = RECORDING_PAUSED
|
||||||
|
} else if (status == RECORDING_PAUSED) {
|
||||||
|
recorder?.resume()
|
||||||
|
status = RECORDING_RUNNING
|
||||||
|
}
|
||||||
|
broadcastStatus()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
showErrorToast(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("InlinedApi")
|
@SuppressLint("InlinedApi")
|
||||||
|
Reference in New Issue
Block a user