mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
fix NPE and update keyboard visibility
This commit is contained in:
@@ -159,7 +159,6 @@ public class Forge implements ApplicationListener {
|
||||
public void create() {
|
||||
//install our error handler
|
||||
ExceptionHandler.registerErrorHandling();
|
||||
FThreads.invokeInEdtLater(() -> getDeviceAdapter().closeSplashScreen());
|
||||
|
||||
GuiBase.setIsAndroid(Gdx.app.getType() == Application.ApplicationType.Android);
|
||||
|
||||
@@ -258,6 +257,8 @@ public class Forge implements ApplicationListener {
|
||||
/* call preloadExtendedArt here, if we put it above we will *
|
||||
* get error: No OpenGL context found in the current thread. */
|
||||
preloadExtendedArt();
|
||||
// should be after create method but try to close this at a later time.
|
||||
getDeviceAdapter().closeSplashScreen();
|
||||
});
|
||||
};
|
||||
//see if app or assets need updating
|
||||
@@ -1092,7 +1093,7 @@ public class Forge implements ApplicationListener {
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
public static void startKeyInput(KeyInputAdapter adapter, boolean numeric) {
|
||||
public static void startKeyInput(KeyInputAdapter adapter) {
|
||||
if (keyInputAdapter == adapter) {
|
||||
return;
|
||||
}
|
||||
@@ -1100,7 +1101,9 @@ public class Forge implements ApplicationListener {
|
||||
keyInputAdapter.onInputEnd(); //make sure previous adapter is ended
|
||||
}
|
||||
keyInputAdapter = adapter;
|
||||
Gdx.input.setOnscreenKeyboardVisible(true, numeric ? Input.OnscreenKeyboardType.NumberPad : Input.OnscreenKeyboardType.Default);
|
||||
}
|
||||
public static void setOnScreenKeyboard(boolean val, boolean numeric) {
|
||||
Gdx.input.setOnscreenKeyboardVisible(val, numeric ? Input.OnscreenKeyboardType.NumberPad : Input.OnscreenKeyboardType.Default);
|
||||
}
|
||||
|
||||
public static boolean endKeyInput() {
|
||||
|
||||
@@ -676,7 +676,7 @@ public class CardImageRenderer {
|
||||
if (cv == null || isFaceDown)
|
||||
cv = card;
|
||||
CardStateView csv = cv.getState(true);
|
||||
text = cv.getText(csv, needTranslation ? CardTranslation.getTranslationTexts(csv) : null);
|
||||
text = cv.getText(csv, needTranslation && csv != null ? CardTranslation.getTranslationTexts(csv) : null);
|
||||
|
||||
} else {
|
||||
text = !card.isSplitCard() ?
|
||||
|
||||
@@ -234,6 +234,7 @@ public class FTextField extends FDisplayObject implements ITextField {
|
||||
|
||||
public boolean startEdit() {
|
||||
if (readOnly) { return false; }
|
||||
Forge.setOnScreenKeyboard(true, isNumeric);
|
||||
if (isEditing) { return true; } //do nothing if already editing
|
||||
|
||||
selStart = 0; //select all before starting input
|
||||
@@ -345,7 +346,7 @@ public class FTextField extends FDisplayObject implements ITextField {
|
||||
public void onInputEnd() {
|
||||
endEdit();
|
||||
}
|
||||
}, isNumeric);
|
||||
});
|
||||
isEditing = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user