diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java index 5e07928e14..c65aa58add 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/PojavApplication.java @@ -19,6 +19,7 @@ import java.util.concurrent.TimeUnit; import net.kdt.pojavlaunch.lifecycle.ContextExecutor; +import net.kdt.pojavlaunch.prefs.LauncherPreferences; import net.kdt.pojavlaunch.tasks.AsyncAssetManager; import net.kdt.pojavlaunch.utils.*; import net.kdt.pojavlaunch.utils.FileUtils; @@ -57,7 +58,15 @@ public void onCreate() { try { super.onCreate(); - Tools.initEarlyConstants(this); + if(Tools.checkStorageRoot(this)){ + // Implicitly initializes early constants and storage constants. + // Required to run the main activity properly. + LauncherPreferences.loadPreferences(this); + } else { + // In other cases, only initialize enough for the basicmost basics to work + // and not explode. + Tools.initEarlyConstants(this); + } Tools.DEVICE_ARCHITECTURE = Architecture.getDeviceArchitecture(); //Force x86 lib directory for Asus x86 based zenfones if(Architecture.isx86Device() && Architecture.is32BitsDevice()){ diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/TestStorageActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/TestStorageActivity.java index 54726f42f3..9096a44b2a 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/TestStorageActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/TestStorageActivity.java @@ -14,6 +14,7 @@ import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; +import net.kdt.pojavlaunch.prefs.LauncherPreferences; import net.kdt.pojavlaunch.tasks.AsyncAssetManager; public class TestStorageActivity extends Activity { @@ -60,8 +61,8 @@ private void exit() { startActivity(new Intent(this, MissingStorageActivity.class)); return; } - //Initialize constants after we confirm that we have storage. - Tools.initStorageConstants(getApplicationContext()); + //Initialize constants (implicitly) and preferences after we confirm that we have storage. + LauncherPreferences.loadPreferences(this); AsyncAssetManager.unpackComponents(this); AsyncAssetManager.unpackSingleFiles(this);