Android: Use AfterDirectoryInitializationRunner more comprehensively

Should fix the crash reported in https://bugs.dolphin-emu.org/issues/12885
This commit is contained in:
JosJuice 2022-04-16 15:04:29 +02:00
parent c5c4169bc8
commit 342af6512c
1 changed files with 13 additions and 8 deletions

View File

@ -26,6 +26,7 @@ import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner;
import org.dolphinemu.dolphinemu.utils.BooleanSupplier;
import org.dolphinemu.dolphinemu.utils.CompletableFuture;
import org.dolphinemu.dolphinemu.utils.ContentHandler;
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
import org.dolphinemu.dolphinemu.utils.ThreadUtil;
import org.dolphinemu.dolphinemu.utils.WiiUtils;
@ -92,7 +93,8 @@ public final class MainPresenter
return true;
case R.id.button_add_directory:
mView.launchFileListActivity();
new AfterDirectoryInitializationRunner().runWithLifecycle(activity, true,
mView::launchFileListActivity);
return true;
case R.id.menu_open_file:
@ -104,7 +106,8 @@ public final class MainPresenter
return true;
case R.id.menu_online_system_update:
launchOnlineUpdate();
new AfterDirectoryInitializationRunner().runWithLifecycle(activity, true,
this::launchOnlineUpdate);
return true;
case R.id.menu_install_wad:
@ -310,18 +313,20 @@ public final class MainPresenter
private void launchWiiSystemMenu()
{
WiiUtils.isSystemMenuInstalled();
if (WiiUtils.isSystemMenuInstalled())
{
EmulationActivity.launchSystemMenu(mActivity);
}
else
{
new AfterDirectoryInitializationRunner().runWithLifecycle(mActivity, true, () ->
{
SystemMenuNotInstalledDialogFragment dialogFragment =
new SystemMenuNotInstalledDialogFragment();
dialogFragment
.show(mActivity.getSupportFragmentManager(), "SystemMenuNotInstalledDialogFragment");
.show(mActivity.getSupportFragmentManager(),
"SystemMenuNotInstalledDialogFragment");
});
}
}
}