mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-13 00:05:23 +07:00
Mobile text input fixes
This commit is contained in:
parent
031b1abe0a
commit
94b12704dc
@ -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){{
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public abstract class LStatement{
|
||||
|
||||
protected Cell<TextField> field(Table table, String value, Cons<String> 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<TextField> fields(Table table, String desc, String value, Cons<String> setter){
|
||||
|
@ -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<TextField> 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(){
|
||||
|
@ -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 -> {
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user