Code review fixes.
This commit is contained in:
parent
2c611790db
commit
3156410965
|
@ -83,7 +83,7 @@ class VoiceMessageViews(
|
||||||
observeMicButton(actions)
|
observeMicButton(actions)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTouchedPositionPercentage(motionEvent: MotionEvent, view: View) = motionEvent.x / view.width
|
private fun getTouchedPositionPercentage(motionEvent: MotionEvent, view: View) = (motionEvent.x / view.width).coerceIn(0f, 1f)
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
private fun observeMicButton(actions: Actions) {
|
private fun observeMicButton(actions: Actions) {
|
||||||
|
|
|
@ -709,6 +709,7 @@ class MessageItemFactory @Inject constructor(
|
||||||
return this
|
return this
|
||||||
?.filterNotNull()
|
?.filterNotNull()
|
||||||
?.map {
|
?.map {
|
||||||
|
// Value comes from AudioWaveformView.MAX_FFT, and 1024 is the max value in the Matrix spec
|
||||||
it * AudioWaveformView.MAX_FFT / 1024
|
it * AudioWaveformView.MAX_FFT / 1024
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ abstract class MessageVoiceItem : AbsMessageItem<MessageVoiceItem.Holder>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTouchedPositionPercentage(motionEvent: MotionEvent, view: View) = motionEvent.x / view.width
|
private fun getTouchedPositionPercentage(motionEvent: MotionEvent, view: View) = (motionEvent.x / view.width).coerceIn(0f, 1f)
|
||||||
|
|
||||||
private fun renderIdleState(holder: Holder, idleColor: Int, playedColor: Int) {
|
private fun renderIdleState(holder: Holder, idleColor: Int, playedColor: Int) {
|
||||||
holder.voicePlaybackControlButton.setImageResource(R.drawable.ic_play_pause_play)
|
holder.voicePlaybackControlButton.setImageResource(R.drawable.ic_play_pause_play)
|
||||||
|
|
Loading…
Reference in New Issue