diff options
| author | 2023-05-01 04:43:04 -0400 | |
|---|---|---|
| committer | 2023-06-03 00:05:58 -0700 | |
| commit | 09e7b14d0ead361c56579d8491015320251bb043 (patch) | |
| tree | 17f65a3b9d8f39f4eaa9c78e2e81d438f194b062 | |
| parent | android: Sort games alphabetically by default (diff) | |
| download | yuzu-09e7b14d0ead361c56579d8491015320251bb043.tar.gz yuzu-09e7b14d0ead361c56579d8491015320251bb043.tar.xz yuzu-09e7b14d0ead361c56579d8491015320251bb043.zip | |
android: Use x-axis animation for navigation rail
3 files changed, 23 insertions, 3 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt index c620c3c7c..5fafc2d2d 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt | |||
| @@ -148,17 +148,29 @@ class MainActivity : AppCompatActivity(), ThemeProvider { | |||
| 148 | return | 148 | return |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | val smallLayout = resources.getBoolean(R.bool.small_layout) | ||
| 151 | binding.navigationView.animate().apply { | 152 | binding.navigationView.animate().apply { |
| 152 | if (visible) { | 153 | if (visible) { |
| 153 | binding.navigationView.visibility = View.VISIBLE | 154 | binding.navigationView.visibility = View.VISIBLE |
| 154 | binding.navigationView.translationY = binding.navigationView.height.toFloat() * 2 | ||
| 155 | duration = 300 | 155 | duration = 300 |
| 156 | translationY(0f) | ||
| 157 | interpolator = PathInterpolator(0.05f, 0.7f, 0.1f, 1f) | 156 | interpolator = PathInterpolator(0.05f, 0.7f, 0.1f, 1f) |
| 157 | |||
| 158 | if (smallLayout) { | ||
| 159 | binding.navigationView.translationY = binding.navigationView.height.toFloat() * 2 | ||
| 160 | translationY(0f) | ||
| 161 | } else { | ||
| 162 | binding.navigationView.translationX = binding.navigationView.width.toFloat() * -2 | ||
| 163 | translationX(0f) | ||
| 164 | } | ||
| 158 | } else { | 165 | } else { |
| 159 | duration = 300 | 166 | duration = 300 |
| 160 | translationY(binding.navigationView.height.toFloat() * 2) | ||
| 161 | interpolator = PathInterpolator(0.3f, 0f, 0.8f, 0.15f) | 167 | interpolator = PathInterpolator(0.3f, 0f, 0.8f, 0.15f) |
| 168 | |||
| 169 | if (smallLayout) { | ||
| 170 | translationY(binding.navigationView.height.toFloat() * 2) | ||
| 171 | } else { | ||
| 172 | translationX(binding.navigationView.width.toFloat() * -2) | ||
| 173 | } | ||
| 162 | } | 174 | } |
| 163 | }.withEndAction { | 175 | }.withEndAction { |
| 164 | if (!visible) { | 176 | if (!visible) { |
diff --git a/src/android/app/src/main/res/values-w600dp/bools.xml b/src/android/app/src/main/res/values-w600dp/bools.xml new file mode 100644 index 000000000..b6833a702 --- /dev/null +++ b/src/android/app/src/main/res/values-w600dp/bools.xml | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <resources> | ||
| 3 | <bool name="small_layout">false</bool> | ||
| 4 | </resources> | ||
diff --git a/src/android/app/src/main/res/values/bools.xml b/src/android/app/src/main/res/values/bools.xml new file mode 100644 index 000000000..e50f473fb --- /dev/null +++ b/src/android/app/src/main/res/values/bools.xml | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <resources> | ||
| 3 | <bool name="small_layout">true</bool> | ||
| 4 | </resources> | ||