Commit b8184465 authored by Habib Kazemi's avatar Habib Kazemi Committed by Nicolas Pomepuy

Fix the RTL problem of SwipeToUnlockView

Fixes #1578 problem number 6
parent ee389e91
......@@ -31,6 +31,7 @@ import android.text.SpannableString
import android.text.Spanned
import android.text.style.MaskFilterSpan
import android.util.AttributeSet
import android.util.LayoutDirection
import android.util.Log
import android.view.KeyEvent
import android.view.LayoutInflater
......@@ -101,7 +102,10 @@ class SwipeToUnlockView : ConstraintLayout {
override fun onTouchEvent(event: MotionEvent?): Boolean {
if (unlocking) return super.onTouchEvent(event)
event?.let { event ->
val currentX = event.x.toInt().coerceAtLeast(extremum).coerceAtMost(width - extremum)
val currentX = event.x.toInt().coerceAtLeast(extremum).coerceAtMost(width - extremum).run {
if (layoutDirection == LayoutDirection.RTL) width - this
else this
}
when (event.action) {
MotionEvent.ACTION_DOWN -> {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment