update splash closing

This commit is contained in:
Anthony Calosa
2024-10-24 07:30:16 +08:00
parent f06c8c3881
commit 07d2d0a023
2 changed files with 7 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Optional;
public class Main { public class Main {
private static final String versionString = BuildInfo.getVersionString(); private static final String versionString = BuildInfo.getVersionString();
@@ -79,9 +80,11 @@ public class Main {
@Override @Override
public void closeSplashScreen() { public void closeSplashScreen() {
SplashScreen splash = SplashScreen.getSplashScreen(); //could throw exception..
if (splash != null) { try {
splash.close(); Optional.ofNullable(SplashScreen.getSplashScreen()).ifPresent(SplashScreen::close);
} catch (Exception e) {
e.printStackTrace();
} }
} }

View File

@@ -159,7 +159,7 @@ public class Forge implements ApplicationListener {
public void create() { public void create() {
//install our error handler //install our error handler
ExceptionHandler.registerErrorHandling(); ExceptionHandler.registerErrorHandling();
getDeviceAdapter().closeSplashScreen(); FThreads.invokeInEdtLater(() -> getDeviceAdapter().closeSplashScreen());
GuiBase.setIsAndroid(Gdx.app.getType() == Application.ApplicationType.Android); GuiBase.setIsAndroid(Gdx.app.getType() == Application.ApplicationType.Android);