summaryrefslogtreecommitdiffstats
path: root/src/android
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-04-26 07:52:26 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:55 +0200
commit48c506682d44081704a5275a282564121a4e3fee (patch)
treef3171ec4db98481ca461fc6d7c26681a53fed7fe /src/android
parentandroid: Temporarily switch for a fixed version code for testing (diff)
downloadyuzu-48c506682d44081704a5275a282564121a4e3fee.tar
yuzu-48c506682d44081704a5275a282564121a4e3fee.tar.gz
yuzu-48c506682d44081704a5275a282564121a4e3fee.tar.bz2
yuzu-48c506682d44081704a5275a282564121a4e3fee.tar.lz
yuzu-48c506682d44081704a5275a282564121a4e3fee.tar.xz
yuzu-48c506682d44081704a5275a282564121a4e3fee.tar.zst
yuzu-48c506682d44081704a5275a282564121a4e3fee.zip
Diffstat (limited to 'src/android')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt28
-rw-r--r--src/android/app/src/main/res/layout-w600dp/fragment_setup.xml2
2 files changed, 26 insertions, 4 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 35c84699b..7c8a37855 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
@@ -13,6 +13,8 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
+import androidx.core.view.isVisible
+import androidx.core.view.updatePadding
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.navigation.findNavController
@@ -36,6 +38,11 @@ class SetupFragment : Fragment() {
private lateinit var mainActivity: MainActivity
+ companion object {
+ const val KEY_NEXT_VISIBILITY = "NextButtonVisibility"
+ const val KEY_BACK_VISIBILITY = "BackButtonVisibility"
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
exitTransition = MaterialFadeThrough()
@@ -134,14 +141,27 @@ class SetupFragment : Fragment() {
binding.buttonNext.setOnClickListener { pageForward() }
binding.buttonBack.setOnClickListener { pageBackward() }
- if (binding.viewPager2.currentItem == 0) {
- binding.buttonNext.visibility = View.INVISIBLE
- binding.buttonBack.visibility = View.INVISIBLE
+ if (savedInstanceState != null) {
+ val nextIsVisible = savedInstanceState.getBoolean(KEY_NEXT_VISIBILITY)
+ val backIsVisible = savedInstanceState.getBoolean(KEY_BACK_VISIBILITY)
+
+ if (nextIsVisible) {
+ binding.buttonNext.visibility = View.VISIBLE
+ }
+ if (backIsVisible) {
+ binding.buttonBack.visibility = View.VISIBLE
+ }
}
setInsets()
}
+ override fun onSaveInstanceState(outState: Bundle) {
+ super.onSaveInstanceState(outState)
+ outState.putBoolean(KEY_NEXT_VISIBILITY, binding.buttonNext.isVisible)
+ outState.putBoolean(KEY_BACK_VISIBILITY, binding.buttonBack.isVisible)
+ }
+
override fun onDestroyView() {
super.onDestroyView()
_binding = null
@@ -190,7 +210,7 @@ class SetupFragment : Fragment() {
}
private fun setInsets() =
- ViewCompat.setOnApplyWindowInsetsListener(binding.setupRoot) { view: View, windowInsets: WindowInsetsCompat ->
+ ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view: View, windowInsets: WindowInsetsCompat ->
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
view.setPadding(
insets.left,
diff --git a/src/android/app/src/main/res/layout-w600dp/fragment_setup.xml b/src/android/app/src/main/res/layout-w600dp/fragment_setup.xml
index e05af9bdd..cbe631d88 100644
--- a/src/android/app/src/main/res/layout-w600dp/fragment_setup.xml
+++ b/src/android/app/src/main/res/layout-w600dp/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" />