implement actual pausing functionality
This commit is contained in:
parent
dab25b08b9
commit
47f68995b2
|
@ -74,7 +74,7 @@ class RecorderFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
|||
}
|
||||
|
||||
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())
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,20 @@ class RecorderService : Service() {
|
|||
amplitudeTimer.scheduleAtFixedRate(getAmplitudeUpdateTask(), 0, AMPLITUDE_UPDATE_MS)
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
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")
|
||||
|
|
Loading…
Reference in New Issue