summaryrefslogtreecommitdiffstats
path: root/src/android/app
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-04-24 10:01:54 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:53 +0200
commitd8c102444c5e9d8b2c1f78aac009ee8df4a0d415 (patch)
tree656463b4ae2d6a447b8086cee5c292806c2c683d /src/android/app
parentandroid: Fix A button preference key (diff)
downloadyuzu-d8c102444c5e9d8b2c1f78aac009ee8df4a0d415.tar
yuzu-d8c102444c5e9d8b2c1f78aac009ee8df4a0d415.tar.gz
yuzu-d8c102444c5e9d8b2c1f78aac009ee8df4a0d415.tar.bz2
yuzu-d8c102444c5e9d8b2c1f78aac009ee8df4a0d415.tar.lz
yuzu-d8c102444c5e9d8b2c1f78aac009ee8df4a0d415.tar.xz
yuzu-d8c102444c5e9d8b2c1f78aac009ee8df4a0d415.tar.zst
yuzu-d8c102444c5e9d8b2c1f78aac009ee8df4a0d415.zip
Diffstat (limited to 'src/android/app')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt33
-rw-r--r--src/android/app/src/main/res/layout/fragment_setup.xml2
2 files changed, 17 insertions, 18 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt
index e7d102aad..35c84699b 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt
@@ -110,23 +110,24 @@ class SetupFragment : Fragment() {
}
binding.viewPager2.registerOnPageChangeCallback(object : OnPageChangeCallback() {
- override fun onPageScrolled(
- position: Int,
- positionOffset: Float,
- positionOffsetPixels: Int
- ) {
- super.onPageScrolled(position, positionOffset, positionOffsetPixels)
- if (position == 0) {
- hideView(binding.buttonBack)
- } else {
- showView(binding.buttonBack)
- }
+ var previousPosition: Int = 0
- if (position == pages.size - 1 || position == 0) {
+ override fun onPageSelected(position: Int) {
+ super.onPageSelected(position)
+
+ if (position == 1 && previousPosition == 0) {
+ showView(binding.buttonNext)
+ showView(binding.buttonBack)
+ } else if (position == 0 && previousPosition == 1) {
+ hideView(binding.buttonBack)
+ hideView(binding.buttonNext)
+ } else if (position == pages.size - 1 && previousPosition == pages.size - 2) {
hideView(binding.buttonNext)
- } else {
+ } else if (position == pages.size - 2 && previousPosition == pages.size - 1) {
showView(binding.buttonNext)
}
+
+ previousPosition = position
}
})
@@ -154,10 +155,6 @@ class SetupFragment : Fragment() {
}
private fun showView(view: View) {
- if (view.visibility == View.VISIBLE) {
- return
- }
-
view.apply {
alpha = 0f
visibility = View.VISIBLE
@@ -169,7 +166,7 @@ class SetupFragment : Fragment() {
}
private fun hideView(view: View) {
- if (view.visibility == View.GONE) {
+ if (view.visibility == View.INVISIBLE) {
return
}
diff --git a/src/android/app/src/main/res/layout/fragment_setup.xml b/src/android/app/src/main/res/layout/fragment_setup.xml
index 6f8993152..adaaa4959 100644
--- a/src/android/app/src/main/res/layout/fragment_setup.xml
+++ b/src/android/app/src/main/res/layout/fragment_setup.xml
@@ -22,6 +22,7 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/next"
+ android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
@@ -32,6 +33,7 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/back"
+ android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />