Merge pull request #799 from serpentspirale/Cleaning_spree_P2

Cleaning part 2 I guess
This commit is contained in:
ArtDev 2021-02-04 20:39:40 +03:00 committed by GitHub
commit f000a0209e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 14 additions and 188 deletions

View File

@ -2,8 +2,6 @@ package com.kdt.mcgui;
import android.content.*;
import android.util.*;
import android.widget.*;
import net.kdt.pojavlaunch.*;
import android.graphics.*;
public class MineEditText extends com.google.android.material.textfield.TextInputEditText
@ -22,7 +20,6 @@ public class MineEditText extends com.google.android.material.textfield.TextInpu
public void init()
{
// setBackgroundResource(R.drawable.border_edittext);
setBackgroundColor(Color.parseColor("#131313"));
setPadding(5, 5, 5, 5);
}

View File

@ -62,8 +62,6 @@ public class FileListView extends LinearLayout
mainLv = new ListView(context);
//listFileAt(Environment.getExternalStorageDirectory().getPath());
mainLv.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> p1, View p2, int p3, long p4)
@ -110,7 +108,6 @@ public class FileListView extends LinearLayout
File[] listFile = mainPath.listFiles();
FileListAdapter fileAdapter = new FileListAdapter(context);
if(!path.equals(lockPath)){
//fileAdapter.add(new File(path, "Path=\""+path+"\".noEquals(homePath=\""+homePath+"\")"));
fileAdapter.add(new File(path, ".."));
}

View File

@ -172,13 +172,6 @@ public class AndroidLWJGLKeycode {
CallbackBridge.holdingShift = keyEvent.isShiftPressed();
try {
/*
if (keyEvent.isPrintingKey()) {
BaseMainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()), (char) keyEvent.getUnicodeChar(keyEvent.getMetaState()), keyEvent.getScanCode(), CallbackBridge.getCurrentMods(), isDown);
} else if ((int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN) {
BaseMainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()), keyEvent.getDisplayLabel(), keyEvent.getScanCode(), CallbackBridge.getCurrentMods(), isDown);
}
*/
//System.out.println(((int)keyEvent.getDisplayLabel()) + " " +keyEvent.getDisplayLabel());
if(keyEvent.getUnicodeChar() != 0) {
char key = (char)keyEvent.getUnicodeChar();
@ -189,10 +182,6 @@ public class AndroidLWJGLKeycode {
} catch (Throwable th) {
th.printStackTrace();
}
//if (isBackspaceAfterChar && (int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && !CallbackBridge.isGrabbing() && i != KeyEvent.KEYCODE_DEL) {
// BaseMainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE, 0, isDown);
//}
}
public static void execKeyIndex(BaseMainActivity mainActivity, int index) {

View File

@ -238,7 +238,6 @@ public abstract class BaseLauncherActivity extends BaseActivity {
} /*else throw new Exception();*/
} catch(Throwable e) {
e.printStackTrace();
// selectTabPage(tabLayout.getSelectedTabPosition());
}
System.out.println("call to onResumeFragments; E");
}

View File

@ -3,7 +3,6 @@ package net.kdt.pojavlaunch;
import android.content.*;
import android.os.*;
import androidx.core.widget.*;
import androidx.appcompat.app.*;
import androidx.preference.*;
import android.view.*;

View File

@ -3,7 +3,6 @@ package net.kdt.pojavlaunch;
import android.content.*;
import android.net.*;
import androidx.browser.customtabs.*;
// import androidx.browser.customtabs.*;
public class CustomTabs {

View File

@ -1,6 +1,5 @@
package net.kdt.pojavlaunch;
import android.content.res.*;
import android.graphics.*;
import android.view.*;
import android.widget.*;

View File

@ -18,7 +18,6 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.TextureView;
import android.view.View;
import android.view.View.*;
public class GLTextureView
extends TextureView

View File

@ -4,5 +4,4 @@ public class JAssetInfo
{
public String hash;
public int size;
//public String objects;
}

View File

@ -1,6 +1,5 @@
package net.kdt.pojavlaunch;
import androidx.appcompat.app.*;
public abstract class LoggableActivity extends BaseActivity {
public void appendToLog(String text) {

View File

@ -1,11 +1,6 @@
package net.kdt.pojavlaunch;
import android.app.*;
import android.content.*;
import android.util.*;
import android.view.*;
import java.io.*;
import net.kdt.pojavlaunch.authenticator.mojang.*;
import java.io.*;;
/**
* This account data format is deprecated.
@ -26,7 +21,6 @@ public class MCProfile
public static MCProfile.Builder load(String pofFilePath) {
try {
//String th = new String(new byte[]{-128});
String pofContent = Tools.read(pofFilePath);
return parse(pofContent);
} catch (Exception e) {

View File

@ -2,8 +2,6 @@ package net.kdt.pojavlaunch;
import android.os.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import androidx.annotation.Nullable;
@ -13,7 +11,6 @@ import net.kdt.pojavlaunch.utils.MCOptionUtils;
import org.lwjgl.glfw.*;
import java.io.*;
import com.google.gson.*;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.DEFAULT_PREF;

View File

@ -63,7 +63,6 @@ class MinecraftInputConnection extends BaseInputConnection {
}
public boolean commitText(CharSequence text, int newCursorPosition) {
//parent.sendKeyPress(text.charAt(0));
for(int i = 0; i < text.length(); i++) parent.sendKeyPress(text.charAt(i));
return true;
}

View File

@ -113,28 +113,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
pickAccount();
/*
File logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
if (logFile.exists() && logFile.length() < 20480) {
String errMsg = "Error occurred during initialization of ";
try {
String logContent = Tools.read(logFile.getAbsolutePath());
if (logContent.contains(errMsg + "VM") &&
logContent.contains("Could not reserve enough space for")) {
OutOfMemoryError ex = new OutOfMemoryError("Java error: " + logContent);
ex.setStackTrace(null);
Tools.showError(PojavLauncherActivity.this, ex);
// Do it so dialog will not shown for second time
Tools.write(logFile.getAbsolutePath(), logContent.replace(errMsg + "VM", errMsg + "JVM"));
}
} catch (Throwable th) {
Log.w(Tools.APP_NAME, "Could not detect java crash", th);
}
}
*/
//showProfileInfo();
final List<String> accountList = new ArrayList<String>();
final MinecraftAccount tempProfile = PojavProfile.getTempProfileContent(this);

View File

@ -10,7 +10,6 @@ import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
@ -91,7 +90,7 @@ public class PojavLoginActivity extends BaseActivity
private static boolean isSkipInit = false;
// private final String PREF_IS_DONOTSHOWAGAIN_WARN = "isWarnDoNotShowAgain";
public static final String PREF_IS_INSTALLED_JAVARUNTIME = "isJavaRuntimeInstalled";
public static final String PREF_JAVARUNTIME_VER = "javaRuntimeVersion";
@ -100,12 +99,7 @@ public class PojavLoginActivity extends BaseActivity
super.onCreate(savedInstanceState); // false);
Tools.updateWindowSize(this);
/*
ControlData.pixelOf2dp = (int) Tools.dpToPx(2);
ControlData.pixelOf30dp = (int) Tools.dpToPx(30);
ControlData.pixelOf50dp = (int) Tools.dpToPx(50);
ControlData.pixelOf80dp = (int) Tools.dpToPx(80);
*/
ControlData[] specialButtons = ControlData.getSpecialButtons();
specialButtons[0].name = getString(R.string.control_keyboard);
specialButtons[1].name = getString(R.string.control_toggle);
@ -122,7 +116,6 @@ public class PojavLoginActivity extends BaseActivity
private ProgressBar progress;
private ProgressBar progressSpin;
// private EditText progressLog;
private AlertDialog progDlg;
@Override
@ -135,7 +128,7 @@ public class PojavLoginActivity extends BaseActivity
progress = (ProgressBar) startScr.findViewById(R.id.startscreenProgress);
startupTextView = (TextView) startScr.findViewById(R.id.startscreen_text);
//startScr.addView(progress);
AlertDialog.Builder startDlg = new AlertDialog.Builder(PojavLoginActivity.this, R.style.AppTheme);
startDlg.setView(startScr);
@ -196,9 +189,7 @@ public class PojavLoginActivity extends BaseActivity
{
if (obj[0].equals("visible")) {
progress.setVisibility(View.VISIBLE);
} /* else if (obj.length == 2 && obj[1] != null) {
progressLog.append(obj[1]);
} */
}
}
@Override
@ -208,9 +199,7 @@ public class PojavLoginActivity extends BaseActivity
if (obj == 0) {
if (progDlg != null) progDlg.dismiss();
uiInit();
} /* else if (progressLog != null) {
progressLog.setText(getResources().getString(R.string.error_checklog, "\n\n" + progressLog.getText()));
} */
}
}
}
@ -598,32 +587,18 @@ public class PojavLoginActivity extends BaseActivity
} catch (Throwable e) {
e.printStackTrace();
}
// unpackShell.writeToProcess("ln -s " + tarEntry.getName() + " " + tarEntry.getLinkName());
} else if (tarEntry.isDirectory()) {
destPath.mkdirs();
destPath.setExecutable(true);
} else if (!destPath.exists() || destPath.length() != tarEntry.getSize()) {
destPath.getParentFile().mkdirs();
destPath.createNewFile();
// destPath.setExecutable(true);
FileOutputStream os = new FileOutputStream(destPath);
IOUtils.copy(tarIn, os);
os.close();
/*
byte[] btoRead = new byte[2048];
BufferedOutputStream bout =
new BufferedOutputStream(new FileOutputStream(destPath));
int len = 0;
while((len = tarIn.read(btoRead)) != -1) {
bout.write(btoRead,0,len);
}
bout.close();
btoRead = null;
*/
}
tarEntry = tarIn.getNextTarEntry();
}
@ -638,23 +613,7 @@ public class PojavLoginActivity extends BaseActivity
return file.mkdir();
else return file.mkdirs();
}
/*
public void loginUsername(View view)
{
LinearLayout mainLaun = new LinearLayout(this);
LayoutInflater.from(this).inflate(R.layout.launcher_user, mainLaun, true);
replaceFonts(mainLaun);
//edit1 = mainLaun.findViewById(R.id.launcherAccUsername);
new AlertDialog.Builder(this)
.setTitle("Register with username")
.setView(mainLaun)
.show();
}
*/
public void loginMicrosoft(View view) {
CustomTabs.openTab(this,
@ -852,11 +811,6 @@ public class PojavLoginActivity extends BaseActivity
private MinecraftAccount mProfile = null;
public void loginMC(final View v)
{
/*skip it
String proFilePath = MCProfile.build(builder);
MCProfile.launchWithProfile(this, proFilePath);
end skip*/
if (sOffline.isChecked()) {
mProfile = loginOffline();

View File

@ -14,15 +14,6 @@ import org.json.*;
public class Msa {
/*
private static final String loginUrl = "https://login.live.com/oauth20_authorize.srf" +
"?client_id=00000000402b5328" +
"&response_type=code" +
"&scope=service%3A%3Auser.auth.xboxlive.com%3A%3AMBI_SSL" +
"&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf";
private static final String redirectUrlSuffix = "https://login.live.com/oauth20_desktop.srf?code=";
*/
private static final String authTokenUrl = "https://login.live.com/oauth20_token.srf";
private static final String xblAuthUrl = "https://user.auth.xboxlive.com/user/authenticate";
private static final String xstsAuthUrl = "https://xsts.auth.xboxlive.com/xsts/authorize";
@ -49,7 +40,8 @@ public class Msa {
URL url = new URL(authTokenUrl);
Log.i("MicroAuth", "isRefresh=" + isRefresh + ", authCode= "+authcode);
Map<Object, Object> data = new HashMap<>();/*Map.of(
Map<Object, Object> data = new HashMap<>();
/*Map.of(
"client_id", "00000000402b5328",
"code", authcode,
"grant_type", "authorization_code",
@ -232,18 +224,6 @@ public class Msa {
}else{
throwResponseError(conn);
}
/*
HttpRequest request = HttpRequest.newBuilder(uri)
.header("Authorization", "Bearer " + mcAccessToken)
.GET().build();
HttpClient.newBuilder().build().sendAsync(request, HttpResponse.BodyHandlers.ofString()).thenAccept(resp -> {
if (resp.statusCode() >= 200 && resp.statusCode() < 300) {
String body = resp.body();
Log.i("MicroAuth","store: " + body);
}
});
*/
}
private void checkMcProfile(String mcAccessToken) throws IOException, JSONException {

View File

@ -45,9 +45,6 @@ public class RefreshTokenTask extends AsyncTask<String, Void, Throwable> {
if (responseCode == 403) {
RefreshResponse response = this.authenticator.refresh(profilePath.accessToken, UUID.fromString(profilePath.clientToken));
// if (response == null) {
// throw new NullPointerException("Response is null?");
// }
if (response == null) {
// Refresh when offline?
return null;

View File

@ -3,7 +3,6 @@ package net.kdt.pojavlaunch.fragments;
import android.os.*;
import androidx.annotation.Nullable;
import androidx.core.app.*;
import android.view.*;
import android.widget.*;
@ -27,37 +26,7 @@ public class ConsoleFragment extends Fragment
return view;
}
@Override
public void onActivityCreated(Bundle p1)
{
super.onActivityCreated(p1);
/*
new Thread(new Runnable(){
@Override
public void run()
{
while (true) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
final String popLog = ConsoleFragmentHelper.popLog();
if (!popLog.isEmpty()) {
getActivity().runOnUiThread(new Runnable(){
@Override
public void run()
{
consoleView.append(popLog);
System.out.println("OKAY? " + popLog);
}
});
}
}
}
}).start();
*/
}
@Override
public void onResume()

View File

@ -3,15 +3,12 @@ package net.kdt.pojavlaunch.fragments;
import android.os.*;
import androidx.annotation.Nullable;
import androidx.core.app.*;
import android.view.*;
import android.widget.*;
import java.io.*;
import net.kdt.pojavlaunch.*;
import android.graphics.*;
import androidx.core.os.*;
import androidx.fragment.app.Fragment;
public class CrashFragment extends Fragment
@ -43,8 +40,7 @@ public class CrashFragment extends Fragment
crashView = (TextView) getView().findViewById(R.id.lmaintabconsoleLogCrashTextView);
crashView.setTypeface(Typeface.MONOSPACE);
crashView.setHint(this.getText(R.string.main_nocrash));
//new File(crashPath).mkdirs();
}
@Override

View File

@ -1,14 +1,8 @@
package net.kdt.pojavlaunch.installers;
import android.content.*;
import java.io.*;
import java.util.jar.*;
import net.kdt.pojavlaunch.*;
import java.nio.charset.*;
import net.kdt.pojavlaunch.value.*;
import org.apache.commons.io.*;
import com.google.gson.*;
import java.util.zip.*;
public class FabricInstaller extends BaseInstaller {
public FabricInstaller(BaseInstaller i) {

View File

@ -1,14 +1,8 @@
package net.kdt.pojavlaunch.installers;
import android.content.*;
import java.io.*;
import java.util.jar.*;
import net.kdt.pojavlaunch.*;
import java.nio.charset.*;
import net.kdt.pojavlaunch.value.*;
import org.apache.commons.io.*;
import com.google.gson.*;
import java.util.zip.*;
public class LegacyOptifineInstaller extends BaseInstaller {
public LegacyOptifineInstaller(BaseInstaller i) {

View File

@ -1,7 +1,6 @@
package net.kdt.pojavlaunch.prefs;
import android.content.*;
import java.util.*;
import net.kdt.pojavlaunch.*;
public class LauncherPreferences

View File

@ -4,9 +4,7 @@ import android.util.Log;
import net.kdt.pojavlaunch.*;
import java.io.*;
import com.google.gson.*;
import android.os.Environment;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;
public class MinecraftAccount