mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 05:20:14 -07:00
BaseMainActivity now uses a loggerView
This commit is contained in:
parent
f0a8448ac2
commit
9e3d5532ef
2 changed files with 13 additions and 51 deletions
|
|
@ -18,14 +18,14 @@ import android.widget.*;
|
||||||
|
|
||||||
import androidx.drawerlayout.widget.*;
|
import androidx.drawerlayout.widget.*;
|
||||||
import com.google.android.material.navigation.*;
|
import com.google.android.material.navigation.*;
|
||||||
|
import com.kdt.LoggerView;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import net.kdt.pojavlaunch.customcontrols.*;
|
import net.kdt.pojavlaunch.customcontrols.*;
|
||||||
|
|
||||||
import net.kdt.pojavlaunch.multirt.MultiRTUtils;
|
import net.kdt.pojavlaunch.multirt.MultiRTUtils;
|
||||||
|
|
||||||
import net.kdt.pojavlaunch.customcontrols.gamepad.Gamepad;
|
|
||||||
|
|
||||||
import net.kdt.pojavlaunch.prefs.*;
|
import net.kdt.pojavlaunch.prefs.*;
|
||||||
import net.kdt.pojavlaunch.utils.*;
|
import net.kdt.pojavlaunch.utils.*;
|
||||||
import net.kdt.pojavlaunch.value.*;
|
import net.kdt.pojavlaunch.value.*;
|
||||||
|
|
@ -38,47 +38,33 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
volatile public static boolean isInputStackCall;
|
volatile public static boolean isInputStackCall;
|
||||||
|
|
||||||
public float scaleFactor = 1;
|
public float scaleFactor = 1;
|
||||||
public double sensitivityFactor;
|
|
||||||
|
|
||||||
private boolean mIsResuming = false;
|
private boolean mIsResuming = false;
|
||||||
|
|
||||||
private MinecraftGLView minecraftGLView;
|
private MinecraftGLView minecraftGLView;
|
||||||
|
|
||||||
private static Touchpad touchpad;
|
private static Touchpad touchpad;
|
||||||
|
private LoggerView loggerView;
|
||||||
|
|
||||||
private MinecraftAccount mProfile;
|
private MinecraftAccount mProfile;
|
||||||
|
|
||||||
private DrawerLayout drawerLayout;
|
private DrawerLayout drawerLayout;
|
||||||
private NavigationView navDrawer;
|
private NavigationView navDrawer;
|
||||||
|
|
||||||
private LinearLayout contentLog;
|
|
||||||
private TextView textLog;
|
|
||||||
private ScrollView contentScroll;
|
|
||||||
private ToggleButton toggleLog;
|
|
||||||
|
|
||||||
|
|
||||||
private NavigationView.OnNavigationItemSelectedListener gameActionListener;
|
private NavigationView.OnNavigationItemSelectedListener gameActionListener;
|
||||||
public NavigationView.OnNavigationItemSelectedListener ingameControlsEditorListener;
|
public NavigationView.OnNavigationItemSelectedListener ingameControlsEditorListener;
|
||||||
|
|
||||||
protected volatile JMinecraftVersionList.Version mVersionInfo;
|
protected volatile JMinecraftVersionList.Version mVersionInfo;
|
||||||
|
|
||||||
private PerVersionConfig.VersionConfig config;
|
private PerVersionConfig.VersionConfig config;
|
||||||
private boolean isLogAllow = false;
|
|
||||||
|
|
||||||
public volatile float mouse_x, mouse_y;
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void initLayout(int resId) {
|
protected void initLayout(int resId) {
|
||||||
setContentView(resId);
|
setContentView(resId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// FIXME: is it safe fot multi thread?
|
// FIXME: is it safe fot multi thread?
|
||||||
GLOBAL_CLIPBOARD = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
GLOBAL_CLIPBOARD = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||||
touchCharInput = findViewById(R.id.editTextTextPersonName2);
|
touchCharInput = findViewById(R.id.mainTouchCharInput);
|
||||||
|
loggerView = findViewById(R.id.mainLoggerView);
|
||||||
|
|
||||||
mProfile = PojavProfile.getCurrentProfileContent(this);
|
mProfile = PojavProfile.getCurrentProfileContent(this);
|
||||||
mVersionInfo = Tools.getVersionInfo(null,mProfile.selectedVersion);
|
mVersionInfo = Tools.getVersionInfo(null,mProfile.selectedVersion);
|
||||||
|
|
@ -102,7 +88,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
isInputStackCall = mVersionInfo.arguments != null;
|
isInputStackCall = mVersionInfo.arguments != null;
|
||||||
|
|
||||||
Tools.getDisplayMetrics(this);
|
Tools.getDisplayMetrics(this);
|
||||||
sensitivityFactor = 1.4 * (1080f/ currentDisplayMetrics.heightPixels);
|
|
||||||
windowWidth = Tools.getDisplayFriendlyRes(currentDisplayMetrics.widthPixels, scaleFactor);
|
windowWidth = Tools.getDisplayFriendlyRes(currentDisplayMetrics.widthPixels, scaleFactor);
|
||||||
windowHeight = Tools.getDisplayFriendlyRes(currentDisplayMetrics.heightPixels, scaleFactor);
|
windowHeight = Tools.getDisplayFriendlyRes(currentDisplayMetrics.heightPixels, scaleFactor);
|
||||||
System.out.println("WidthHeight: " + windowWidth + ":" + windowHeight);
|
System.out.println("WidthHeight: " + windowWidth + ":" + windowHeight);
|
||||||
|
|
@ -135,18 +120,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
|
|
||||||
touchpad = findViewById(R.id.main_touchpad);
|
touchpad = findViewById(R.id.main_touchpad);
|
||||||
|
|
||||||
this.contentLog = findViewById(R.id.content_log_layout);
|
|
||||||
this.contentScroll = findViewById(R.id.content_log_scroll);
|
|
||||||
this.textLog = (TextView) contentScroll.getChildAt(0);
|
|
||||||
this.toggleLog = findViewById(R.id.content_log_toggle_log);
|
|
||||||
this.toggleLog.setChecked(false);
|
|
||||||
|
|
||||||
this.textLog.setTypeface(Typeface.MONOSPACE);
|
|
||||||
this.toggleLog.setOnCheckedChangeListener((button, isChecked) -> {
|
|
||||||
isLogAllow = isChecked;
|
|
||||||
Logger.getInstance().appendToLog("");
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
this.minecraftGLView = findViewById(R.id.main_game_render_view);
|
this.minecraftGLView = findViewById(R.id.main_game_render_view);
|
||||||
this.drawerLayout.closeDrawers();
|
this.drawerLayout.closeDrawers();
|
||||||
|
|
@ -193,12 +166,11 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runCraft() throws Throwable {
|
private void runCraft() throws Throwable {
|
||||||
Logger logger = Logger.getInstance();
|
|
||||||
if(Tools.LOCAL_RENDERER == null) {
|
if(Tools.LOCAL_RENDERER == null) {
|
||||||
Tools.LOCAL_RENDERER = LauncherPreferences.PREF_RENDERER;
|
Tools.LOCAL_RENDERER = LauncherPreferences.PREF_RENDERER;
|
||||||
}
|
}
|
||||||
logger.appendToLog("--------- beggining with launcher debug");
|
Logger.getInstance().appendToLog("--------- beggining with launcher debug");
|
||||||
logger.appendToLog("Info: Launcher version: " + BuildConfig.VERSION_NAME);
|
Logger.getInstance().appendToLog("Info: Launcher version: " + BuildConfig.VERSION_NAME);
|
||||||
if (Tools.LOCAL_RENDERER.equals("vulkan_zink")) {
|
if (Tools.LOCAL_RENDERER.equals("vulkan_zink")) {
|
||||||
checkVulkanZinkIsSupported();
|
checkVulkanZinkIsSupported();
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +181,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
checkJavaArgsIsLaunchable(jreReleaseList.get("JAVA_VERSION"));
|
checkJavaArgsIsLaunchable(jreReleaseList.get("JAVA_VERSION"));
|
||||||
// appendlnToLog("Info: Custom Java arguments: \"" + LauncherPreferences.PREF_CUSTOM_JAVA_ARGS + "\"");
|
// appendlnToLog("Info: Custom Java arguments: \"" + LauncherPreferences.PREF_CUSTOM_JAVA_ARGS + "\"");
|
||||||
|
|
||||||
logger.appendToLog("Info: Selected Minecraft version: " + mVersionInfo.id +
|
Logger.getInstance().appendToLog("Info: Selected Minecraft version: " + mVersionInfo.id +
|
||||||
((mVersionInfo.inheritsFrom == null || mVersionInfo.inheritsFrom.equals(mVersionInfo.id)) ?
|
((mVersionInfo.inheritsFrom == null || mVersionInfo.inheritsFrom.equals(mVersionInfo.id)) ?
|
||||||
"" : " (" + mVersionInfo.inheritsFrom + ")"));
|
"" : " (" + mVersionInfo.inheritsFrom + ")"));
|
||||||
|
|
||||||
|
|
@ -298,26 +270,15 @@ public class BaseMainActivity extends LoggableActivity {
|
||||||
isInEditor = false;
|
isInEditor = false;
|
||||||
}
|
}
|
||||||
private void openLogOutput() {
|
private void openLogOutput() {
|
||||||
contentLog.setVisibility(View.VISIBLE);
|
loggerView.setVisibility(View.VISIBLE);
|
||||||
mIsResuming = false;
|
mIsResuming = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeLogOutput(View view) {
|
public void closeLogOutput(View view) {
|
||||||
contentLog.setVisibility(View.GONE);
|
loggerView.setVisibility(View.GONE);
|
||||||
mIsResuming = true;
|
mIsResuming = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void brokenNameOnPurpose(final String text, boolean checkAllow) {
|
|
||||||
|
|
||||||
if (checkAllow && !isLogAllow) return;
|
|
||||||
textLog.post(() -> {
|
|
||||||
textLog.append(text);
|
|
||||||
contentScroll.fullScroll(ScrollView.FOCUS_DOWN);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void toggleMenu(View v) {
|
public void toggleMenu(View v) {
|
||||||
drawerLayout.openDrawer(Gravity.RIGHT);
|
drawerLayout.openDrawer(Gravity.RIGHT);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
|
|
||||||
<net.kdt.pojavlaunch.customcontrols.TouchCharInput
|
<net.kdt.pojavlaunch.customcontrols.TouchCharInput
|
||||||
android:id="@+id/editTextTextPersonName2"
|
android:id="@+id/mainTouchCharInput"
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="@android:color/darker_gray"
|
android:background="@android:color/darker_gray"
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
</net.kdt.pojavlaunch.customcontrols.ControlLayout>
|
</net.kdt.pojavlaunch.customcontrols.ControlLayout>
|
||||||
|
|
||||||
<com.kdt.LoggerView
|
<com.kdt.LoggerView
|
||||||
|
android:id="@+id/mainLoggerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue