android: Fix navigation rail animation in rtl layout
This commit is contained in:
parent
c930b2bad2
commit
8d3288b6ff
|
@ -164,9 +164,15 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
binding.navigationView.height.toFloat() * 2
|
binding.navigationView.height.toFloat() * 2
|
||||||
translationY(0f)
|
translationY(0f)
|
||||||
} else {
|
} else {
|
||||||
binding.navigationView.translationX =
|
if (ViewCompat.getLayoutDirection(binding.navigationView) == ViewCompat.LAYOUT_DIRECTION_LTR) {
|
||||||
binding.navigationView.width.toFloat() * -2
|
binding.navigationView.translationX =
|
||||||
translationX(0f)
|
binding.navigationView.width.toFloat() * -2
|
||||||
|
translationX(0f)
|
||||||
|
} else {
|
||||||
|
binding.navigationView.translationX =
|
||||||
|
binding.navigationView.width.toFloat() * 2
|
||||||
|
translationX(0f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
duration = 300
|
duration = 300
|
||||||
|
@ -175,7 +181,11 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
if (smallLayout) {
|
if (smallLayout) {
|
||||||
translationY(binding.navigationView.height.toFloat() * 2)
|
translationY(binding.navigationView.height.toFloat() * 2)
|
||||||
} else {
|
} else {
|
||||||
translationX(binding.navigationView.width.toFloat() * -2)
|
if (ViewCompat.getLayoutDirection(binding.navigationView) == ViewCompat.LAYOUT_DIRECTION_LTR) {
|
||||||
|
translationX(binding.navigationView.width.toFloat() * -2)
|
||||||
|
} else {
|
||||||
|
translationX(binding.navigationView.width.toFloat() * 2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.withEndAction {
|
}.withEndAction {
|
||||||
|
|
Loading…
Reference in New Issue