summaryrefslogtreecommitdiffstats
path: root/src/android/app
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-04-12 03:08:37 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:52 +0200
commit921e6dddcc309665cfafdc002f0723cfa533c33d (patch)
tree487e373110b1e16639cae7db7a742f7b089b05c8 /src/android/app
parentandroid: Adjustments to card_game (diff)
downloadyuzu-921e6dddcc309665cfafdc002f0723cfa533c33d.tar
yuzu-921e6dddcc309665cfafdc002f0723cfa533c33d.tar.gz
yuzu-921e6dddcc309665cfafdc002f0723cfa533c33d.tar.bz2
yuzu-921e6dddcc309665cfafdc002f0723cfa533c33d.tar.lz
yuzu-921e6dddcc309665cfafdc002f0723cfa533c33d.tar.xz
yuzu-921e6dddcc309665cfafdc002f0723cfa533c33d.tar.zst
yuzu-921e6dddcc309665cfafdc002f0723cfa533c33d.zip
Diffstat (limited to 'src/android/app')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/OptionsFragment.kt7
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt18
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt22
-rw-r--r--src/android/app/src/main/res/layout/activity_main.xml11
4 files changed, 35 insertions, 23 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/OptionsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/OptionsFragment.kt
index dac9e67d5..954e52dc6 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/OptionsFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/OptionsFragment.kt
@@ -87,13 +87,6 @@ class OptionsFragment : Fragment() {
adapter = HomeOptionAdapter(requireActivity() as AppCompatActivity, optionsList)
}
- requireActivity().window.statusBarColor = ThemeHelper.getColorWithOpacity(
- MaterialColors.getColor(
- binding.root,
- R.attr.colorSurface
- ), ThemeHelper.SYSTEM_BAR_ALPHA
- )
-
setInsets()
}
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 0c609798b..f542fe2de 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
@@ -9,7 +9,6 @@ import android.view.View
import android.view.ViewGroup
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
-import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
@@ -27,7 +26,6 @@ import org.yuzu.yuzu_emu.layout.AutofitGridLayoutManager
import org.yuzu.yuzu_emu.model.Game
import org.yuzu.yuzu_emu.model.GamesViewModel
import org.yuzu.yuzu_emu.model.HomeViewModel
-import org.yuzu.yuzu_emu.utils.ThemeHelper
import java.util.Locale
class GamesFragment : Fragment() {
@@ -145,21 +143,9 @@ class GamesFragment : Fragment() {
_binding = null
}
- private fun searchShown() {
- homeViewModel.setNavigationVisible(false)
- requireActivity().window.statusBarColor =
- ContextCompat.getColor(requireContext(), android.R.color.transparent)
- }
+ private fun searchShown() = homeViewModel.setNavigationVisible(false)
- private fun searchHidden() {
- homeViewModel.setNavigationVisible(true)
- requireActivity().window.statusBarColor = ThemeHelper.getColorWithOpacity(
- MaterialColors.getColor(
- binding.root,
- R.attr.colorSurface
- ), ThemeHelper.SYSTEM_BAR_ALPHA
- )
- }
+ private fun searchHidden() = homeViewModel.setNavigationVisible(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 a16ca8529..c7d399846 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
@@ -9,6 +9,7 @@ import android.view.ViewGroup.MarginLayoutParams
import android.view.animation.PathInterpolator
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
@@ -41,6 +42,8 @@ class MainActivity : AppCompatActivity() {
WindowCompat.setDecorFitsSystemWindows(window, false)
+ window.statusBarColor =
+ ContextCompat.getColor(applicationContext, android.R.color.transparent)
ThemeHelper.setNavigationBarColor(
this,
ElevationOverlayProvider(binding.navigationBar.context).compositeOverlay(
@@ -80,6 +83,25 @@ class MainActivity : AppCompatActivity() {
}
private fun showNavigation(visible: Boolean) {
+ // TODO: This should be decoupled from navigation in the future
+ binding.statusBarShade.animate().apply {
+ if (visible) {
+ 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)
+ interpolator = PathInterpolator(0.3f, 0f, 0.8f, 0.15f)
+ }
+ }.withEndAction {
+ if (!visible) {
+ binding.statusBarShade.visibility = View.INVISIBLE
+ }
+ }.start()
+
binding.navigationBar.animate().apply {
if (visible) {
binding.navigationBar.visibility = View.VISIBLE
diff --git a/src/android/app/src/main/res/layout/activity_main.xml b/src/android/app/src/main/res/layout/activity_main.xml
index 9002b0642..68a3eae46 100644
--- a/src/android/app/src/main/res/layout/activity_main.xml
+++ b/src/android/app/src/main/res/layout/activity_main.xml
@@ -29,4 +29,15 @@
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/menu_navigation" />
+ <View
+ android:id="@+id/status_bar_shade"
+ android:layout_width="0dp"
+ android:layout_height="1px"
+ android:background="@android:color/transparent"
+ android:clickable="false"
+ android:focusable="false"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+
</androidx.constraintlayout.widget.ConstraintLayout>