Merge pull request #7319 from ByeongsuPark/feature/bspark/bugfix-wrong-mic-direction-rtl

Fix the wrong mic button direction to cancel on RTL languages
This commit is contained in:
Benoit Marty 2022-10-13 13:59:09 +02:00 committed by GitHub
commit 5b56ae1e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

1
changelog.d/5968.bugfix Normal file
View File

@ -0,0 +1 @@
Fix wrong mic button direction to cancel on RTL languages

View File

@ -21,6 +21,7 @@ import android.view.MotionEvent
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.utils.DimensionConverter import im.vector.app.core.utils.DimensionConverter
import im.vector.app.features.home.room.detail.composer.voice.VoiceMessageRecorderView.DraggingState import im.vector.app.features.home.room.detail.composer.voice.VoiceMessageRecorderView.DraggingState
import kotlin.math.absoluteValue
class DraggableStateProcessor( class DraggableStateProcessor(
resources: Resources, resources: Resources,
@ -46,7 +47,7 @@ class DraggableStateProcessor(
fun process(event: MotionEvent, draggingState: DraggingState): DraggingState { fun process(event: MotionEvent, draggingState: DraggingState): DraggingState {
val currentX = event.rawX val currentX = event.rawX
val currentY = event.rawY val currentY = event.rawY
val distanceX = firstX - currentX val distanceX = (firstX - currentX).absoluteValue
val distanceY = firstY - currentY val distanceY = firstY - currentY
return draggingState.nextDragState(currentX, currentY, distanceX, distanceY).also { return draggingState.nextDragState(currentX, currentY, distanceX, distanceY).also {
lastDistanceX = distanceX lastDistanceX = distanceX