Android: Update Load Wii System Menu string in onPrepareOptionsMenu

Because the wording of the Load Wii System Menu string can change
depending on the contents of the NAND, we should update that menu item in
a method that's guaranteed to get called every time the user opens the
menu rather than one that's only guaranteed to be called once.
This commit is contained in:
JosJuice 2024-02-11 10:58:42 +01:00
parent a50ab40a5f
commit 48ae529762

View File

@ -121,13 +121,17 @@ class MainActivity : AppCompatActivity(), MainView, OnRefreshListener, ThemeProv
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_game_grid, menu)
return true
}
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
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
menu.findItem(R.id.menu_load_wii_system_menu).title =
getString(resId, WiiUtils.getSystemMenuVersion())
}
return true
return super.onPrepareOptionsMenu(menu)
}
/**