v0.4.3: fixed some crash bugs with wndtextinput

This commit is contained in:
Evan Debenham 2016-10-07 00:11:39 -04:00
parent 4ffd6f9c83
commit 7e0fc9f2f0

View File

@ -59,7 +59,8 @@ public class WndTextInput extends Window {
this( title, initialValue, multiLine ? MAX_LEN_MULTI : MAX_LEN_SINGLE, multiLine, posTxt, negTxt); this( title, initialValue, multiLine ? MAX_LEN_MULTI : MAX_LEN_SINGLE, multiLine, posTxt, negTxt);
} }
public WndTextInput(String title, String initialValue, int maxLength, final boolean multiLine, String posTxt, String negTxt){ public WndTextInput(final String title, final String initialValue, final int maxLength,
final boolean multiLine, final String posTxt, final String negTxt){
super(); super();
//need to offset to give space for the soft keyboard //need to offset to give space for the soft keyboard
@ -76,6 +77,9 @@ public class WndTextInput extends Window {
width = WIDTH; width = WIDTH;
} }
ShatteredPixelDungeon.instance.runOnUiThread(new Runnable() {
@Override
public void run() {
RenderedTextMultiline txtTitle = PixelScene.renderMultiline( title, 9 ); RenderedTextMultiline txtTitle = PixelScene.renderMultiline( title, 9 );
txtTitle.maxWidth( width ); txtTitle.maxWidth( width );
txtTitle.hardlight( Window.TITLE_COLOR ); txtTitle.hardlight( Window.TITLE_COLOR );
@ -168,9 +172,6 @@ public class WndTextInput extends Window {
//The text input exists in a separate view ontop of the normal game view. //The text input exists in a separate view ontop of the normal game view.
// It visually appears to be a part of the game window but is infact a separate // It visually appears to be a part of the game window but is infact a separate
// UI element from the game entirely. // UI element from the game entirely.
ShatteredPixelDungeon.instance.runOnUiThread(new Runnable() {
@Override
public void run() {
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams( FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(
(int)((width - MARGIN*2)*scaledZoom), (int)((width - MARGIN*2)*scaledZoom),
(int)(inputHeight * scaledZoom), (int)(inputHeight * scaledZoom),