summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt12
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt10
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt26
3 files changed, 34 insertions, 14 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt
index 74f12429c..b3f4188cd 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt
@@ -8,10 +8,20 @@ class HomeViewModel : ViewModel() {
private val _navigationVisible = MutableLiveData(true)
val navigationVisible: LiveData<Boolean> get() = _navigationVisible
- fun setNavigationVisible(visible: Boolean) {
+ private val _statusBarShadeVisible = MutableLiveData(true)
+ val statusBarShadeVisible: LiveData<Boolean> get() = _statusBarShadeVisible
+
+ fun setNavigationVisibility(visible: Boolean) {
if (_navigationVisible.value == visible) {
return
}
_navigationVisible.value = visible
}
+
+ fun setStatusBarShadeVisibility(visible: Boolean) {
+ if (_statusBarShadeVisible.value == visible) {
+ return
+ }
+ _statusBarShadeVisible.value = visible
+ }
}
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
index f542fe2de..c6bbc3c65 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt
@@ -143,9 +143,15 @@ class GamesFragment : Fragment() {
_binding = null
}
- private fun searchShown() = homeViewModel.setNavigationVisible(false)
+ private fun searchShown() {
+ homeViewModel.setNavigationVisibility(false)
+ homeViewModel.setStatusBarShadeVisibility(false)
+ }
- private fun searchHidden() = homeViewModel.setNavigationVisible(true)
+ private fun searchHidden() {
+ homeViewModel.setNavigationVisibility(true)
+ homeViewModel.setStatusBarShadeVisibility(true)
+ }
private inner class ScoredGame(val score: Double, val item: Game)
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 c7d399846..e47866030 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
@@ -75,6 +75,9 @@ class MainActivity : AppCompatActivity() {
homeViewModel.navigationVisible.observe(this) { visible ->
showNavigation(visible)
}
+ homeViewModel.statusBarShadeVisible.observe(this) { visible ->
+ showStatusBarShade(visible)
+ }
// Dismiss previous notifications (should not happen unless a crash occurred)
EmulationActivity.tryDismissRunningNotification(this)
@@ -83,40 +86,41 @@ class MainActivity : AppCompatActivity() {
}
private fun showNavigation(visible: Boolean) {
- // TODO: This should be decoupled from navigation in the future
- binding.statusBarShade.animate().apply {
+ binding.navigationBar.animate().apply {
if (visible) {
- binding.statusBarShade.visibility = View.VISIBLE
- binding.statusBarShade.translationY = binding.statusBarShade.height.toFloat() * -2
+ binding.navigationBar.visibility = View.VISIBLE
+ binding.navigationBar.translationY = binding.navigationBar.height.toFloat() * 2
duration = 300
translationY(0f)
interpolator = PathInterpolator(0.05f, 0.7f, 0.1f, 1f)
} else {
duration = 300
- translationY(binding.navigationBar.height.toFloat() * -2)
+ translationY(binding.navigationBar.height.toFloat() * 2)
interpolator = PathInterpolator(0.3f, 0f, 0.8f, 0.15f)
}
}.withEndAction {
if (!visible) {
- binding.statusBarShade.visibility = View.INVISIBLE
+ binding.navigationBar.visibility = View.INVISIBLE
}
}.start()
+ }
- binding.navigationBar.animate().apply {
+ private fun showStatusBarShade(visible: Boolean) {
+ binding.statusBarShade.animate().apply {
if (visible) {
- binding.navigationBar.visibility = View.VISIBLE
- binding.navigationBar.translationY = binding.navigationBar.height.toFloat() * 2
+ binding.statusBarShade.visibility = View.VISIBLE
+ binding.statusBarShade.translationY = binding.statusBarShade.height.toFloat() * -2
duration = 300
translationY(0f)
interpolator = PathInterpolator(0.05f, 0.7f, 0.1f, 1f)
} else {
duration = 300
- translationY(binding.navigationBar.height.toFloat() * 2)
+ translationY(binding.navigationBar.height.toFloat() * -2)
interpolator = PathInterpolator(0.3f, 0f, 0.8f, 0.15f)
}
}.withEndAction {
if (!visible) {
- binding.navigationBar.visibility = View.INVISIBLE
+ binding.statusBarShade.visibility = View.INVISIBLE
}
}.start()
}