mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Add RTL support to RemoveJitsiWidgetView
Signed-off-by: Byeongsu Park <byeongsu@soongsil.ac.kr>
This commit is contained in:
parent
8e9a364c8d
commit
577986001a
2 changed files with 6 additions and 3 deletions
1
changelog.d/8210.bugfix
Normal file
1
changelog.d/8210.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add RTL support to RemoveJitsiWidgetView
|
|
@ -29,6 +29,7 @@ import im.vector.app.R
|
||||||
import im.vector.app.databinding.ViewRemoveJitsiWidgetBinding
|
import im.vector.app.databinding.ViewRemoveJitsiWidgetBinding
|
||||||
import im.vector.app.features.home.room.detail.RoomDetailViewState
|
import im.vector.app.features.home.room.detail.RoomDetailViewState
|
||||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||||
|
import kotlin.math.absoluteValue
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility") class RemoveJitsiWidgetView @JvmOverloads constructor(
|
@SuppressLint("ClickableViewAccessibility") class RemoveJitsiWidgetView @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
|
@ -55,7 +56,7 @@ import org.matrix.android.sdk.api.session.room.model.Membership
|
||||||
return@setOnTouchListener when (event.action) {
|
return@setOnTouchListener when (event.action) {
|
||||||
MotionEvent.ACTION_DOWN -> {
|
MotionEvent.ACTION_DOWN -> {
|
||||||
if (currentState == State.Idle) {
|
if (currentState == State.Idle) {
|
||||||
val initialX = views.removeJitsiSlidingContainer.x - event.rawX
|
val initialX = event.rawX
|
||||||
updateState(State.Sliding(initialX, 0f, false))
|
updateState(State.Sliding(initialX, 0f, false))
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
|
@ -73,8 +74,9 @@ import org.matrix.android.sdk.api.session.room.model.Membership
|
||||||
}
|
}
|
||||||
MotionEvent.ACTION_MOVE -> {
|
MotionEvent.ACTION_MOVE -> {
|
||||||
if (currentState is State.Sliding) {
|
if (currentState is State.Sliding) {
|
||||||
val translationX = (currentState.initialX + event.rawX).coerceAtLeast(0f)
|
val deltaX = event.rawX - currentState.initialX
|
||||||
val hasReachedActivationThreshold = translationX >= views.root.width / 4
|
val translationX = if (!isRtl) deltaX.coerceAtLeast(0f) else deltaX.coerceAtMost(0f)
|
||||||
|
val hasReachedActivationThreshold = translationX.absoluteValue >= views.root.width / 4
|
||||||
updateState(State.Sliding(currentState.initialX, translationX, hasReachedActivationThreshold))
|
updateState(State.Sliding(currentState.initialX, translationX, hasReachedActivationThreshold))
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in a new issue