From ab6c9218887bd9e66e756323d31558af833dbc19 Mon Sep 17 00:00:00 2001 From: Peter Akers Date: Sat, 13 Jul 2024 07:16:08 +1000 Subject: [PATCH] - bug fix for the button resizing --- .../jmri/enginedriver/threaded_application.java | 1 + .../main/java/jmri/enginedriver/throttle.java | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/EngineDriver/src/main/java/jmri/enginedriver/threaded_application.java b/EngineDriver/src/main/java/jmri/enginedriver/threaded_application.java index 0faa9b90d..969a3c246 100644 --- a/EngineDriver/src/main/java/jmri/enginedriver/threaded_application.java +++ b/EngineDriver/src/main/java/jmri/enginedriver/threaded_application.java @@ -987,6 +987,7 @@ public String getServerDescription() { public void setServerDescription(String serverDescription) { this.serverDescription = serverDescription; } + @SuppressLint("DefaultLocale") public String getAboutInfo() { String s = ""; diff --git a/EngineDriver/src/main/java/jmri/enginedriver/throttle.java b/EngineDriver/src/main/java/jmri/enginedriver/throttle.java index dc54ec36b..13f18367b 100644 --- a/EngineDriver/src/main/java/jmri/enginedriver/throttle.java +++ b/EngineDriver/src/main/java/jmri/enginedriver/throttle.java @@ -6413,14 +6413,19 @@ void set_function_labels_and_listeners_for_view(int whichThrottle) { b.setText(bt); b.setVisibility(View.VISIBLE); // if there is a long first word or the total length is long, reduce the font size - if ((bt.indexOf(" ")>8) || (bt.length()>16)) { - b.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); - if ((bt.indexOf(" ")>10) || (bt.length()>20)) { - b.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); - if ((bt.indexOf(" ")>12) || (bt.length()>24)) { - b.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10); + if (((bt + " ").indexOf(" ")>8) || (bt.length()>15)) { + b.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); + if (((bt + " ").indexOf(" ")>10) || (bt.length()>18)) { + b.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); + if (((bt + " ").indexOf(" ")>12) || (bt.length()>21)) { + b.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + if (((bt + " ").indexOf(" ")>14) || (bt.length()>24)) { + b.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10); + } } } + } else { + b.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); } b.setEnabled(false); // start out with everything disabled } else {