UI now scaled correctly; Fix compile errors on SDK 26; Ignore download LWJGL 3

This commit is contained in:
khanhduytran0
2020-07-24 12:51:55 +07:00
parent dfeb505373
commit 65f1de276f
5 changed files with 33 additions and 19 deletions

View File

@@ -41,16 +41,20 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
}
private static int getInternalId(String type, String name) {
for (Class perType : com.android.internal.R.class.getDeclaredClasses()) {
if (perType.getSimpleName().equals(type)) {
try {
Field f = perType.getDeclaredField(name);
f.setAccessible(true);
return f.get(null);
} catch (Throwable th) {
th.printStackTrace();
try {
for (Class perType : Class.forName("com.android.internal.R").getDeclaredClasses()) {
if (perType.getSimpleName().equals(type)) {
try {
Field f = perType.getDeclaredField(name);
f.setAccessible(true);
return f.get(null);
} catch (Throwable th) {
th.printStackTrace();
}
}
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
// If unable to find in com.android.internal.R, go find in android.R

View File

@@ -74,16 +74,20 @@ public abstract class HandleView extends View implements ViewPositionListener, V
}
private int getInternalId(String type, String name) {
for (Class perType : com.android.internal.R.class.getDeclaredClasses()) {
if (perType.getSimpleName().equals(type)) {
try {
Field f = perType.getDeclaredField(name);
f.setAccessible(true);
return f.get(null);
} catch (Throwable th) {
th.printStackTrace();
try {
for (Class perType : Class.forName("com.android.internal.R").getDeclaredClasses()) {
if (perType.getSimpleName().equals(type)) {
try {
Field f = perType.getDeclaredField(name);
f.setAccessible(true);
return f.get(null);
} catch (Throwable th) {
th.printStackTrace();
}
}
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return -1;
}

View File

@@ -533,7 +533,7 @@ public class MCLauncherActivity extends AppCompatActivity
libItem.name.startsWith("com.mojang:realms") ||
libItem.name.startsWith("net.java.jinput") ||
libItem.name.startsWith("net.minecraft.launchwrapper") ||
libItem.name.startsWith("org.lwjgl.lwjgl:lwjgl") ||
libItem.name.startsWith("org.lwjgl") ||
libItem.name.startsWith("tv.twitch")
) { // Black list
publishProgress("1", "Ignored " + libItem.name);

View File

@@ -52,6 +52,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
private int fingerStillThreshold = 8;
private int initialX;
private int initialY;
private boolean mIsResuming = false;
private static final int MSG_LEFT_MOUSE_BUTTON_CHECK = 1028;
private static final int MSG_DROP_ITEM_BUTTON_CHECK = 1029;
private static boolean triggeredLeftMouseButton = false;
@@ -614,7 +615,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
glSurfaceView.setOnHoverListener(new View.OnHoverListener(){
@Override
public boolean onHover(View p1, MotionEvent p2) {
if (!AndroidDisplay.grab && isResumed()) {
if (!AndroidDisplay.grab && mIsResuming) {
return glTouchListener.onTouch(p1, p2);
}
return true;
@@ -724,6 +725,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
@Override
public void onResume() {
super.onResume();
mIsResuming = true;
glSurfaceView.requestRender();
}
@@ -743,6 +745,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
if (AndroidDisplay.grab){
sendKeyPress(Keyboard.KEY_ESCAPE);
}
mIsResuming = false;
super.onPause();
}
@@ -1070,10 +1073,12 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
private void openLogOutput() {
contentLog.setVisibility(View.VISIBLE);
mIsResuming = false;
}
public void closeLogOutput(View view) {
contentLog.setVisibility(View.GONE);
mIsResuming = true;
}
/*
private void openCanvasOutput() {