mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 17:15:40 -04:00
Refactor V117CompatUtil.java
This commit is contained in:
parent
150feccb83
commit
8c62cef47b
@ -92,15 +92,17 @@ public class V117CompatUtil {
|
|||||||
Log.i("V117CompatDebug",rawList);
|
Log.i("V117CompatDebug",rawList);
|
||||||
return new ArrayList<>(Arrays.asList(rawList.split(",")));
|
return new ArrayList<>(Arrays.asList(rawList.split(",")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String regenPackList(List<String> packs) {
|
private static String regenPackList(List<String> packs) {
|
||||||
if(packs.size()==0) return "[]";
|
if(packs.size()==0) return "[]";
|
||||||
String ret = "["+packs.get(0);
|
StringBuilder ret = new StringBuilder("[" + packs.get(0));
|
||||||
for(int i = 1; i < packs.size(); i++) {
|
for(int i = 1; i < packs.size(); i++) {
|
||||||
ret += ","+packs.get(i);
|
ret.append(",").append(packs.get(i));
|
||||||
}
|
}
|
||||||
ret += "]";
|
ret.append("]");
|
||||||
return ret;
|
return ret.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runCheck(String version, Activity ctx) throws Exception{
|
public static void runCheck(String version, Activity ctx) throws Exception{
|
||||||
|
|
||||||
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(version);
|
PerVersionConfig.VersionConfig cfg = PerVersionConfig.configMap.get(version);
|
||||||
@ -115,25 +117,25 @@ public class V117CompatUtil {
|
|||||||
Object lock = new Object();
|
Object lock = new Object();
|
||||||
AtomicInteger proceed = new AtomicInteger(0);
|
AtomicInteger proceed = new AtomicInteger(0);
|
||||||
ctx.runOnUiThread(() -> {
|
ctx.runOnUiThread(() -> {
|
||||||
AlertDialog.Builder bldr = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
|
||||||
bldr.setTitle(R.string.global_warinng);
|
builder.setTitle(R.string.global_warinng);
|
||||||
bldr.setMessage(R.string.compat_117_message);
|
builder.setMessage(R.string.compat_117_message);
|
||||||
bldr.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||||
proceed.set(1);
|
proceed.set(1);
|
||||||
synchronized (lock) { lock.notifyAll(); }
|
synchronized (lock) { lock.notifyAll(); }
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
});
|
});
|
||||||
bldr.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
|
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
|
||||||
synchronized (lock) { lock.notifyAll(); }
|
synchronized (lock) { lock.notifyAll(); }
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
});
|
});
|
||||||
bldr.setNeutralButton(R.string.compat_11x_playanyway, (dialog, which) -> {
|
builder.setNeutralButton(R.string.compat_11x_playanyway, (dialog, which) -> {
|
||||||
proceed.set(2);
|
proceed.set(2);
|
||||||
synchronized (lock) { lock.notifyAll(); }
|
synchronized (lock) { lock.notifyAll(); }
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
});
|
});
|
||||||
bldr.setCancelable(false);
|
builder.setCancelable(false);
|
||||||
bldr.show();
|
builder.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
@ -158,6 +160,7 @@ public class V117CompatUtil {
|
|||||||
throw new MinecraftDownloaderTask.SilentException();
|
throw new MinecraftDownloaderTask.SilentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copyResourcePack(String gameDir, AssetManager am) throws IOException {
|
public static void copyResourcePack(String gameDir, AssetManager am) throws IOException {
|
||||||
File resourcepacksDir = new File(gameDir,"resourcepacks");
|
File resourcepacksDir = new File(gameDir,"resourcepacks");
|
||||||
if(!resourcepacksDir.exists()) resourcepacksDir.mkdirs();
|
if(!resourcepacksDir.exists()) resourcepacksDir.mkdirs();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user