mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-12 22:26:56 -04:00
Refactor[gen]: other minor refactors
This commit is contained in:
parent
1151e7fcd2
commit
d8ed111b10
@ -307,7 +307,7 @@ public class mcAccountSpinner extends AppCompatSpinner implements AdapterView.On
|
||||
if(view != null){
|
||||
Bitmap bitmap = mSelectecAccount.getSkinFace();
|
||||
if(bitmap != null) {
|
||||
mHeadDrawable = new BitmapDrawable(bitmap);
|
||||
mHeadDrawable = new BitmapDrawable(getResources(), bitmap);
|
||||
mHeadDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
|
||||
view.setCompoundDrawables(mHeadDrawable, null, null, null);
|
||||
|
@ -39,7 +39,6 @@ import fr.spse.extended_view.ExtendedTextView;
|
||||
*/
|
||||
public class mcVersionSpinner extends ExtendedTextView {
|
||||
private static final int VERSION_SPINNER_PROFILE_CREATE = 0;
|
||||
private static final int VERSION_SPINNER_PROFILE_CREATE_MODDED = 1;
|
||||
public mcVersionSpinner(@NonNull Context context) {
|
||||
super(context);
|
||||
init();
|
||||
@ -133,11 +132,10 @@ public class mcVersionSpinner extends ExtendedTextView {
|
||||
}
|
||||
|
||||
private void performExtraAction(ProfileAdapterExtra extra) {
|
||||
switch (extra.id) {
|
||||
case VERSION_SPINNER_PROFILE_CREATE:
|
||||
//Replace with switch-case if you want to add more extra actions
|
||||
if (extra.id == VERSION_SPINNER_PROFILE_CREATE) {
|
||||
Tools.swapFragment((FragmentActivity) getContext(), ProfileTypeSelectFragment.class,
|
||||
ProfileTypeSelectFragment.TAG, true, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,9 @@ public class CustomControls {
|
||||
}
|
||||
|
||||
// Generate default control
|
||||
// Here for historical reasons
|
||||
// Just admire it idk
|
||||
@SuppressWarnings("unused")
|
||||
public CustomControls(Context ctx) {
|
||||
this();
|
||||
this.mControlDataList.add(new ControlData(ControlData.getSpecialButtons()[0])); // Keyboard
|
||||
|
@ -1,8 +0,0 @@
|
||||
package net.kdt.pojavlaunch.modloaders;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public interface FabricMetaReader {
|
||||
boolean processMetadata(JSONObject jsonObject) throws JSONException;
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package net.kdt.pojavlaunch.modloaders.modpacks.api;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
@ -232,11 +231,10 @@ public class CurseforgeApi implements ModpackApi{
|
||||
if(manifest.minecraft == null) return false;
|
||||
if(manifest.minecraft.version == null) return false;
|
||||
if(manifest.minecraft.modLoaders == null) return false;
|
||||
if(manifest.minecraft.modLoaders.length < 1) return false;
|
||||
return true;
|
||||
return manifest.minecraft.modLoaders.length >= 1;
|
||||
}
|
||||
|
||||
class CurseforgeSearchResult extends SearchResult {
|
||||
static class CurseforgeSearchResult extends SearchResult {
|
||||
int previousOffset;
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class AsyncMinecraftDownloader {
|
||||
|
||||
try {
|
||||
if(assets != null)
|
||||
downloadAssets(assets, verInfo.assets, assets.mapToResources ? new File(Tools.OBSOLETE_RESOURCES_PATH) : new File(Tools.ASSETS_PATH));
|
||||
downloadAssets(assets, assets.mapToResources ? new File(Tools.OBSOLETE_RESOURCES_PATH) : new File(Tools.ASSETS_PATH));
|
||||
} catch (Exception e) {
|
||||
Log.e("AsyncMcDownloader", e.toString(), e);
|
||||
ProgressKeeper.submitProgress(ProgressLayout.DOWNLOAD_MINECRAFT, -1, -1);
|
||||
@ -221,7 +221,7 @@ public class AsyncMinecraftDownloader {
|
||||
(int) Math.max((float)curr/max*100,0), R.string.mcl_launch_downloading_progress, destination.getName(), curr/BYTE_TO_MB, max/BYTE_TO_MB));
|
||||
}
|
||||
|
||||
public void downloadAssets(final JAssets assets, String assetsVersion, final File outputDir) {
|
||||
public void downloadAssets(final JAssets assets, final File outputDir) {
|
||||
LinkedBlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>();
|
||||
final ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 5, 500, TimeUnit.MILLISECONDS, workQueue);
|
||||
|
||||
|
@ -3,12 +3,15 @@ package org.lwjgl.glfw;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import android.content.*;
|
||||
import android.view.Choreographer;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import dalvik.annotation.optimization.CriticalNative;
|
||||
|
||||
public class CallbackBridge {
|
||||
public static Choreographer sChoreographer = Choreographer.getInstance();
|
||||
public static final Choreographer sChoreographer = Choreographer.getInstance();
|
||||
private static boolean isGrabbing = false;
|
||||
private static final ArrayList<GrabListener> grabListeners = new ArrayList<>();
|
||||
|
||||
@ -41,21 +44,11 @@ public class CallbackBridge {
|
||||
|
||||
public static void sendKeycode(int keycode, char keychar, int scancode, int modifiers, boolean isDown) {
|
||||
// TODO CHECK: This may cause input issue, not receive input!
|
||||
/*
|
||||
if (!nativeSendCharMods((int) keychar, modifiers) || !nativeSendChar(keychar)) {
|
||||
nativeSendKey(keycode, 0, isDown ? 1 : 0, modifiers);
|
||||
}
|
||||
*/
|
||||
|
||||
//nativeSendKeycode(keycode, keychar, scancode, isDown ? 1 : 0, modifiers);
|
||||
if(keycode != 0) nativeSendKey(keycode,scancode,isDown ? 1 : 0, modifiers);
|
||||
//else nativeSendKey(32,scancode,isDown ? 1 : 0, modifiers);
|
||||
if(isDown && keychar != '\u0000') {
|
||||
nativeSendCharMods(keychar,modifiers);
|
||||
nativeSendChar(keychar);
|
||||
}
|
||||
//throw new IllegalStateException("Tracing call");
|
||||
// sendData(JRE_TYPE_KEYCODE_CONTROL, keycode, Character.toString(keychar), Boolean.toString(isDown), modifiers);
|
||||
}
|
||||
|
||||
public static void sendChar(char keychar, int modifiers){
|
||||
@ -108,7 +101,8 @@ public class CallbackBridge {
|
||||
}
|
||||
|
||||
// Called from JRE side
|
||||
public static String accessAndroidClipboard(int type, String copy) {
|
||||
@SuppressWarnings("unused")
|
||||
public static @Nullable String accessAndroidClipboard(int type, String copy) {
|
||||
switch (type) {
|
||||
case CLIPBOARD_COPY:
|
||||
MainActivity.GLOBAL_CLIPBOARD.setPrimaryClip(ClipData.newPlainText("Copy", copy));
|
||||
@ -127,24 +121,6 @@ public class CallbackBridge {
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
private static String currData;
|
||||
public static void sendData(int type, Object... dataArr) {
|
||||
currData = "";
|
||||
for (int i = 0; i < dataArr.length; i++) {
|
||||
if (dataArr[i] instanceof Integer) {
|
||||
currData += Integer.toString((int) dataArr[i]);
|
||||
} else if (dataArr[i] instanceof String) {
|
||||
currData += (String) dataArr[i];
|
||||
} else {
|
||||
currData += dataArr[i].toString();
|
||||
}
|
||||
currData += (i + 1 < dataArr.length ? ":" : "");
|
||||
}
|
||||
nativeSendData(true, type, currData);
|
||||
}
|
||||
private static native void nativeSendData(boolean isAndroid, int type, String data);
|
||||
*/
|
||||
|
||||
|
||||
public static int getCurrentMods() {
|
||||
@ -183,10 +159,11 @@ public class CallbackBridge {
|
||||
|
||||
case LwjglGlfwKeycode.GLFW_KEY_NUM_LOCK:
|
||||
CallbackBridge.holdingNumlock = isDown;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Called from JRE side
|
||||
@SuppressWarnings("unused")
|
||||
private static void onGrabStateChanged(final boolean grabbing) {
|
||||
isGrabbing = grabbing;
|
||||
sChoreographer.postFrameCallbackDelayed((time) -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user