mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-14 16:25:05 +01:00
Merge pull request #2837 from nextcloud/bugfix/2836/fixNpeInVoiceMessageRecording
Avoid NPE for voice message recording
This commit is contained in:
commit
17f92d323c
@ -858,30 +858,31 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
showRecordAudioUi(true)
|
showRecordAudioUi(true)
|
||||||
|
|
||||||
binding?.messageInputView?.slideToCancelDescription?.x?.let {
|
|
||||||
if (sliderInitX == 0.0F) {
|
|
||||||
sliderInitX = it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val movedX: Float = event.x
|
val movedX: Float = event.x
|
||||||
deltaX = movedX - downX
|
deltaX = movedX - downX
|
||||||
|
|
||||||
// only allow slide to left
|
// only allow slide to left
|
||||||
if (binding?.messageInputView?.slideToCancelDescription?.x!! > sliderInitX) {
|
binding?.messageInputView?.slideToCancelDescription?.x?.let {
|
||||||
binding?.messageInputView?.slideToCancelDescription?.x = sliderInitX
|
if (sliderInitX == 0.0F) {
|
||||||
|
sliderInitX = it
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it > sliderInitX) {
|
||||||
|
binding?.messageInputView?.slideToCancelDescription?.x = sliderInitX
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding?.messageInputView?.slideToCancelDescription?.x!! < VOICE_RECORD_CANCEL_SLIDER_X) {
|
binding?.messageInputView?.slideToCancelDescription?.x?.let {
|
||||||
Log.d(TAG, "stopping recording because slider was moved to left")
|
if (it < VOICE_RECORD_CANCEL_SLIDER_X) {
|
||||||
stopAndDiscardAudioRecording()
|
Log.d(TAG, "stopping recording because slider was moved to left")
|
||||||
showRecordAudioUi(false)
|
stopAndDiscardAudioRecording()
|
||||||
binding?.messageInputView?.slideToCancelDescription?.x = sliderInitX
|
showRecordAudioUi(false)
|
||||||
return true
|
binding?.messageInputView?.slideToCancelDescription?.x = sliderInitX
|
||||||
} else {
|
return true
|
||||||
binding?.messageInputView?.slideToCancelDescription?.x =
|
} else {
|
||||||
binding?.messageInputView?.slideToCancelDescription?.x!! + deltaX
|
binding?.messageInputView?.slideToCancelDescription?.x = it + deltaX
|
||||||
downX = movedX
|
downX = movedX
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user