Skip to content

Commit

Permalink
Merge pull request #1122 from flash62au/master
Browse files Browse the repository at this point in the history
bug fix for the button resizing
  • Loading branch information
mstevetodd authored Jul 12, 2024
2 parents f005078 + ab6c921 commit 329eb0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,7 @@ public String getServerDescription() {
public void setServerDescription(String serverDescription) {
this.serverDescription = serverDescription;
}

@SuppressLint("DefaultLocale")
public String getAboutInfo() {
String s = "<span>";
Expand Down
17 changes: 11 additions & 6 deletions EngineDriver/src/main/java/jmri/enginedriver/throttle.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 329eb0b

Please sign in to comment.