v0.7.5b: fixed android text input windows not running on render thread

This commit is contained in:
Evan Debenham 2019-10-11 15:07:16 -04:00
parent af7a4a03f0
commit b4ae0ee991

View File

@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.android.windows.WndAndroidTextInput; import com.shatteredpixel.shatteredpixeldungeon.android.windows.WndAndroidTextInput;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.utils.Callback;
import com.watabou.utils.PlatformSupport; import com.watabou.utils.PlatformSupport;
import java.util.HashMap; import java.util.HashMap;
@ -140,14 +141,20 @@ public class AndroidPlatformSupport extends PlatformSupport {
} }
@Override @Override
public void promptTextInput(String title, String hintText, int maxLen, boolean multiLine, String posTxt, String negTxt, final TextCallback callback) { public void promptTextInput(final String title, final String hintText, final int maxLen, final boolean multiLine, final String posTxt, final String negTxt, final TextCallback callback) {
Game.scene().addToFront(new WndAndroidTextInput(title, hintText, maxLen, multiLine, posTxt, negTxt){ Game.runOnRenderThread( new Callback() {
@Override
public void call() {
Game.scene().addToFront(new WndAndroidTextInput(title, hintText, maxLen, multiLine, posTxt, negTxt) {
@Override @Override
protected void onSelect(boolean positive) { protected void onSelect(boolean positive) {
callback.onSelect(positive, getText()); callback.onSelect(positive, getText());
} }
}); });
} }
}
);
}
/* FONT SUPPORT */ /* FONT SUPPORT */
@ -235,6 +242,7 @@ public class AndroidPlatformSupport extends PlatformSupport {
fonts.put(latinAndCryllicFontGenerator, pixelFonts); fonts.put(latinAndCryllicFontGenerator, pixelFonts);
fonts.put(hangulFontGenerator, hangulFonts); fonts.put(hangulFontGenerator, hangulFonts);
fonts.put(hanFontGenerator, hanFonts); fonts.put(hanFontGenerator, hanFonts);
fonts.put(kataFontGenerator, kataFonts);
//use RGBA4444 to save memory. Extra precision isn't needed here. //use RGBA4444 to save memory. Extra precision isn't needed here.
packer = new PixmapPacker(pageSize, pageSize, Pixmap.Format.RGBA4444, 1, false); packer = new PixmapPacker(pageSize, pageSize, Pixmap.Format.RGBA4444, 1, false);