mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 07:09:48 -06:00
Merge pull request #12572 from JosJuice/android-menu-init-guard
Android: Don't check Wii Menu version before directory initialization
This commit is contained in:
@ -47,6 +47,8 @@ class MainActivity : AppCompatActivity(), MainView, OnRefreshListener, ThemeProv
|
|||||||
|
|
||||||
private lateinit var binding: ActivityMainBinding
|
private lateinit var binding: ActivityMainBinding
|
||||||
|
|
||||||
|
private lateinit var menu: Menu
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
installSplashScreen().setKeepOnScreenCondition { !DirectoryInitialization.areDolphinDirectoriesReady() }
|
installSplashScreen().setKeepOnScreenCondition { !DirectoryInitialization.areDolphinDirectoriesReady() }
|
||||||
|
|
||||||
@ -121,15 +123,26 @@ class MainActivity : AppCompatActivity(), MainView, OnRefreshListener, ThemeProv
|
|||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.menu_game_grid, menu)
|
menuInflater.inflate(R.menu.menu_game_grid, menu)
|
||||||
if (WiiUtils.isSystemMenuInstalled()) {
|
this.menu = menu
|
||||||
val resId =
|
|
||||||
if (WiiUtils.isSystemMenuvWii()) R.string.grid_menu_load_vwii_system_menu_installed else R.string.grid_menu_load_wii_system_menu_installed
|
|
||||||
menu.findItem(R.id.menu_load_wii_system_menu).title =
|
|
||||||
getString(resId, WiiUtils.getSystemMenuVersion())
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||||
|
AfterDirectoryInitializationRunner().runWithLifecycle(this) {
|
||||||
|
if (WiiUtils.isSystemMenuInstalled()) {
|
||||||
|
val resId =
|
||||||
|
if (WiiUtils.isSystemMenuvWii()) R.string.grid_menu_load_vwii_system_menu_installed else R.string.grid_menu_load_wii_system_menu_installed
|
||||||
|
|
||||||
|
// If this callback ends up running after another call to onCreateOptionsMenu,
|
||||||
|
// we need to use the new Menu passed to the latest call of onCreateOptionsMenu.
|
||||||
|
// Therefore, we use a field here instead of the onPrepareOptionsMenu argument.
|
||||||
|
this.menu.findItem(R.id.menu_load_wii_system_menu).title =
|
||||||
|
getString(resId, WiiUtils.getSystemMenuVersion())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onPrepareOptionsMenu(menu)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MainView
|
* MainView
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user