From 94b12704dc401d9e6656bb6688627ba1e6924392 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 13 Aug 2021 19:07:14 -0400 Subject: [PATCH] Mobile text input fixes --- core/src/mindustry/core/UI.java | 1 + core/src/mindustry/editor/MapInfoDialog.java | 6 +++--- core/src/mindustry/editor/MapResizeDialog.java | 2 +- core/src/mindustry/logic/LStatement.java | 2 +- core/src/mindustry/ui/dialogs/CustomRulesDialog.java | 6 +++--- core/src/mindustry/ui/dialogs/JoinDialog.java | 4 ++-- core/src/mindustry/ui/dialogs/PlanetDialog.java | 2 +- core/src/mindustry/ui/dialogs/SchematicsDialog.java | 6 +++--- gradle.properties | 2 +- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index 4024b8f72f..b0180958a1 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -261,6 +261,7 @@ public class UI implements ApplicationListener, Loadable{ this.numeric = inumeric; this.maxLength = textLength; this.accepted = confirmed; + this.allowEmpty = false; }}); }else{ new Dialog(titleText){{ diff --git a/core/src/mindustry/editor/MapInfoDialog.java b/core/src/mindustry/editor/MapInfoDialog.java index 63b9a053da..379b292f08 100644 --- a/core/src/mindustry/editor/MapInfoDialog.java +++ b/core/src/mindustry/editor/MapInfoDialog.java @@ -38,7 +38,7 @@ public class MapInfoDialog extends BaseDialog{ TextField name = t.field(tags.get("name", ""), text -> { tags.put("name", text); - }).size(400, 55f).addInputDialog(50).get(); + }).size(400, 55f).maxTextLength(50).get(); name.setMessageText("@unknown"); t.row(); @@ -46,7 +46,7 @@ public class MapInfoDialog extends BaseDialog{ TextArea description = t.area(tags.get("description", ""), Styles.areaField, text -> { tags.put("description", text); - }).size(400f, 140f).addInputDialog(1000).get(); + }).size(400f, 140f).maxTextLength(1000).get(); t.row(); t.add("@editor.author").padRight(8).left(); @@ -54,7 +54,7 @@ public class MapInfoDialog extends BaseDialog{ TextField author = t.field(tags.get("author", Core.settings.getString("mapAuthor", "")), text -> { tags.put("author", text); Core.settings.put("mapAuthor", text); - }).size(400, 55f).addInputDialog(50).get(); + }).size(400, 55f).maxTextLength(50).get(); author.setMessageText("@unknown"); t.row(); diff --git a/core/src/mindustry/editor/MapResizeDialog.java b/core/src/mindustry/editor/MapResizeDialog.java index f95edff43f..fe3e6eda06 100644 --- a/core/src/mindustry/editor/MapResizeDialog.java +++ b/core/src/mindustry/editor/MapResizeDialog.java @@ -29,7 +29,7 @@ public class MapResizeDialog extends BaseDialog{ table.field((w ? width : height) + "", TextFieldFilter.digitsOnly, value -> { int val = Integer.parseInt(value); if(w) width = val; else height = val; - }).valid(value -> Strings.canParsePositiveInt(value) && Integer.parseInt(value) <= maxSize && Integer.parseInt(value) >= minSize).addInputDialog(3); + }).valid(value -> Strings.canParsePositiveInt(value) && Integer.parseInt(value) <= maxSize && Integer.parseInt(value) >= minSize).maxTextLength(3); table.row(); } diff --git a/core/src/mindustry/logic/LStatement.java b/core/src/mindustry/logic/LStatement.java index 29c9c14677..e418b3a814 100644 --- a/core/src/mindustry/logic/LStatement.java +++ b/core/src/mindustry/logic/LStatement.java @@ -86,7 +86,7 @@ public abstract class LStatement{ protected Cell field(Table table, String value, Cons setter){ return table.field(value, Styles.nodeField, s -> setter.get(sanitize(s))) - .size(144f, 40f).pad(2f).color(table.color).maxTextLength(LAssembler.maxTokenLength).addInputDialog(); + .size(144f, 40f).pad(2f).color(table.color).maxTextLength(LAssembler.maxTokenLength); } protected Cell fields(Table table, String desc, String value, Cons setter){ diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 3a7086e727..8ba462668c 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -273,7 +273,7 @@ public class CustomRulesDialog extends BaseDialog{ t.add(text).left().padRight(5); t.field((prov.get()) + "", s -> cons.get(Strings.parseInt(s))) .padRight(100f) - .valid(f -> Strings.parseInt(f) >= min && Strings.parseInt(f) <= max).width(120f).left().addInputDialog(); + .valid(f -> Strings.parseInt(f) >= min && Strings.parseInt(f) <= max).width(120f).left(); }).padTop(0).row(); } @@ -285,7 +285,7 @@ public class CustomRulesDialog extends BaseDialog{ t.field((integer ? (int)prov.get() : prov.get()) + "", s -> cons.get(Strings.parseFloat(s))) .padRight(100f) .update(a -> a.setDisabled(!condition.get())) - .valid(f -> Strings.canParsePositiveFloat(f) && Strings.parseFloat(f) >= min && Strings.parseFloat(f) <= max).width(120f).left().addInputDialog(); + .valid(f -> Strings.canParsePositiveFloat(f) && Strings.parseFloat(f) >= min && Strings.parseFloat(f) <= max).width(120f).left(); }).padTop(0); main.row(); } @@ -309,7 +309,7 @@ public class CustomRulesDialog extends BaseDialog{ Cell field(Table table, float value, Floatc setter){ return table.field(Strings.autoFixed(value, 2), v -> setter.get(Strings.parseFloat(v))) .valid(Strings::canParsePositiveFloat) - .size(90f, 40f).pad(2f).addInputDialog(); + .size(90f, 40f).pad(2f); } void weatherDialog(){ diff --git a/core/src/mindustry/ui/dialogs/JoinDialog.java b/core/src/mindustry/ui/dialogs/JoinDialog.java index 89ac9464a6..1633255a26 100644 --- a/core/src/mindustry/ui/dialogs/JoinDialog.java +++ b/core/src/mindustry/ui/dialogs/JoinDialog.java @@ -67,7 +67,7 @@ public class JoinDialog extends BaseDialog{ TextField field = add.cont.field(Core.settings.getString("ip"), text -> { Core.settings.put("ip", text); - }).size(320f, 54f).maxTextLength(100).addInputDialog().get(); + }).size(320f, 54f).maxTextLength(100).get(); add.cont.row(); add.buttons.defaults().size(140f, 60f).pad(4f); @@ -287,7 +287,7 @@ public class JoinDialog extends BaseDialog{ t.field(Core.settings.getString("name"), text -> { player.name(text); Core.settings.put("name", text); - }).grow().pad(8).addInputDialog(maxNameLength); + }).grow().pad(8).maxTextLength(maxNameLength); ImageButton button = t.button(Tex.whiteui, Styles.clearFulli, 40, () -> { new PaletteDialog().show(color -> { diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index e948e8dcdf..cc71280e44 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -572,7 +572,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ s.field(searchText, t -> { searchText = t; readd[0].run(); - }).growX().height(50f).addInputDialog(); + }).growX().height(50f); }).growX().row(); Table con = p.table().growX().get(); diff --git a/core/src/mindustry/ui/dialogs/SchematicsDialog.java b/core/src/mindustry/ui/dialogs/SchematicsDialog.java index e054772b62..b61bd2fc1e 100644 --- a/core/src/mindustry/ui/dialogs/SchematicsDialog.java +++ b/core/src/mindustry/ui/dialogs/SchematicsDialog.java @@ -69,7 +69,7 @@ public class SchematicsDialog extends BaseDialog{ searchField = s.field(search, res -> { search = res; rebuildPane.run(); - }).growX().addInputDialog().get(); + }).growX().get(); }).fillX().padBottom(4); cont.row(); @@ -164,12 +164,12 @@ public class SchematicsDialog extends BaseDialog{ cont.table(tags -> buildTags(s, tags, false)).maxWidth(400f).fillX().left().row(); cont.margin(30).add("@name").padRight(6f); - TextField nameField = cont.field(s.name(), null).size(400f, 55f).addInputDialog().left().get(); + TextField nameField = cont.field(s.name(), null).size(400f, 55f).left().get(); cont.row(); cont.margin(30).add("@editor.description").padRight(6f); - TextField descField = cont.area(s.description(), Styles.areaField, t -> {}).size(400f, 140f).left().addInputDialog().get(); + TextField descField = cont.area(s.description(), Styles.areaField, t -> {}).size(400f, 140f).left().get(); Runnable accept = () -> { s.tags.put("name", nameField.getText()); diff --git a/gradle.properties b/gradle.properties index cec569e049..a8a10d7568 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works http.socketTimeout=80000 http.connectionTimeout=80000 -archash=fbbdf8776142ba1980855c954dcfbf00e96cbeb7 +archash=5a334f46162cdc6a29212a0eb9e34d1e666bf535