v0.7.4c: fixed keyboard not hiding correctly when text input is closed

This commit is contained in:
Evan Debenham 2019-08-11 16:02:25 -04:00
parent 8b4b241f8a
commit 406ed4c6ca

View File

@ -36,6 +36,7 @@ import android.widget.TextView;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidGraphics;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
@ -204,7 +205,7 @@ public class WndTextInput extends Window {
((ViewGroup) textInput.getParent()).removeView(textInput); ((ViewGroup) textInput.getParent()).removeView(textInput);
InputMethodManager imm = (InputMethodManager)((AndroidApplication)Gdx.app).getSystemService(Activity.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager)((AndroidApplication)Gdx.app).getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(textInput.getWindowToken(), 0); imm.hideSoftInputFromWindow(((AndroidGraphics)Gdx.app.getGraphics()).getView().getWindowToken(), 0);
//Soft keyboard sometimes triggers software buttons, so make sure to reassert immersive //Soft keyboard sometimes triggers software buttons, so make sure to reassert immersive
ShatteredPixelDungeon.updateSystemUI(); ShatteredPixelDungeon.updateSystemUI();