From 34db321577d982d01285bb1c4e8d101c071b9b09 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 27 Oct 2019 10:51:35 -0400 Subject: [PATCH] Disabled 'import github' button on Android because Android is garbage and can't even do something as simple as an HTTP request without 5 workaround for different versions --- android/AndroidManifest.xml | 1 - .../mindustry/ui/dialogs/ModsDialog.java | 62 ++++++++++--------- core/src/io/anuke/mindustry/world/Block.java | 2 +- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 1e5b0141a9..a4202d4364 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -14,7 +14,6 @@ android:roundIcon="@mipmap/ic_launcher_round" android:isGame="true" android:appCategory="game" - android:usesCleartextTraffic="true" android:label="@string/app_name" android:theme="@style/GdxTheme" android:fullBackupContent="@xml/backup_rules"> diff --git a/core/src/io/anuke/mindustry/ui/dialogs/ModsDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/ModsDialog.java index 30a03fb412..ef0556202f 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/ModsDialog.java @@ -29,39 +29,41 @@ public class ModsDialog extends FloatingDialog{ buttons.addImageTextButton("$mods.guide", Icon.wiki, () -> Core.net.openURI(modGuideURL)) - .size(210f, 64f); + .size(android ? 210f + 250f + 10f : 210, 64f).colspan(android ? 2 : 1); - buttons.addImageTextButton("$mod.import.github", Icon.github, () -> { - ui.showTextInput("$mod.import.github", "", 64, "Anuken/ExampleMod", text -> { - ui.loadfrag.show(); - Core.net.httpGet("http://api.github.com/repos/" + text + "/zipball/master", loc -> { - Core.net.httpGet(loc.getHeader("Location"), result -> { - if(result.getStatus() != HttpStatus.OK){ - ui.showErrorMessage(Core.bundle.format("connectfail", result.getStatus())); - ui.loadfrag.hide(); - }else{ - try{ - FileHandle file = tmpDirectory.child(text.replace("/", "") + ".zip"); - Streams.copyStream(result.getResultAsStream(), file.write(false)); - mods.importMod(file); - file.delete(); - Core.app.post(() -> { - try{ - mods.reloadContent(); - setup(); - ui.loadfrag.hide(); - }catch(Throwable e){ - ui.showException(e); - } - }); - }catch(Throwable e){ - ui.showException(e); + if(!android){ + buttons.addImageTextButton("$mod.import.github", Icon.github, () -> { + ui.showTextInput("$mod.import.github", "", 64, "Anuken/ExampleMod", text -> { + ui.loadfrag.show(); + Core.net.httpGet("http://api.github.com/repos/" + text + "/zipball/master", loc -> { + Core.net.httpGet(loc.getHeader("Location"), result -> { + if(result.getStatus() != HttpStatus.OK){ + ui.showErrorMessage(Core.bundle.format("connectfail", result.getStatus())); + ui.loadfrag.hide(); + }else{ + try{ + FileHandle file = tmpDirectory.child(text.replace("/", "") + ".zip"); + Streams.copyStream(result.getResultAsStream(), file.write(false)); + mods.importMod(file); + file.delete(); + Core.app.post(() -> { + try{ + mods.reloadContent(); + setup(); + ui.loadfrag.hide(); + }catch(Throwable e){ + ui.showException(e); + } + }); + }catch(Throwable e){ + ui.showException(e); + } } - } + }, t -> Core.app.post(() -> ui.showException(t))); }, t -> Core.app.post(() -> ui.showException(t))); - }, t -> Core.app.post(() -> ui.showException(t))); - }); - }).size(250f, 64f); + }); + }).size(250f, 64f); + } shown(this::setup); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index cfd735f3b7..99b467b71c 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -241,7 +241,7 @@ public class Block extends BlockStorage{ } public void drawCracks(Tile tile){ - if(!tile.entity.damaged()) return; + if(!tile.entity.damaged() || size > maxCrackSize) return; int id = tile.pos(); TextureRegion region = cracks[size - 1][Mathf.clamp((int)((1f - tile.entity.healthf()) * crackRegions), 0, crackRegions-1)]; Draw.colorl(0.2f, 0.1f + (1f - tile.entity.healthf())* 0.6f);