mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-21 09:01:56 -07:00
Finally removed the LoggableActivity
This commit is contained in:
parent
636fc0f9ed
commit
d5437659d0
5 changed files with 15 additions and 23 deletions
|
|
@ -31,7 +31,7 @@ import net.kdt.pojavlaunch.utils.*;
|
|||
import net.kdt.pojavlaunch.value.*;
|
||||
import org.lwjgl.glfw.*;
|
||||
|
||||
public class BaseMainActivity extends LoggableActivity {
|
||||
public class BaseMainActivity extends BaseActivity {
|
||||
public static volatile ClipboardManager GLOBAL_CLIPBOARD;
|
||||
public static TouchCharInput touchCharInput;
|
||||
|
||||
|
|
@ -176,9 +176,9 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
}
|
||||
checkLWJGL3Installed();
|
||||
|
||||
jreReleaseList = JREUtils.readJREReleaseProperties();
|
||||
JREUtils.checkJavaArchitecture(this, jreReleaseList.get("OS_ARCH"));
|
||||
checkJavaArgsIsLaunchable(jreReleaseList.get("JAVA_VERSION"));
|
||||
JREUtils.jreReleaseList = JREUtils.readJREReleaseProperties();
|
||||
JREUtils.checkJavaArchitecture(this, JREUtils.jreReleaseList.get("OS_ARCH"));
|
||||
checkJavaArgsIsLaunchable(JREUtils.jreReleaseList.get("JAVA_VERSION"));
|
||||
// appendlnToLog("Info: Custom Java arguments: \"" + LauncherPreferences.PREF_CUSTOM_JAVA_ARGS + "\"");
|
||||
|
||||
Logger.getInstance().appendToLog("Info: Selected Minecraft version: " + mVersionInfo.id +
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import static net.kdt.pojavlaunch.utils.MathUtils.map;
|
|||
|
||||
import com.kdt.LoggerView;
|
||||
|
||||
public class JavaGUILauncherActivity extends LoggableActivity implements View.OnTouchListener {
|
||||
public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouchListener {
|
||||
private static final int MSG_LEFT_MOUSE_BUTTON_CHECK = 1028;
|
||||
|
||||
private AWTCanvasView mTextureView;
|
||||
|
|
@ -279,11 +279,11 @@ public class JavaGUILauncherActivity extends LoggableActivity implements View.On
|
|||
public int launchJavaRuntime(File modFile, String javaArgs) {
|
||||
JREUtils.redirectAndPrintJRELog(this);
|
||||
try {
|
||||
jreReleaseList = JREUtils.readJREReleaseProperties();
|
||||
JREUtils.jreReleaseList = JREUtils.readJREReleaseProperties();
|
||||
|
||||
// Fail immediately when Java 8 is not selected
|
||||
// TODO: auto override Java 8 if installed
|
||||
if (!jreReleaseList.get("JAVA_VERSION").equals("1.8.0")) {
|
||||
if (!JREUtils.jreReleaseList.get("JAVA_VERSION").equals("1.8.0")) {
|
||||
throw new RuntimeException("Cannot use the mod installer. In order to use the mod installer, you need to install Java 8 and specify it in the Preferences menu.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
package net.kdt.pojavlaunch;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class LoggableActivity extends BaseActivity {
|
||||
// TODO WE STILL HAVE TO MOVE THIS SHIT ELSEWHERE
|
||||
// Who the fuck thought it was a good idea to put the runtimelist inside a log activity :drunkdev:
|
||||
public Map<String, String> jreReleaseList;
|
||||
}
|
||||
|
|
@ -99,14 +99,14 @@ public final class Tools {
|
|||
}
|
||||
|
||||
|
||||
public static void launchMinecraft(final LoggableActivity ctx, MinecraftAccount profile, String versionName) throws Throwable {
|
||||
public static void launchMinecraft(final Activity activity, MinecraftAccount profile, String versionName) throws Throwable {
|
||||
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
||||
((ActivityManager)ctx.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(mi);
|
||||
((ActivityManager)activity.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(mi);
|
||||
if(LauncherPreferences.PREF_RAM_ALLOCATION > (mi.availMem/1048576L)) {
|
||||
Object memoryErrorLock = new Object();
|
||||
ctx.runOnUiThread(() -> {
|
||||
androidx.appcompat.app.AlertDialog.Builder b = new androidx.appcompat.app.AlertDialog.Builder(ctx)
|
||||
.setMessage(ctx.getString(R.string.memory_warning_msg,(mi.availMem/1048576L),LauncherPreferences.PREF_RAM_ALLOCATION))
|
||||
activity.runOnUiThread(() -> {
|
||||
androidx.appcompat.app.AlertDialog.Builder b = new androidx.appcompat.app.AlertDialog.Builder(activity)
|
||||
.setMessage(activity.getString(R.string.memory_warning_msg,(mi.availMem/1048576L),LauncherPreferences.PREF_RAM_ALLOCATION))
|
||||
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {synchronized(memoryErrorLock){memoryErrorLock.notifyAll();}})
|
||||
.setOnCancelListener((i) -> {synchronized(memoryErrorLock){memoryErrorLock.notifyAll();}});
|
||||
b.show();
|
||||
|
|
@ -134,7 +134,7 @@ public final class Tools {
|
|||
List<String> javaArgList = new ArrayList<String>();
|
||||
|
||||
// Only Java 8 supports headful AWT for now
|
||||
if (ctx.jreReleaseList.get("JAVA_VERSION").equals("1.8.0")) {
|
||||
if (JREUtils.jreReleaseList.get("JAVA_VERSION").equals("1.8.0")) {
|
||||
getCacioJavaArgs(javaArgList, false);
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ public final class Tools {
|
|||
javaArgList.add(versionInfo.mainClass);
|
||||
javaArgList.addAll(Arrays.asList(launchArgs));
|
||||
// ctx.appendlnToLog("full args: "+javaArgList.toString());
|
||||
JREUtils.launchJavaVM(ctx, javaArgList);
|
||||
JREUtils.launchJavaVM(activity, javaArgList);
|
||||
}
|
||||
|
||||
public static void getCacioJavaArgs(List<String> javaArgList, boolean isHeadless) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public class JREUtils {
|
|||
|
||||
public static String LD_LIBRARY_PATH;
|
||||
private static String nativeLibDir;
|
||||
public static Map<String, String> jreReleaseList;
|
||||
|
||||
/**
|
||||
* Checks if the java architecture is correct for the device architecture.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue