mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-08-20 08:23:21 +02:00
android: Use x-axis animation for navigation rail
This commit is contained in:
parent
03541703fa
commit
09e7b14d0e
@ -148,17 +148,29 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val smallLayout = resources.getBoolean(R.bool.small_layout)
|
||||||
binding.navigationView.animate().apply {
|
binding.navigationView.animate().apply {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
binding.navigationView.visibility = View.VISIBLE
|
binding.navigationView.visibility = View.VISIBLE
|
||||||
binding.navigationView.translationY = binding.navigationView.height.toFloat() * 2
|
|
||||||
duration = 300
|
duration = 300
|
||||||
translationY(0f)
|
|
||||||
interpolator = PathInterpolator(0.05f, 0.7f, 0.1f, 1f)
|
interpolator = PathInterpolator(0.05f, 0.7f, 0.1f, 1f)
|
||||||
|
|
||||||
|
if (smallLayout) {
|
||||||
|
binding.navigationView.translationY = binding.navigationView.height.toFloat() * 2
|
||||||
|
translationY(0f)
|
||||||
|
} else {
|
||||||
|
binding.navigationView.translationX = binding.navigationView.width.toFloat() * -2
|
||||||
|
translationX(0f)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
duration = 300
|
duration = 300
|
||||||
translationY(binding.navigationView.height.toFloat() * 2)
|
|
||||||
interpolator = PathInterpolator(0.3f, 0f, 0.8f, 0.15f)
|
interpolator = PathInterpolator(0.3f, 0f, 0.8f, 0.15f)
|
||||||
|
|
||||||
|
if (smallLayout) {
|
||||||
|
translationY(binding.navigationView.height.toFloat() * 2)
|
||||||
|
} else {
|
||||||
|
translationX(binding.navigationView.width.toFloat() * -2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.withEndAction {
|
}.withEndAction {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
|
4
src/android/app/src/main/res/values-w600dp/bools.xml
Normal file
4
src/android/app/src/main/res/values-w600dp/bools.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="small_layout">false</bool>
|
||||||
|
</resources>
|
4
src/android/app/src/main/res/values/bools.xml
Normal file
4
src/android/app/src/main/res/values/bools.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="small_layout">true</bool>
|
||||||
|
</resources>
|
Loading…
Reference in New Issue
Block a user