summaryrefslogtreecommitdiffstats
path: root/src/android/app
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-08-13 02:21:47 +0200
committerCharles Lombardo <clombardo169@gmail.com>2023-08-13 02:21:47 +0200
commit242ce2a0b3ca7dcc59d0cd53b0a739bb97218965 (patch)
tree860b57bc6226cefb00a23325f9d184d8f01db9c2 /src/android/app
parentandroid: Adjust setup fragment layout (diff)
downloadyuzu-242ce2a0b3ca7dcc59d0cd53b0a739bb97218965.tar
yuzu-242ce2a0b3ca7dcc59d0cd53b0a739bb97218965.tar.gz
yuzu-242ce2a0b3ca7dcc59d0cd53b0a739bb97218965.tar.bz2
yuzu-242ce2a0b3ca7dcc59d0cd53b0a739bb97218965.tar.lz
yuzu-242ce2a0b3ca7dcc59d0cd53b0a739bb97218965.tar.xz
yuzu-242ce2a0b3ca7dcc59d0cd53b0a739bb97218965.tar.zst
yuzu-242ce2a0b3ca7dcc59d0cd53b0a739bb97218965.zip
Diffstat (limited to 'src/android/app')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/SetupAdapter.kt3
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt7
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt7
3 files changed, 17 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/SetupAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/SetupAdapter.kt
index 0e3cec9ac..6b46d359e 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/SetupAdapter.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/SetupAdapter.kt
@@ -9,9 +9,11 @@ import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat
+import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.button.MaterialButton
import org.yuzu.yuzu_emu.databinding.PageSetupBinding
+import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.model.SetupCallback
import org.yuzu.yuzu_emu.model.SetupPage
import org.yuzu.yuzu_emu.model.StepState
@@ -80,6 +82,7 @@ class SetupAdapter(val activity: AppCompatActivity, val pages: List<SetupPage>)
override fun onStepCompleted() {
ViewUtils.hideView(binding.buttonAction, 200)
ViewUtils.showView(binding.textConfirmation, 200)
+ ViewModelProvider(activity)[HomeViewModel::class.java].setShouldPageForward(true)
}
}
}
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 e00013c1b..d50c421a0 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
@@ -206,6 +206,13 @@ class SetupFragment : Fragment() {
)
}
+ homeViewModel.shouldPageForward.observe(viewLifecycleOwner) {
+ if (it) {
+ pageForward()
+ homeViewModel.setShouldPageForward(false)
+ }
+ }
+
binding.viewPager2.apply {
adapter = SetupAdapter(requireActivity() as AppCompatActivity, pages)
offscreenPageLimit = 2
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 263ee7144..e13d84c9c 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
@@ -14,6 +14,9 @@ class HomeViewModel : ViewModel() {
private val _statusBarShadeVisible = MutableLiveData(true)
val statusBarShadeVisible: LiveData<Boolean> get() = _statusBarShadeVisible
+ private val _shouldPageForward = MutableLiveData(false)
+ val shouldPageForward: LiveData<Boolean> get() = _shouldPageForward
+
var navigatedToSetup = false
init {
@@ -33,4 +36,8 @@ class HomeViewModel : ViewModel() {
}
_statusBarShadeVisible.value = visible
}
+
+ fun setShouldPageForward(pageForward: Boolean) {
+ _shouldPageForward.value = pageForward
+ }
}