|
@@ -38,6 +38,7 @@ import androidx.window.layout.WindowLayoutInfo
|
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|
|
import com.google.android.material.slider.Slider
|
|
import com.google.android.material.slider.Slider
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
|
|
+import kotlinx.coroutines.flow.collect
|
|
|
import kotlinx.coroutines.flow.collectLatest
|
|
import kotlinx.coroutines.flow.collectLatest
|
|
|
import kotlinx.coroutines.launch
|
|
import kotlinx.coroutines.launch
|
|
|
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
|
import org.yuzu.yuzu_emu.HomeNavigationDirections
|
|
@@ -184,10 +185,13 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
|
|
|
|
|
override fun onDrawerOpened(drawerView: View) {
|
|
override fun onDrawerOpened(drawerView: View) {
|
|
|
binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
|
|
binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED)
|
|
|
|
|
+ binding.inGameMenu.requestFocus()
|
|
|
|
|
+ emulationViewModel.setDrawerOpen(true)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onDrawerClosed(drawerView: View) {
|
|
override fun onDrawerClosed(drawerView: View) {
|
|
|
binding.drawerLayout.setDrawerLockMode(IntSetting.LOCK_DRAWER.getInt())
|
|
binding.drawerLayout.setDrawerLockMode(IntSetting.LOCK_DRAWER.getInt())
|
|
|
|
|
+ emulationViewModel.setDrawerOpen(false)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onDrawerStateChanged(newState: Int) {
|
|
override fun onDrawerStateChanged(newState: Int) {
|
|
@@ -239,6 +243,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
requireContext().theme
|
|
requireContext().theme
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+ binding.inGameMenu.requestFocus()
|
|
|
true
|
|
true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -247,6 +252,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
null,
|
|
null,
|
|
|
Settings.MenuTag.SECTION_ROOT
|
|
Settings.MenuTag.SECTION_ROOT
|
|
|
)
|
|
)
|
|
|
|
|
+ binding.inGameMenu.requestFocus()
|
|
|
binding.root.findNavController().navigate(action)
|
|
binding.root.findNavController().navigate(action)
|
|
|
true
|
|
true
|
|
|
}
|
|
}
|
|
@@ -256,6 +262,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
args.game,
|
|
args.game,
|
|
|
Settings.MenuTag.SECTION_ROOT
|
|
Settings.MenuTag.SECTION_ROOT
|
|
|
)
|
|
)
|
|
|
|
|
+ binding.inGameMenu.requestFocus()
|
|
|
binding.root.findNavController().navigate(action)
|
|
binding.root.findNavController().navigate(action)
|
|
|
true
|
|
true
|
|
|
}
|
|
}
|
|
@@ -287,6 +294,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ binding.inGameMenu.requestFocus()
|
|
|
NativeConfig.saveGlobalConfig()
|
|
NativeConfig.saveGlobalConfig()
|
|
|
true
|
|
true
|
|
|
}
|
|
}
|
|
@@ -295,7 +303,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
emulationState.stop()
|
|
emulationState.stop()
|
|
|
emulationViewModel.setIsEmulationStopping(true)
|
|
emulationViewModel.setIsEmulationStopping(true)
|
|
|
binding.drawerLayout.close()
|
|
binding.drawerLayout.close()
|
|
|
- binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
|
|
|
|
|
|
+ binding.inGameMenu.requestFocus()
|
|
|
true
|
|
true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -312,12 +320,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
if (!NativeLibrary.isRunning()) {
|
|
if (!NativeLibrary.isRunning()) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if (binding.drawerLayout.isOpen) {
|
|
|
|
|
- binding.drawerLayout.close()
|
|
|
|
|
- } else {
|
|
|
|
|
- binding.drawerLayout.open()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ emulationViewModel.setDrawerOpen(!binding.drawerLayout.isOpen)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
@@ -408,6 +411,18 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ launch {
|
|
|
|
|
+ repeatOnLifecycle(Lifecycle.State.CREATED) {
|
|
|
|
|
+ emulationViewModel.drawerOpen.collect {
|
|
|
|
|
+ if (it) {
|
|
|
|
|
+ binding.drawerLayout.open()
|
|
|
|
|
+ binding.inGameMenu.requestFocus()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ binding.drawerLayout.close()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|