v0.8.2c: WndTitledMessage now grows in length just like WndInfoItem

This commit is contained in:
Evan Debenham 2020-08-22 20:22:47 -04:00
parent 65f30cfcbf
commit d6f73bc3fa

View File

@ -29,8 +29,8 @@ import com.watabou.noosa.ui.Component;
public class WndTitledMessage extends Window { public class WndTitledMessage extends Window {
protected static final int WIDTH_P = 120; protected static final int WIDTH_MIN = 120;
protected static final int WIDTH_L = 160; protected static final int WIDTH_MAX = 220;
protected static final int GAP = 2; protected static final int GAP = 2;
public WndTitledMessage( Image icon, String title, String message ) { public WndTitledMessage( Image icon, String title, String message ) {
@ -43,7 +43,7 @@ public class WndTitledMessage extends Window {
super(); super();
int width = PixelScene.landscape() ? WIDTH_L : WIDTH_P; int width = WIDTH_MIN;
titlebar.setRect( 0, 0, width, 0 ); titlebar.setRect( 0, 0, width, 0 );
add(titlebar); add(titlebar);
@ -53,6 +53,13 @@ public class WndTitledMessage extends Window {
text.setPos( titlebar.left(), titlebar.bottom() + 2*GAP ); text.setPos( titlebar.left(), titlebar.bottom() + 2*GAP );
add( text ); add( text );
while (PixelScene.landscape()
&& text.bottom() > (PixelScene.MIN_HEIGHT_L - 10)
&& width < WIDTH_MAX){
width += 20;
text.maxWidth(width);
}
resize( width, (int)text.bottom() + 2 ); resize( width, (int)text.bottom() + 2 );
} }
} }